Exemplo n.º 1
0
 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));
         }
     }
 }