Vexed01 / Vex-Cogs

My cogs for Red.
https://cogdocs.vexcodes.com
GNU General Public License v3.0
28 stars 21 forks source link

[MadTranslate] Cog is broken #78

Closed Vexed01 closed 2 years ago

Vexed01 commented 2 years ago

What cog is this bug report for?

MadTranslate

What versions are you running?

Versions                       
                ╷            ╷         ╷              
                │ Current    │ Latest  │ Up to date?  
╶───────────────┼────────────┼─────────┼─────────────╴
  This Cog      │ 1.0.2      │ 1.0.2   │ 🟢           
  Bundled Utils │ 6a06288    │ a67d909 │ 🔴           
  Red           │ 3.5.0.dev1 │ 3.4.16  │ 🟢           
                ╵            ╵         ╵

Describe the bug

As soon as you try [p]madtranslate I love food, for example, an error occurs.

If there's an error, paste it here

Exception in command 'madtranslate'
Traceback (most recent call last):
  File "/home/ubuntu/redenv/lib/python3.9/site-packages/discord/ext/commands/core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/ubuntu/.local/share/Red-DiscordBot/data/vance/cogs/CogManager/cogs/madtranslate/madtranslate.py", line 109, in madtranslate
    q = await get_translation(ctx, session, sl, tl, q)
  File "/home/ubuntu/.local/share/Red-DiscordBot/data/vance/cogs/CogManager/cogs/madtranslate/madtranslate.py", line 48, in get_translation
    return as_json["sentences"][0]["trans"]
TypeError: list indices must be integers or slices, not str

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/ubuntu/redenv/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "/home/ubuntu/redenv/lib/python3.9/site-packages/discord/ext/commands/core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "/home/ubuntu/redenv/lib/python3.9/site-packages/discord/ext/commands/core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: list indices must be integers or slices, not str