Beispiel #1
0
        private async Task Discord_GuildMemberAdded(DiscordClient client, DSharpPlus.EventArgs.GuildMemberAddEventArgs e)
        {
            try
            {
                DiscordChannel test = Bot.Discord.Guilds
                                      .First(x => x.Value.Name.ToLower().Contains("devry")).Value.Channels
                                      .FirstOrDefault(x => x.Value.Name.ToLower().Contains("welcome"))
                                      .Value;

                await test.SendMessageAsync(embed : GenerateWelcomeMessage(e.Member));
            }
            catch (Exception ex)
            {
                Logger?.LogError($"An error occurred while trying to welcome '{e.Member.DisplayName}'\n\t{ex.Message}");
            }
        }
Beispiel #2
0
        private async Task DiscordClient_UserJoinedAsync(DiscordClient client, DSharpPlus.EventArgs.GuildMemberAddEventArgs e)
        {
            WelcomeMessageHandler welcomeMessageHandler = new WelcomeMessageHandler(client.GetCommandsNext().Services.GetService <WelcomeMessageService>());

            welcomeMessageHandler.SendWelcomeMessage(client, e);
        }