appu1232 / Discord-Selfbot

Discord selfbot made with Python using discord.py
GNU General Public License v3.0
510 stars 603 forks source link

Commands do not work #366

Closed SgtTheDarknezz closed 6 years ago

SgtTheDarknezz commented 6 years ago

When attempting to execute the google search command, my bot greets me with this error message in the console, similar commands also spark similar replies, such as ud, youtube.

Ignoring exception in command g Traceback (most recent call last): File "/home/darkness/.local/lib/python3.5/site-packages/discord/ext/commands/core.py", line 60, in wrapped ret = await coro(*args, **kwargs) File "/home/darkness/self-bot/cogs/google.py", line 159, in g entries, root = await get_google_entries(query, session=self.bot.session) File "/home/darkness/self-bot/cogs/utils/checks.py", line 180, in get_google_entries return None, result['items'][0]['link'] KeyError: 'items'

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

Traceback (most recent call last): File "/home/darkness/.local/lib/python3.5/site-packages/discord/ext/commands/bot.py", line 876, in invoke await ctx.command.invoke(ctx) File "/home/darkness/.local/lib/python3.5/site-packages/discord/ext/commands/core.py", line 506, in invoke await injected(*ctx.args, **ctx.kwargs) File "/home/darkness/.local/lib/python3.5/site-packages/discord/ext/commands/core.py", line 69, in wrapped raise CommandInvokeError(e) from e discord.ext.commands.errors.CommandInvokeError: Command raised an exception: KeyError: 'items'

^CTraceback (most recent call last): File "loopself.py", line 18, in subprocess.call(params) File "/usr/local/lib/python3.5/subprocess.py", line 249, in call return p.wait(timeout=timeout) File "/usr/local/lib/python3.5/subprocess.py", line 1389, in wait (pid, sts) = self._try_wait(0) File "/usr/local/lib/python3.5/subprocess.py", line 1339, in _try_wait (pid, sts) = os.waitpid(self.pid, wait_flags) KeyboardInterrupt Shutting down

appu1232 commented 6 years ago

This happens when Google has blocked web scrapping google searches for your IP. The only way to get around it is the backup method of using the Google API key which the bot will default to for web searches if you set it up.

SgtTheDarknezz commented 6 years ago

So I've set up an API key, I am giving it time, will test and update if this fixes the issue.

EDIT:

Google API searches are working now, however urban dictionary queries still do not work.

Ignoring exception in command ud Traceback (most recent call last): File "/home/darkness/.local/lib/python3.5/site-packages/discord/ext/commands/core.py", line 60, in wrapped ret = await coro(*args, **kwargs) File "/home/darkness/self-bot/cogs/utility.py", line 485, in ud if result["result_type"] == "no_results": KeyError: 'result_type'

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

Traceback (most recent call last): File "/home/darkness/.local/lib/python3.5/site-packages/discord/ext/commands/bot.py", line 876, in invoke await ctx.command.invoke(ctx) File "/home/darkness/.local/lib/python3.5/site-packages/discord/ext/commands/core.py", line 506, in invoke await injected(*ctx.args, **ctx.kwargs) File "/home/darkness/.local/lib/python3.5/site-packages/discord/ext/commands/core.py", line 69, in wrapped raise CommandInvokeError(e) from e discord.ext.commands.errors.CommandInvokeError: Command raised an exception: KeyError: 'result_type'

appu1232 commented 6 years ago

Seems like urban dictionary's response object has changed. I've made the fix in the dev branch. Will push to master sometime later today.

appu1232 commented 6 years ago

Should be fixed now, sorry about the late merge.