1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-04-30 11:09:54 +03:00

Switch to Remora.Discord (#41)

result checks go brrr

this also involves switching to using Discord's modern stuff like embeds
and interactions

and using brand-new for me programming concepts (dependency injection,
results)

---------

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
Signed-off-by: mctaylors <95250141+mctaylors@users.noreply.github.com>
Co-authored-by: mctaylors <95250141+mctaylors@users.noreply.github.com>
Co-authored-by: nrdk <neroduck@vk.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
Octol1ttle 2023-07-09 18:32:14 +05:00 committed by GitHub
parent 2ab7a07784
commit abbb58f801
Signed by: GitHub
GPG key ID: 4AEE18F83AFDEB23
54 changed files with 5011 additions and 3021 deletions

View file

@ -1,38 +1,18 @@
using System.Text.Json.Serialization;
using Discord;
using Remora.Rest.Core;
namespace Boyfriend.Data;
public record MemberData {
public DateTimeOffset? BannedUntil;
public ulong Id;
public bool IsInGuild;
public List<DateTimeOffset> JoinedAt;
public List<DateTimeOffset> LeftAt;
public DateTimeOffset? MutedUntil;
public List<Reminder> Reminders;
public List<ulong> Roles;
[JsonConstructor]
public MemberData(DateTimeOffset? bannedUntil, ulong id, bool isInGuild, List<DateTimeOffset> joinedAt,
List<DateTimeOffset> leftAt, DateTimeOffset? mutedUntil, List<Reminder> reminders, List<ulong> roles) {
BannedUntil = bannedUntil;
/// <summary>
/// Stores information about a member
/// </summary>
public class MemberData {
public MemberData(ulong id, DateTimeOffset? bannedUntil) {
Id = id;
IsInGuild = isInGuild;
JoinedAt = joinedAt;
LeftAt = leftAt;
MutedUntil = mutedUntil;
Reminders = reminders;
Roles = roles;
BannedUntil = bannedUntil;
}
public MemberData(IGuildUser user) {
Id = user.Id;
IsInGuild = true;
JoinedAt = new List<DateTimeOffset> { user.JoinedAt!.Value };
LeftAt = new List<DateTimeOffset>();
Roles = user.RoleIds.ToList();
Roles.Remove(user.Guild.Id);
Reminders = new List<Reminder>();
}
public ulong Id { get; }
public DateTimeOffset? BannedUntil { get; set; }
public List<Snowflake> Roles { get; set; } = new();
public List<Reminder> Reminders { get; } = new();
}