Esempio n. 1
0
        public void ChangeType()
        {
            commands.CreateCommand("CommandType")
            .Parameter("Type", ParameterType.Required)
            .Parameter("CommandType", ParameterType.Required)
            .Do(async(e) =>
            {
                string returnstring = "error";
                if (new ServerRepo(new ServerContext()).IsServerVerified(e.Server.Id))
                {
                    if (new ServerRepo(new ServerContext()).IsAdmin(e.User.Id, e.Server.Id) == true)
                    {
                        if (e.GetArg("Type").ToLower() == "rank")
                        {
                            CommandType result;
                            CommandType.TryParse(e.GetArg("CommandType"), out result);
                            new SettingsRepo(new SettingsContext()).SetRankType(result, e.Server.Id);
                            returnstring = Eng_Default.CommandTypeChange("rank", e.GetArg("CommandType"));
                        }
                        else if (e.GetArg("Type").ToLower() == "role")
                        {
                            CommandType result;
                            try
                            {
                                CommandType.TryParse(e.GetArg("CommandType"), out result);
                                new SettingsRepo(new SettingsContext()).SetRoleType(result, e.Server.Id);
                                returnstring = Eng_Default.CommandTypeChange("rank", e.GetArg("CommandType"));
                            }
                            catch
                            {
                                returnstring = "Correct commandtypes for Role are:" +
                                               "\n**Basic**: Just simple Top, Jungle, Mid, ADC, Support" +
                                               "\n**Main**: Makes it Top-Main, Jungle-Main, etc" +
                                               "\n**Mains**: Makes it Top-Mains, Jungle-Mains, etc";
                            }
                        }
                    }
                    else
                    {
                        returnstring = Eng_Default.NotAllowed();
                    }
                }
                else
                {
                }

                await e.Channel.SendMessage(returnstring);
            });
        }