moe-serifu-circle / masabot

An automated discord bot for handling typical tasks
GNU General Public License v3.0
3 stars 5 forks source link

Translation command is broken again #18

Open dekarrin opened 5 years ago

dekarrin commented 5 years ago

!tl gives back an exception when trying to use it.

Example:

Input: !tl 全然出来ない

Expected output: the translation of the given phrase.

Actual Output:

I...I'm really sorry, but... um... I just had an exception :c

Traceback (most recent call last):
  File "/home/dekarrin/masabot/.venv/lib/python3.5/site-packages/discord/client.py", line 307, in _run_event
    yield from getattr(self, event)(*args, **kwargs)
  File "/home/dekarrin/masabot/masabot/bot.py", line 238, in on_message
    await self._handle_invocation(message)
  File "/home/dekarrin/masabot/masabot/bot.py", line 1186, in _handle_invocation
    await self._execute_action(context, handler.on_invocation(context, meta, cmd, *args), handler)
  File "/home/dekarrin/masabot/masabot/bot.py", line 1240, in _execute_action
    await action
  File "/home/dekarrin/masabot/masabot/commands/translate.py", line 98, in on_invocation
    trans = self._translator.translate(text, dest=dest)
  File "/home/dekarrin/masabot/.venv/lib/python3.5/site-packages/py_translator/client.py", line 172, in translate
    data = self._translate(text, dest, src)
  File "/home/dekarrin/masabot/.venv/lib/python3.5/site-packages/py_translator/client.py", line 75, in _translate
    token = self.token_acquirer.do(text)
  File "/home/dekarrin/masabot/.venv/lib/python3.5/site-packages/py_translator/gtoken.py", line 184, in do
    self._update()
  File "/home/dekarrin/masabot/.venv/lib/python3.5/site-packages/py_translator/gtoken.py", line 56, in _update
    self.tkk = self.RE_TKK.findall(r.text)[0]
IndexError: list index out of range