Ejemplo n.º 1
0
        private static Task Client_GuildAvailable(DiscordClient client, DSharpPlus.EventArgs.GuildCreateEventArgs e)
        {
            client.Logger.Log(LogLevel.Information, new EventId(701, "GuildAvailable"),
                              $"Guild available: {e.Guild.Name}");

            return(Task.CompletedTask);
        }
Ejemplo n.º 2
0
        private Task Client_GuildAvailable(DSharpPlus.EventArgs.GuildCreateEventArgs e)
        {
            // let's log the name of the guild that was just
            // sent to our client
            e.Client.DebugLogger.LogMessage(LogLevel.Info, "DBot", $"Guild available: {e.Guild.Name}", DateTime.Now);

            // since this method is not async, let's return
            // a completed task, so that no additional work
            // is done
            return(Task.CompletedTask);
        }
Ejemplo n.º 3
0
Archivo: Bot.cs Proyecto: arxae/SongBot
        private Task Client_GuildAvailable(DSharpPlus.EventArgs.GuildCreateEventArgs e)
        {
            return(Task.Run(() =>
            {
                if (e.Guild.Id != ContentManager.Config.SongDiscordGuildId)
                {
                    return;
                }

                var rpgChannel = e.Guild.Channels.FirstOrDefault(c => c.Name == ContentManager.Config.RpgChannel);
                ContentManager.RpgChannel = rpgChannel ?? throw new ArgumentException("Could not find the RPG channel");
            }));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Ensures that any loaded guild is in the database.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e">Discord Guild to check.</param>
        /// <returns></returns>
        private async Task _discordClient_GuildHandler(DiscordClient sender, DSharpPlus.EventArgs.GuildCreateEventArgs e)
        {
            var guild = new Guild()
            {
                Id = e.Guild.Id.ToString(), NotificationsChannel = e.Guild.GetDefaultChannel().Id.ToString()
            };
            var filter = Builders <Guild> .Filter.Eq(x => x.Id, guild.Id);

            var result = (await _guildCollection.FindAsync(filter)).FirstOrDefault();

            if (result == null)
            {
                await _guildCollection.InsertOneAsync(guild);
            }
        }
Ejemplo n.º 5
0
 public static Task Client_GuildAvailable(DiscordClient sender, DSharpPlus.EventArgs.GuildCreateEventArgs e)
 {
     return(Task.CompletedTask);
 }
Ejemplo n.º 6
0
 private async Task BotClient_GuildCreated(DSharpPlus.EventArgs.GuildCreateEventArgs e)
 {
 }