Initial commit

This commit is contained in:
Mira 2025-01-27 18:37:03 +01:00
commit 4e795fddc7
Signed by untrusted user who does not match committer: Xorog
GPG key ID: 983798ED9C3E7C36
37 changed files with 3269 additions and 0 deletions

View file

@ -0,0 +1,46 @@
// Project Makoto
// Copyright (C) 2023 Fortunevale
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY
using ProjectMakoto.Database;
using ProjectMakoto.Enums;
namespace ProjectMakoto.Plugins.Social.Entities;
public sealed class AfkStatus(Bot bot, SocialUser parent) : RequiresParent<SocialUser>(bot, parent)
{
[ColumnName("afk_reason"), ColumnType(ColumnTypes.Text), Nullable]
public string Reason
{
get => this.Parent.GetValue<string>(this.Parent.Id, "afk_reason");
set => _ = this.Parent.SetValue(this.Parent.Id, "afk_reason", value);
}
[ColumnName("afk_since"), ColumnType(ColumnTypes.BigInt), Default("0")]
public DateTime TimeStamp
{
get => this.Parent.GetValue<DateTime>(this.Parent.Id, "afk_since");
set => _ = this.Parent.SetValue(this.Parent.Id, "afk_since", value);
}
[ColumnName("afk_pingamount"), ColumnType(ColumnTypes.BigInt), Default("0")]
public long MessagesAmount
{
get => this.Parent.GetValue<long>(this.Parent.Id, "afk_pingamount");
set => _ = this.Parent.SetValue(this.Parent.Id, "afk_pingamount", value);
}
[ColumnName("afk_pings"), ColumnType(ColumnTypes.Text), Default("[]")]
public MessageDetails[] Messages
{
get => JsonConvert.DeserializeObject<MessageDetails[]>(this.Parent.GetValue<string>(this.Parent.Id, "afk_pings")) ?? [];
set => _ = this.Parent.SetValue(this.Parent.Id, "afk_pings", JsonConvert.SerializeObject(value));
}
[JsonIgnore]
internal DateTime LastMentionTrigger { get; set; } = DateTime.MinValue;
}

View file

@ -0,0 +1,31 @@
// Project Makoto
// Copyright (C) 2023 Fortunevale
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY
namespace ProjectMakoto.Plugins.Social.Entities;
public sealed class MessageDetails
{
private ulong _MessageId { get; set; } = 0;
public ulong MessageId { get => this._MessageId; set { this._MessageId = value; } }
private ulong _ChannelId { get; set; } = 0;
public ulong ChannelId { get => this._ChannelId; set { this._ChannelId = value; } }
private ulong _GuildId { get; set; } = 0;
public ulong GuildId { get => this._GuildId; set { this._GuildId = value; } }
private ulong _AuthorId { get; set; } = 0;
public ulong AuthorId { get => this._AuthorId; set { this._AuthorId = value; } }
}

16
Entities/PluginConfig.cs Normal file
View file

@ -0,0 +1,16 @@
// Project Makoto Example Plugin
// Copyright (C) 2023 Fortunevale
// This code is licensed under MIT license (see 'LICENSE'-file for details)
namespace ProjectMakoto.Plugins.Social.Entities;
public class PluginConfig
{
public string KawaiiRedToken = "";
public string Cuddle = "🅿";
public string Kiss = "🅿";
public string Slap = "🅿";
public string Proud = "🅿";
public string Hug = "🅿";
}

28
Entities/SocialUser.cs Normal file
View file

@ -0,0 +1,28 @@
using ProjectMakoto.Database;
using ProjectMakoto.Enums;
namespace ProjectMakoto.Plugins.Social.Entities;
[TableName("users")]
public sealed class SocialUser : PluginDatabaseTable
{
public SocialUser(BasePlugin plugin, ulong identifierValue) : base(plugin, identifierValue)
{
this.Id = identifierValue;
this.AfkStatus = new AfkStatus(this.Plugin.Bot, this);
}
[ColumnName("userid"), ColumnType(ColumnTypes.BigInt), Primary]
internal ulong Id { get; init; }
[ColumnName("blocked_users"), ColumnType(ColumnTypes.LongText), Default("[]")]
public ulong[] BlockedUsers
{
get => JsonConvert.DeserializeObject<ulong[]>(this.GetValue<string>(this.Id, "blocked_users")) ?? [];
set => this.SetValue(this.Id, "blocked_users", JsonConvert.SerializeObject(value));
}
[ContainsValues]
public AfkStatus AfkStatus { get; init; }
}

102
Entities/Translations.cs Normal file
View file

@ -0,0 +1,102 @@
// Project Makoto
// Copyright (C) 2023 Fortunevale
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY
namespace ProjectMakoto.Plugins.Social.Entities;
#pragma warning disable CS8981
#pragma warning disable CS8618
#pragma warning disable IDE1006
public class Translations : ITranslations
{
public Dictionary<string, int> Progress = new();
public CommandTranslation[] CommandList { get; set; }
#region AutoGenerated
public commands Commands;
public sealed class commands
{
public slap Slap;
public sealed class slap
{
public MultiTranslationKey Self;
public MultiTranslationKey Other;
}
public pat Pat;
public sealed class pat
{
public MultiTranslationKey Self;
public MultiTranslationKey Other;
}
public kiss Kiss;
public sealed class kiss
{
public MultiTranslationKey Self;
public MultiTranslationKey Other;
}
public kill Kill;
public sealed class kill
{
public MultiTranslationKey Self;
public MultiTranslationKey Other;
}
public hug Hug;
public sealed class hug
{
public MultiTranslationKey Self;
public MultiTranslationKey Other;
}
public highFive HighFive;
public sealed class highFive
{
public MultiTranslationKey Self;
public MultiTranslationKey Other;
}
public cuddle Cuddle;
public sealed class cuddle
{
public MultiTranslationKey Self;
public MultiTranslationKey Other;
}
public boop Boop;
public sealed class boop
{
public MultiTranslationKey Self;
public MultiTranslationKey Other;
}
public SingleTranslationKey BlockedByVictim;
public SingleTranslationKey BlockedVictim;
public afk Afk;
public sealed class afk
{
public SingleTranslationKey SetAfk;
public SingleTranslationKey Title;
public events Events;
public sealed class events
{
public SingleTranslationKey CurrentlyAfk;
public SingleTranslationKey AndMore;
public SingleTranslationKey MessageListing;
public SingleTranslationKey Message;
public SingleTranslationKey MissedTitle;
public SingleTranslationKey NoLongerAfk;
}
}
public unblockUser UnblockUser;
public sealed class unblockUser
{
public SingleTranslationKey Unblocked;
public SingleTranslationKey NotBlocked;
}
public blockUser BlockUser;
public sealed class blockUser
{
public SingleTranslationKey CannotBlock;
public MultiTranslationKey Blocked;
public SingleTranslationKey AlreadyBlocked;
}
}
#endregion AutoGenerated
}