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; } }
}