public async Task leave(string serverName = null) { p.doAction(Context.User, Context.Guild.Id, Program.Module.Settings); if (Context.User.Id != Sentences.ownerId) { await ReplyAsync(Sentences.onlyMasterStr(Context.Guild.Id)); } else { if (serverName == null) { await Context.Guild.LeaveAsync(); } else { IGuild g = p.client.Guilds.ToList().Find(x => x.Name.ToUpper() == serverName.ToUpper()); if (g == null) { await ReplyAsync(Sentences.noCorrespondingGuild(Context.Guild.Id)); } else { await g.LeaveAsync(); await ReplyAsync(Sentences.doneStr(Context.Guild.Id)); } } } }
public async Task reloadLanguage() { p.doAction(Context.User, Context.Guild.Id, Program.Module.Settings); if (Context.User.Id != Sentences.ownerId) { await ReplyAsync(Sentences.onlyMasterStr(Context.Guild.Id)); } else { p.UpdateLanguageFiles(); await ReplyAsync(Sentences.doneStr(Context.Guild.Id)); } }
public async Task stopRadio(params string[] words) { p.doAction(Context.User, Context.Guild.Id, Program.Module.Radio); RadioChannel radio = p.radios.Find(x => x.m_guildId == Context.Guild.Id); if (radio == null) { await ReplyAsync(Sentences.radioNotStarted(Context.Guild.Id)); } else { await radio.Stop(); p.radios.Remove(radio); await ReplyAsync(Sentences.doneStr(Context.Guild.Id)); } }
public async Task setLanguage(params string[] language) { p.doAction(Context.User, Context.Guild.Id, Program.Module.Settings); if (Context.User.Id != Context.Guild.OwnerId) { await ReplyAsync(Sentences.onlyOwnerStr(Context.Guild.Id, Context.Guild.OwnerId)); } else if (language.Length == 0) { await ReplyAsync(Sentences.needLanguage(Context.Guild.Id)); } else { string nextLanguage = Program.addArgs(language); string lang = null; if (p.allLanguages.ContainsKey(nextLanguage)) { lang = nextLanguage; } foreach (var key in p.allLanguages) { if (key.Value.Contains(nextLanguage)) { lang = key.Key; break; } } if (lang == null) { await ReplyAsync(Sentences.needLanguage(Context.Guild.Id)); } else { p.guildLanguages[Context.Guild.Id] = lang; File.WriteAllText("Saves/Servers/" + Context.Guild.Id + "/language.dat", lang); await ReplyAsync(Sentences.doneStr(Context.Guild.Id)); } } }
public async Task setPrefix(params string[] command) { p.doAction(Context.User, Context.Guild.Id, Program.Module.Settings); if (Context.User.Id != Context.Guild.OwnerId) { await ReplyAsync(Sentences.onlyOwnerStr(Context.Guild.Id, Context.Guild.OwnerId)); } else { if (command.Length == 0) { p.prefixs[Context.Guild.Id] = ""; File.WriteAllText("Saves/Servers/" + Context.Guild.Id + "/prefix.dat", ""); await ReplyAsync(Sentences.prefixRemoved(Context.Guild.Id)); } else { string prefix = Program.addArgs(command); p.prefixs[Context.Guild.Id] = prefix; File.WriteAllText("Saves/Servers/" + Context.Guild.Id + "/prefix.dat", prefix); await ReplyAsync(Sentences.doneStr(Context.Guild.Id)); } } }