Exemplo n.º 1
0
        public async Task RemoveAutoMessageChannelAsync()
        {
            if (AutomessageHandler.Cache.TryGetValue(Context.Channel.Id, out var config))
            {
                if (AutomessageHandler.RemoveAutomessageChannel(config.Value))
                {
                    await ReplyAsync("Channel Removed.");
                }
                else
                {
                    await ReplyAsync("Error removing channel, try again.");
                }
            }
            else
            {
                var dbConfig = AutomessageHandler.GetAutomessageChannel(Context.Channel.Id);
                if (dbConfig == null)
                {
                    await ReplyAsync("Done.");

                    return;
                }

                if (AutomessageHandler.RemoveAutomessageChannel(dbConfig))
                {
                    await ReplyAsync("Channel Removed.");
                }
                else
                {
                    await ReplyAsync("Error removing channel, try again.");
                }
            }
        }
Exemplo n.º 2
0
        public async Task AddAutoMessageChannelAsync([Summary("The amount of messages between each auto-message")] int messageCount, [Remainder] string message)
        {
            var config = AutomessageHandler.GetAutomessageChannel(Context.Channel.Id);

            if (config != null)
            {
                await ReplyAsync("Channel Already Exists.");

                return;
            }

            var newChannel = new AutomessageChannel(Context.Channel.Id)
            {
                Response  = message,
                RespondOn = messageCount
            };

            AutomessageHandler.SaveAutomessageChannel(newChannel);
            await ReplyAsync("Channel Added.");
        }