Skip to content

Commit

Permalink
Adding in helper functions for translator
Browse files Browse the repository at this point in the history
  • Loading branch information
Lumesque committed Jun 3, 2024
1 parent 317cc15 commit e4bc112
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
2 changes: 2 additions & 0 deletions disc_bot/cog_helpers/player.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from dataclasses import dataclass, InitVar
from typing import Optional
from ..config.globals import _G
import logging
logger = logging.getLogger('discord_player')

@dataclass
class DiscordPlayer:
Expand Down
2 changes: 1 addition & 1 deletion disc_bot/cogs/BidCog.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ async def end_bid(self, ctx):
self.bidders = {}
await ctx.channel.send(f"""
The winning number is: **
##{rolled}
## {rolled}
__Winners__:
{winners}
__Losers__:
Expand Down
18 changes: 16 additions & 2 deletions disc_bot/cogs/TranslatorCog.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,24 @@ async def on_message(self, message):
translated = self.translator.translate(message.content)
if translated and translated != message.content:
logger.debug(
f'Bot {self.bot.user} translated "{message.content}" -> {translated}'
)
f'BOT TRANSLATION EVENT::'
+ f'"{message.content}" -> {translated}'
)
await message.channel.send(translated)

@commands.command()
async def set_language(self, ctx, language: str):
self.translator.set_language(language)
await ctx.send(f"Changed default language to {language}")

@commands.command()
async def print_language(self, ctx):
await ctx.send(self.translator.curr_lang)

@commands.command()
async def possible_languages(self, ctx):
await ctx.send(self.translator.format_possible_languages())

def repr(self):
return f"{self.__class__.__name__}"

Expand Down

0 comments on commit e4bc112

Please sign in to comment.