diff --git a/fcts/languages.py b/fcts/languages.py index 98144017..b3a7ba35 100644 --- a/fcts/languages.py +++ b/fcts/languages.py @@ -63,7 +63,7 @@ async def tr(self, source: SourceType, string_id: str, **args): else: used_langs = await self.bot.get_cog('Utilities').get_languages(recipient, limit=1) lang_opt = used_langs[0][0] if len(used_langs) > 0 else self.default_language - else: + elif isinstance(source, int): # get lang from server ID lang_id = await self.bot.get_config(source, "language") if lang_id is None: @@ -71,6 +71,8 @@ async def tr(self, source: SourceType, string_id: str, **args): else: lang_opt = self.languages[lang_id] self.serv_opts[source] = lang_opt + else: + raise TypeError(f"Unknown type for translation source: {type(source)}") if lang_opt not in self.languages: # if lang not known: fallback to default lang_opt = self.default_language diff --git a/fcts/utilities.py b/fcts/utilities.py index 3f57a8b2..f566d647 100644 --- a/fcts/utilities.py +++ b/fcts/utilities.py @@ -65,6 +65,9 @@ async def global_check(self, ctx: MyContext): return True return False if await self.bot.check_axobot_presence(ctx=ctx): + if ctx.prefix.strip() == self.bot.user.mention: + invite = 'http://discord.gg/N55zY88' + await ctx.send(await self.bot._(ctx.guild.id, "errors.zbot-migration", invite=invite)) return False if not isinstance(ctx, commands.Context) or self.config is None: return True diff --git a/lang/errors/en.json b/lang/errors/en.json index 6421e23f..38db2c5d 100644 --- a/lang/errors/en.json +++ b/lang/errors/en.json @@ -35,5 +35,6 @@ "rolenotfound": "Unable to find the role `%{r}`", "toomanytxtchan": "You have too many accessible text channels", "unknown": "Oops, an error occurred :confused: Try again later, or contact support (command `about`).", - "usernotfound": "Unable to find the user `%{u}` :confused:" + "usernotfound": "Unable to find the user `%{u}` :confused:", + "zbot-migration": "This server now use Axobot, the new identity of Zbot. If you need help with the migration, don't hesitate to ask us at <%{invite}>!" } \ No newline at end of file diff --git a/lang/errors/fr.json b/lang/errors/fr.json index 28a748a9..d9925e42 100644 --- a/lang/errors/fr.json +++ b/lang/errors/fr.json @@ -35,5 +35,6 @@ "rolenotfound": "Impossible de trouver le rôle `%{r}`", "toomanytxtchan": "Vous avez trop de salons textuels accessibles", "unknown": "Oups, une erreur est survenue :confused: Réessayez plus tard, ou contactez le support (commande `about`).", - "usernotfound": "Impossible de trouver l'utilisateur `%{u}` :confused:" + "usernotfound": "Impossible de trouver l'utilisateur `%{u}` :confused:", + "zbot-migration": "Ce serveur utilise désormais Axobot, la nouvelle identité de Zbot. Si vous avez besoin d'aide pour la migration, n'hésitez pas à nous demander à <%{invite}> !" } \ No newline at end of file