public static async Task SendConversationMessage(string msg) { ConversationData.LoadDatabase(); for (int i = 0; i < ConversationData.ConversationChannels.Count(); i++) { try { await Program.discord.GetShard(ConversationData.ConversationChannels[i].GuildId).GetChannelAsync(ConversationData.ConversationChannels[i].Id).Result.SendMessageAsync(msg); } catch (Exception e) { await Program.Mrcarrot.SendMessageAsync($"Problems encountered sending message to channel {ConversationData.ConversationChannels[i].Id}:\n{e.ToString()}"); } Thread.Sleep(5); } }
public async Task StartConversation(CommandContext ctx, bool loadDatabase = true) { if (ctx.User.Id != 366298290377195522) { return; } if (Program.conversation) { await ctx.RespondAsync("Conversation is already started. Use `conversation stop` to stop."); return; } if (loadDatabase) { ConversationData.LoadDatabase(); } await Conversation.SendConversationMessage("The CarrotBot Multi-Server Conversation is now active!\nRemember: you must accept the terms (%conversation acceptterms) to enter!"); Program.conversation = true; await ctx.RespondAsync("Started conversation."); }
public static async Task StartConversation(bool alert = true) { try { ConversationData.LoadDatabase(); if (alert) { if (!Program.isBeta) { await SendConversationMessage("The CarrotBot Multi-Server Conversation is now active!\nRemember: you must accept the terms (%conversation acceptterms) to enter!"); } else { await SendConversationMessage("The CarrotBot Multi-Server Conversation Beta is now active!\nRemember: you must accept the terms (%conversation acceptterms) to enter!\nThis is a beta version and as such is less stable and more frequently updated than the main conversation."); } } Program.conversation = true; } catch (Exception e) { await Program.Mrcarrot.SendMessageAsync(e.ToString()); } }
public async Task ReloadDatabase(CommandContext ctx) { ConversationData.LoadDatabase(); await ctx.RespondAsync("Reloaded conversation database."); }