mirror of
https://github.com/RPCS3/discord-bot.git
synced 2026-01-31 01:25:22 +01:00
18 lines
747 B
C#
18 lines
747 B
C#
using CompatBot.Database;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace CompatBot.EventHandlers;
|
|
|
|
internal static class Greeter
|
|
{
|
|
public static async Task OnMemberAdded(DiscordClient _, GuildMemberAddedEventArgs args)
|
|
{
|
|
await using var db = BotDb.OpenRead();
|
|
if (await db.Explanation.FirstOrDefaultAsync(e => e.Keyword == "motd").ConfigureAwait(false) is {Text.Length: >0} explanation)
|
|
{
|
|
var dm = await args.Member.CreateDmChannelAsync().ConfigureAwait(false);
|
|
await dm.SendMessageAsync(explanation.Text, explanation.Attachment, explanation.AttachmentFilename).ConfigureAwait(false);
|
|
Config.Log.Info($"Sent motd to {args.Member.GetMentionWithNickname()}");
|
|
}
|
|
}
|
|
} |