private void Guild(string text, long userId) { switch (text) { case "Guild G": case "/Gguild": { Guild guild = modelGuild.GuildGet(userId); if (guild != null) { if (modelGuild.TryIfGuildMaster(userId)) { SendOneMessage(userId, viewGuild.GetGuild(guild), viewGuild.GetGuldReplyKeyboard(true)); } else { SendOneMessage(userId, viewGuild.GetGuild(guild), viewGuild.GetGuldReplyKeyboard(false)); } } else { List <Guild> guilds = modelGuild.GetOpenGuild(userId); SendOneMessage(userId, viewGuild.GetOpenGuilds(guilds), viewGuild.keyboardCreateChoose); } } break; case "/Gwork": case "Work G": { SendOneMessage(userId, viewGuild.workGuild, viewGuild.keyboardWorkGuild); } break; case "Chat G": { String s = modelGuild.GetChatLink(userId); SendOneInlineMessage(userId, viewGuild.GetChatUrl(s), viewGuild.GetChatUrlKeyboard(s)); } break; case var text1 when new Regex(@"⚡\) G$").IsMatch(text): { Person person = modelGuild.Work(userId, Convert.ToInt32(text.Substring(0, 1)) + 1, out int goldOld, out int expOld, out bool lvlUp); // number start from 1, by it use 2 energy String[] work = viewGuild.Work(person, goldOld, expOld, lvlUp); SendOneMessage(userId, work[0], viewGuild.keyboardGuild); if (work[1] != null) //if have lvl up { SendOneInlineMessage(userId, view.chooseStates, view.keyboardLvlUp); } } break; case var text1 when new Regex(@"^/Gjoin_\d{1,3}$").IsMatch(text): { int guildId = Convert.ToInt32(text.Split('_')[1]); Guild guild = modelGuild.GuildJoinOut(userId, guildId); if (guild != null) //if have lvl up { SendOneMessage(userId, viewGuild.GetGuild(guild), viewGuild.GetGuldReplyKeyboard(false)); } else { SendOneMessage(userId, viewGuild.doSomeThingWrong, viewTown.keyboardTowne); } } break; case var text1 when modelGuild.TryIfGuildMaster(userId): GuildMaster(text, userId); break; case "Create G": SendOneMessage(userId, viewGuild.createGuild, viewGuild.keyboardCreateChoose); break; case var text2 when new Regex(@"^/GCreate_", RegexOptions.IgnoreCase).IsMatch(text): { string nameGuild = text.Split('_')[1]; Guild guildNew = modelGuild.GuildCreate(userId, nameGuild, out bool lvlIsSmall, out bool notEnouthGold); if (lvlIsSmall) { nameGuild = viewGuild.createGuildFalseLvl; } else if (notEnouthGold) { nameGuild = viewGuild.createGuildFalseGold; } else if (guildNew == null) { nameGuild = viewGuild.createGuildFalseName; } else { nameGuild = viewGuild.createGuildOk; } SendOneMessage(userId, nameGuild, view.keyboardHome); break; } case "Change G": case "/GChange": List <Guild> guildsOpen = modelGuild.GetOpenGuild(userId); SendOneMessage(userId, viewGuild.GetOpenGuilds(guildsOpen), viewGuild.keyboardCreateChoose); break; case "/GLeave": string guildLeave = viewGuild.doSomeThingWrong; if (modelGuild.GuildLeave(userId)) { guildLeave = viewGuild.leaveGuildSucces; } SendOneMessage(userId, guildLeave, view.keyboardHome); break; } }