dolfies / discord.py-self

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

Slash commands in Direct Message Channels with a bot. #647

Closed l-404-l closed 5 months ago

l-404-l commented 5 months ago

Summary

Unable to get global slash commands from bot dm channel

Reproduction Steps

Call channel.slash_commands() in a DM channel

Code

import discord

class MyClient(discord.Client):

    def __init__(self):
        super().__init__(chunk_guilds_at_startup=False, max_messages=1)

    async def on_ready(self):
        print(f'Logged in as {self.user} (ID: {self.user.id})')
        print('------')

        channel = self.get_channel(DM_ID)  # DM Channel ID
        async for cmd in channel.slash_commands(): # Returns no slash commands ATM
            print(cmd)

        channel = self.get_channel(GUILD_ID)  # Guild Channel ID
        async for cmd in channel.slash_commands():
            print(cmd)

client = MyClient()
client.run('token')

Expected Results

It to return all global commands from the bot.

Actual Results

Returns just the application with no commands.

System Information

Checklist

Additional Information

Already made a pull request that fixes this bug. Maybe there is a better way of doing so but already tested and works the way its supposed to. https://github.com/dolfies/discord.py-self/pull/644

dolfies commented 5 months ago

Should be fixed!