private static async Task BeeReaction(DiscordClient client, MessageCreateEventArgs e) { if (e.Message.Content.Contains(new char[] { 'b', 'B' })) { if (!e.Channel.IsPrivate) { GuildDetails guildDetails = GuildDetails.ClientGuilds[e.Guild.Id]; if (!guildDetails.GetCooldown("beereaction")) { await e.Message.CreateReactionAsync(DiscordEmoji.FromName(discord, ":bee:")); guildDetails.SetCooldown("beereaction", TimeSpan.FromMinutes(5)); } } } }
static async Task MainAsync(string[] args) { await b118DB.Init(); DiscordConfiguration discordConfiguration = new DiscordConfiguration { MinimumLogLevel = logLevel, Token = token, TokenType = TokenType.Bot }; discord = new DiscordClient(discordConfiguration); discord.Ready += async(DiscordClient client, ReadyEventArgs e) => { await discord.UpdateStatusAsync(new DiscordActivity("The Bee Movie | b.help", ActivityType.Watching)); }; #pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously discord.GuildAvailable += async(DiscordClient client, GuildCreateEventArgs e) => { GuildDetails.AddClientGuild(client, e.Guild); }; discord.MessageCreated += async(DiscordClient client, MessageCreateEventArgs e) => #pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously { if (e.Author.IsBot) { e.Handled = true; } }; discord.MessageCreated += BeeReaction; discord.MessageCreated += Bees; discord.MessageCreated += Beep; discord.ClientErrored += ClientErrored; CommandsNextConfiguration commandsNextConfiguration = new CommandsNextConfiguration { StringPrefixes = Prefixes, EnableDms = true, EnableDefaultHelp = false }; interactivity = discord.UseInteractivity(new InteractivityConfiguration() { Timeout = TimeSpan.FromSeconds(30) }); commands = discord.UseCommandsNext(commandsNextConfiguration); commands.CommandExecuted += CommandExecuted; commands.CommandErrored += CommandErrored; commands.RegisterCommands <BoardCommands>(); commands.RegisterCommands <BeatCommands>(); commands.RegisterCommands <CampaignCommands>(); commands.RegisterCommands <BCommands>(); lavalink = discord.UseLavalink(); await discord.ConnectAsync(); await Task.Delay(-1); }