dolfies / discord.py-self

A fork of the popular discord.py for user accounts.
https://discordpy-self.rtfd.io/en/latest/
MIT License
683 stars 162 forks source link

`jishaku` can't send messages in a dm #277

Closed LEv145 closed 2 years ago

LEv145 commented 2 years ago

Summary

The problem of incompatibility

Reproduction Steps

...
bot.load_extension("jishaku")
...

Code

No response

Expected Results

Sending a message to a dm, as implemented in discord.py 1.7.3

Actual Results

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/discord/ext/commands/core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/jishaku/cog_base.py", line 510, in jsk_python
    async with ReplResponseReactor(ctx.message):
  File "/usr/local/lib/python3.10/site-packages/jishaku/exception_handling.py", line 141, in __aexit__
    await send_traceback(
  File "/usr/local/lib/python3.10/site-packages/jishaku/exception_handling.py", line 48, in send_traceback
    message = await destination.send(page)
  File "/usr/local/lib/python3.10/site-packages/discord/abc.py", line 1009, in send
    channel = await self._get_channel()
  File "/usr/local/lib/python3.10/site-packages/discord/member.py", line 304, in _get_channel
    ch = await self.create_dm()
  File "/usr/local/lib/python3.10/site-packages/discord/member.py", line 142, in general
    return await getattr(self._user, x)(*args, **kwargs)
AttributeError: 'ClientUser' object has no attribute 'create_dm'

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

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/discord/ext/commands/bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "/usr/local/lib/python3.10/site-packages/discord/ext/commands/core.py", line 1348, in invoke
    await ctx.invoked_subcommand.invoke(ctx)
  File "/usr/local/lib/python3.10/site-packages/discord/ext/commands/core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "/usr/local/lib/python3.10/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: AttributeError: 'ClientUser' object has no attribute 'create_dm'

System Information

jishaku = "2.0.0" "discord.py-self" = "1.9.2"

Checklist

Additional Information

jishaku should send messages to a dm, but this functionality is incompatible

LEv145 commented 2 years ago
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/jishaku/features/shell.py", line 40, in jsk_shell
    with ShellReader(argument.content, escape_ansi=not Flags.use_ansi(ctx)) as reader:
  File "/usr/local/lib/python3.10/site-packages/jishaku/flags.py", line 191, in use_ansi
    return not ctx.author.is_on_mobile() if ctx.guild and ctx.bot.intents.presences else True
AttributeError: 'Bot' object has no attribute 'intents'
dolfies commented 2 years ago
  1. You can't DM yourself.
  2. Intents aren't a thing for user accounts.
  3. This isn't a library issue. I can't guarantee support for third-party modules that rely on bot features such as intents.
LEv145 commented 2 years ago

@dolfies I thought that supporting third-party libraries(Maintaining compatibility) was one of tasks of this fork Okay, I'll just use discord.py 1.7.3 Thx

dolfies commented 2 years ago

It is, but I can't maintain compatibility with strictly bot stuff.