mirror of
https://github.com/RPCS3/discord-bot.git
synced 2024-12-13 05:35:58 +00:00
23 lines
870 B
C#
23 lines
870 B
C#
using System.Threading.Tasks;
|
|
using CompatBot.Database;
|
|
using CompatBot.Utils;
|
|
using DSharpPlus.EventArgs;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace CompatBot.EventHandlers
|
|
{
|
|
internal static class Greeter
|
|
{
|
|
public static async Task OnMemberAdded(GuildMemberAddEventArgs args)
|
|
{
|
|
using var db = new BotDb();
|
|
var explanation = await db.Explanation.FirstOrDefaultAsync(e => e.Keyword == "motd").ConfigureAwait(false);
|
|
if (explanation != null)
|
|
{
|
|
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()}");
|
|
}
|
|
}
|
|
}
|
|
} |