fix(core:i18n): fix crash for DMs
This commit is contained in:
parent
ba21cf859b
commit
f00ff8d345
3 changed files with 5 additions and 50 deletions
|
@ -1,24 +0,0 @@
|
|||
import tortoise
|
||||
from tortoise import fields
|
||||
|
||||
|
||||
class Alias(tortoise.Model):
|
||||
id = fields.BigIntField(pk=True)
|
||||
user_id = fields.BigIntField()
|
||||
alias = fields.TextField(max_length=255)
|
||||
command = fields.TextField(max_length=255)
|
||||
guild = fields.BigIntField()
|
||||
|
||||
class Meta:
|
||||
table = "aliases"
|
||||
|
||||
def __str__(self):
|
||||
return (
|
||||
f"<Alias id={self.id} "
|
||||
f"user_id={self.user_id} "
|
||||
f"alias='{self.alias}' "
|
||||
f"command='{self.command}' "
|
||||
f"guild={self.guild}>"
|
||||
)
|
||||
|
||||
__repr__ = __str__
|
|
@ -1,24 +0,0 @@
|
|||
import tortoise
|
||||
from tortoise import fields
|
||||
|
||||
|
||||
class Warn(tortoise.Model):
|
||||
id = fields.BigIntField(pk=True)
|
||||
server_id = fields.BigIntField()
|
||||
user_id = fields.BigIntField()
|
||||
reason = fields.TextField(max_length=255)
|
||||
created_at = fields.DatetimeField()
|
||||
|
||||
class Meta:
|
||||
table = "warns"
|
||||
|
||||
def __str__(self):
|
||||
return (
|
||||
f"<Warn id={self.id} "
|
||||
f"server_id={self.server_id} "
|
||||
f"user_id={self.user_id} "
|
||||
f"reason='{self.reason}' "
|
||||
f"created_at={self.created_at}>"
|
||||
)
|
||||
|
||||
__repr__ = __str__
|
|
@ -75,9 +75,12 @@ class Translator:
|
|||
if user_locale:
|
||||
return self.translations[user_locale][untranslated]
|
||||
|
||||
guild_locale = search_for(
|
||||
config.Servers, ctx.guild.id, "locale", None
|
||||
guild_locale = (
|
||||
search_for(config.Servers, ctx.guild.id, "locale", None)
|
||||
if ctx.guild
|
||||
else None
|
||||
)
|
||||
|
||||
if guild_locale:
|
||||
return self.translations[guild_locale][untranslated]
|
||||
|
||||
|
|
Loading…
Reference in a new issue