Closed MyriaCore closed 6 years ago
OK so It took a few eons because of my schedule, but I glanced at the code a bit and the presupposition that any message has to come with a channel or guild is all over the codebase. Maybe I'm not following something correctly, but it seems like it'd be a harder fix than I thought. If I have time, I might try to learn discord.py and refactor it myself. If I end up making something worth using, I'll add a pull request. People more experienced than me should also work on this though at some point.
Every message does come with a channel, but in a DM it will be a DMChannel instead of a Channel, which doesn't have every attribute Channel has.
Right, I understand. IDK how I could help then, I clearly don't really know what I'm doing here 😅
It used to work perfectly fine for me until I had some issues with an unclosed client connection. I had changed my password to kick that session essentially but I still am not able to use the Bot in DMs whilst that used to work before and is still working for my friends.
@CamperGuy I get unclosed client session issues too! I thought that was normal.
So it used to work in DMs at one point?
Hold on a sec.
I just did some fiddling around, and the issue seems to be coming from the tracking functionality.
When tracking is on, I get an unclosed connector (probably unrelated but worth mentioning), and an AttributeError with this traceback:
Ignoring exception in on_message
Traceback (most recent call last):
File "C:\Users\MyriaCore\AppData\Roaming\Python\Python36\site-packages\discord\client.py", line 220, in _run_event
await coro(*args, **kwargs)
File "appuselfbot.py", line 730, in on_message
await bot.process_commands(message)
File "C:\Users\MyriaCore\AppData\Roaming\Python\Python36\site-packages\discord\ext\commands\bot.py", line 905, in process_commands
await self.invoke(ctx)
File "C:\Users\MyriaCore\AppData\Roaming\Python\Python36\site-packages\discord\ext\commands\bot.py", line 876, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\MyriaCore\AppData\Roaming\Python\Python36\site-packages\discord\ext\commands\core.py", line 499, in invoke
await self.prepare(ctx)
File "C:\Users\MyriaCore\AppData\Roaming\Python\Python36\site-packages\discord\ext\commands\core.py", line 465, in prepare
await self.call_before_hooks(ctx)
File "C:\Users\MyriaCore\AppData\Roaming\Python\Python36\site-packages\discord\ext\commands\core.py", line 433, in call_before_hooks
await hook(ctx)
File "D:\Libraries\Downloads\Discord-Selfbot-master\cogs\track.py", line 32, in register_command
async with self.bot.session.post(self.url + "/command", data={"command_name": ctx.command.name, "guild_id": str(ctx.guild.id), "guild_name": ctx.guild.name}) as resp:
AttributeError: 'NoneType' object has no attribute 'id'
When I have tracking off, all is well. No attribute error, the bot works as intended in DM's, and no unclosed connector (once again, this is probably unrelated, but I figured I'd mention it):
I can spell I promise
Ah, this makes sense. Errors in DMs do indeed happen, but the tracking functionality will make them certain. I'll push a fix to this right away.
@LyricLy I haven't tested your fix yet, but I'm sure it's fine, it seemed like a small thing. If you want, feel free to re-open this issue!
It'd be great if support for DMs was added.
Most of the problems with DMs seem to be associated with times the bot tries to get channel and guild info. I'll try my best to look into it myself and document here as needed, but as I said, I'm not super familiar with discord.py.