plon / Bard-Discord-bot

Integrate Google Bard into your own discord chatbot
GNU General Public License v2.0
36 stars 14 forks source link

RuntimeWarning: coroutine 'AsyncChatbot.create' was never awaited #17

Closed tjf1dev closed 1 year ago

tjf1dev commented 1 year ago

Im using the library GoogleBard (implementing bard to my bot as a cog) and i got this error:


  File "/home/tjf1/.local/lib/python3.10/site-packages/discord/ext/commands/core.py", line 235, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/tjf1/xyzai/xyz.ai/main/cogs/ai.py", line 16, in ask
    response = await Chatbot(BARD_TOKEN).ask(prompt)
  File "/home/tjf1/.local/lib/python3.10/site-packages/Bard.py", line 63, in __init__
    self.async_chatbot = self.loop.run_until_complete(
  File "/usr/lib/python3.10/asyncio/base_events.py", line 622, in run_until_complete
    self._check_running()
  File "/usr/lib/python3.10/asyncio/base_events.py", line 582, in _check_running
    raise RuntimeError('This event loop is already running')
RuntimeError: This event loop is already running

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

Traceback (most recent call last):
  File "/home/tjf1/.local/lib/python3.10/site-packages/discord/ext/commands/bot.py", line 1350, in invoke
    await ctx.command.invoke(ctx)
  File "/home/tjf1/.local/lib/python3.10/site-packages/discord/ext/commands/core.py", line 1029, in invoke
    await injected(*ctx.args, **ctx.kwargs)  # type: ignore
  File "/home/tjf1/.local/lib/python3.10/site-packages/discord/ext/commands/core.py", line 244, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: RuntimeError: This event loop is already running```
plon commented 1 year ago

Fixed