示例#1
0
        private async Task ProcessCommand(ServerSettings settings, bool admin, SocketMessage message, SocketGuild server, string command, string parameter)
        {
            if (admin)
            {
                if (command.Equals("!AdminShowHex", StringComparison.OrdinalIgnoreCase))
                {
                    await message.Channel.SendMessageAsync(string.Empty, false, AdminCommands.ProcessShowHexCommand(parameter, server));
                }
                if (command.Equals("!AdminShowShards", StringComparison.OrdinalIgnoreCase))
                {
                    await message.Channel.SendMessageAsync(string.Empty, false, AdminCommands.ProcessShowShardsCommand(parameter, server));
                }
                if (command.Equals("!AdminSetEventReminderChannel", StringComparison.OrdinalIgnoreCase))
                {
                    await message.Channel.SendMessageAsync(string.Empty, false, AdminCommands.ProcessSetEventReminderChannel(parameter, server, settings));
                }
                if (command.Equals("!AdminDisableEventReminders", StringComparison.OrdinalIgnoreCase))
                {
                    await message.Channel.SendMessageAsync(string.Empty, false, AdminCommands.ProcessDisabelEventReminders(server.Id, settings));
                }
            }

            if (settings.ShowHex)
            {
                if (command.Equals("!cardlarge", StringComparison.OrdinalIgnoreCase) ||
                    command.Equals("!cl", StringComparison.OrdinalIgnoreCase))
                {
                    await message.Channel.SendMessageAsync(string.Empty, false, await HexCommands.ProcessCardCommand(parameter));
                }
                if (command.Equals("!card", StringComparison.OrdinalIgnoreCase))
                {
                    await message.Channel.SendMessageAsync(string.Empty, false, await HexCommands.ProcessCardCommand(parameter, true));
                }
                if (command.Equals("!equip", StringComparison.OrdinalIgnoreCase))
                {
                    await message.Channel.SendMessageAsync(string.Empty, false, await HexCommands.ProcessEquipCommand(parameter));
                }
                if (command.Equals("!equipment", StringComparison.OrdinalIgnoreCase))
                {
                    await message.Channel.SendMessageAsync(string.Empty, false, await HexCommands.ProcessEquipCommand(parameter));
                }
                if (command.Equals("!events", StringComparison.OrdinalIgnoreCase))
                {
                    await message.Channel.SendMessageAsync(string.Empty, false, HexCommands.ProcessEventCommand(parameter));
                }
            }

            if (settings.ShowShards)
            {
                if (command.Equals("!shardslarge", StringComparison.OrdinalIgnoreCase))
                {
                    await message.Channel.SendMessageAsync(string.Empty, false, ShardsCommands.ProcessShardsCommand(parameter));
                }
                if (command.Equals("!shards", StringComparison.OrdinalIgnoreCase))
                {
                    await message.Channel.SendMessageAsync(string.Empty, false, ShardsCommands.ProcessShardsCommand(parameter, true));
                }
                if (command.Equals("!shardstype", StringComparison.OrdinalIgnoreCase))
                {
                    await message.Channel.SendMessageAsync(string.Empty, false, ShardsCommands.ProcessShardstypeCommand(parameter));
                }
                if (command.Equals("!shardslist", StringComparison.OrdinalIgnoreCase))
                {
                    await message.Channel.SendMessageAsync(string.Empty, false, ShardsCommands.ProcessShardslistCommand(parameter));
                }
            }

            if (command.Equals("!tl", StringComparison.OrdinalIgnoreCase))
            {
                await message.Channel.SendMessageAsync(MiscCommands.ProcessTwitchLinkCommand(parameter));
            }
            if (command.Equals("!help", StringComparison.OrdinalIgnoreCase) ||
                command.Equals("!commands", StringComparison.OrdinalIgnoreCase) ||
                command.Equals("!commandlist", StringComparison.OrdinalIgnoreCase))
            {
                await message.Channel.SendMessageAsync(string.Empty, false, MiscCommands.ShowCommands(parameter, settings));
            }
            if (command.Equals("!privatechannel", StringComparison.OrdinalIgnoreCase))
            {
                await message.Author.SendMessageAsync("Hi, i am the Warden Bot. Type **!help** for a list of commands. Have a nice day!");
            }

            if (command.Equals("!test", StringComparison.OrdinalIgnoreCase))
            {
                eventReminder.DebugCheckForReminders();
                eventReminder.DebugAddNextEvent();
            }
        }
        public static Embed ProcessSetEventReminderChannel(string input, SocketGuild server, ServerSettings settings)
        {
            ulong?channelId     = null;
            bool  channelExists = false;

            foreach (SocketTextChannel channel in server.TextChannels)
            {
                if (channel.Name == input)
                {
                    channelId     = channel.Id;
                    channelExists = true;
                    break;
                }
            }

            if (!channelExists && input != string.Empty)
            {
                return(Response("The given TextChannel doesn't exist."));
            }
            else if (input == string.Empty)
            {
                if (settings.EventReminderChannelId != null)
                {
                    return(Response(string.Format("The current EventReminderChannel is \"{0}\"", server.GetChannel(settings.EventReminderChannelId.Value).Name)));
                }
                else
                {
                    return(Response("No EventReminderChannel is currently set."));
                }
            }
            else
            {
                SettingsManager.SetEventReminderChannel(server.Id, channelId);
                return(Response(string.Format("EventReminderChannel successfully set to channel \"{0}\"", server.GetChannel(settings.EventReminderChannelId.Value).Name)));
            }
        }