Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added a translate command #246

Merged
merged 2 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion apollo.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"cogs.commands.date",
"cogs.commands.event_sync",
"cogs.commands.flip",
"cogs.commands.joeltech",
"cogs.commands.karma_admin",
"cogs.commands.karma_blacklist",
"cogs.commands.karma",
Expand Down
22 changes: 0 additions & 22 deletions cogs/commands/joeltech.py

This file was deleted.

25 changes: 25 additions & 0 deletions cogs/commands/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,31 @@ async def chat(self, ctx: Context, message: str = None, gpt4: bool = False):
async def gpt4(self, ctx: Context, message: str):
await self.chat(ctx, message, True)

translateHelp = """
Translate a message from one language (source) to another (target)

To reply translate, ignore the message parameter

"""

@commands.hybrid_command(
help=translateHelp, brief="translate text from one language to another"
)
async def translate(
self,
ctx: Context,
source: str = "auto",
target: str = "en",
*,
message: str = "<Empty Message>",
):
repliedMessage = ctx.message.reference
if repliedMessage is not None:
message = await ctx.channel.fetch_message(repliedMessage.message_id)
message = message.content
translated = GoogleTranslator(source=source, target=target).translate(message)
await ctx.send(translated)


async def setup(bot: Bot):
await bot.add_cog(Misc(bot))
Loading