コード例 #1
0
        private void GuildMaster(string text, long userId)
        {
            switch (text)
            {
            case "/GInvite":
            case "Invite G":
                SendOneMessage(userId, viewGuild.invite, viewGuild.GetGuldReplyKeyboard(true));
                break;

            case "/GExclude":
            case "Exclude G":
                SendOneMessage(userId, viewGuild.exclude, viewGuild.GetGuldReplyKeyboard(true));
                break;

            case "Change chat G":
                SendOneMessage(userId, viewGuild.chatUrl, viewGuild.GetGuldReplyKeyboard(true));
                break;

            case var textInvite when new Regex(@"^/GInvite_", RegexOptions.IgnoreCase).IsMatch(text):
            {
                Guild  guild         = new Guild();
                Person person        = modelGuild.InvitePerson(userId, text.Substring(9), out guild);
                String stringForView = "";
                if (person == null)
                {
                    stringForView = viewGuild.inviteFaileByName;
                }
                else
                if (person.guild != null)
                {
                    stringForView = viewGuild.inviteFaileByGuild;
                }
                else
                {
                    stringForView = viewGuild.inviteSucces;
                    SendOneInlineMessage(person.id, viewGuild.GetMessageForInvite(guild), viewGuild.InviteInlineKeyboard(guild));
                }
                SendOneMessage(userId, stringForView, viewGuild.GetGuldReplyKeyboard(true));
            }
            break;

            case var textInvite when new Regex(@"^/GExlude_", RegexOptions.IgnoreCase).IsMatch(text):
            {
                Person person        = modelGuild.ExcludePerson(userId, text.Substring(9), out bool gildMaster);
                String stringForView = "";
                if (person == null)
                {
                    stringForView = (gildMaster) ? viewGuild.kikFailIMaster : viewGuild.inviteFaileByName;
                }
                else
                {
                    stringForView = viewGuild.excludeSucces;
                    SendOneMessage(person.id, viewGuild.excludeSuccesMessageToPlayer, view.keyboardHome);
                }
                SendOneMessage(userId, stringForView, viewGuild.GetGuldReplyKeyboard(true));
            }
            break;

            case var textInvite when new Regex(@"^/GSetChatUrl_", RegexOptions.IgnoreCase).IsMatch(text):
            {
                String s = viewGuild.chatUrlFail;
                if (modelGuild.SetChatLink(userId, text.Substring(13)))
                {
                    s = viewGuild.chatUrlSucces;
                }
                SendOneMessage(userId, s, viewGuild.GetGuldReplyKeyboard(true));
            }
            break;

            case "/GSetting":
            case "Setting G":
                SendOneMessage(userId, viewGuild.settingGuildMaster, viewGuild.keyboardGuildMasterSetting);
                break;

            case "Change Hire status G":
            {
                modelGuild.ChangeHire(userId);
                SendOneMessage(userId, viewGuild.changeHire, viewGuild.keyboardGuildMasterSetting);
            }
            break;

            case "All members G":
            {
                List <Person> people = modelGuild.GetMembers(userId);
                SendOneMessage(userId, viewGuild.GetMembersOfGuild(people), viewGuild.keyboardGuildMasterSetting);
            }
            break;
            }
        }