Esempio n. 1
0
        public async Task SetLanguage(params string[] language)
        {
            await p.DoAction(Context.User, Context.Guild.Id, Program.Module.Settings);

            if (!CanModify(Context.User, Context.Guild.OwnerId))
            {
                await ReplyAsync(Base.Sentences.OnlyOwnerStr(Context.Guild.Id, Context.Guild.OwnerId));
            }
            else if (language.Length == 0)
            {
                await ReplyAsync(Sentences.NeedLanguage(Context.Guild.Id));
            }
            else
            {
                string nextLanguage = Utilities.AddArgs(language);
                string lang         = Utilities.GetLanguage(nextLanguage);
                if (lang == null)
                {
                    await ReplyAsync(Sentences.InvalidLanguage(Context.Guild.Id));
                }
                else
                {
                    await p.db.SetLanguage(Context.Guild.Id, lang);
                    await ReplyAsync(Base.Sentences.DoneStr(Context.Guild.Id));
                }
            }
        }