add config language command
@@ -85,6 +85,21 @@ class Config(commands.Cog):
else:
await self.bot.send(ctx, 'That\'s not a valid option. (Valid options are `peaceful`, `easy`, `hard`)')
+ @config.command(name='language')
+ async def config_language(self, ctx, lang=None):
+ if lang is None:
+ guild = await self.db.fetch_guild(ctx.guild.id)
+ await self.bot.send(ctx, f'The server language is currently set to `{guild["lang"]}`.')
+ return
+
+ lang_codes = [l.replace('_', '-') for l in list(self.bot.langs)]
+
+ if lang.lower() in lang_codes:
+ await self.db.set_guild_attr(ctx.guild.id, 'lang', lang.replace('-', '_'))
+ await self.bot.send(ctx, f'Set the server language to `{lang.lower()}`.')
+ else:
+ await self.bot.send(ctx, 'That\'s not a valid option. (Valid options are: `{}`)'.format('`, `'.join(lang_codes)))
+
def setup(bot):
bot.add_cog(Config(bot))
