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

TextChannel has no attribute 'slash_commands' #356

Closed oliverstech closed 2 years ago

oliverstech commented 2 years ago

Summary

Trying to get slash commands of channel as per guide says but this error is thrown

Reproduction Steps

Tried to use the tutorial code:

async for command in channel.slash_commands():
    print(command.name)

Code

import discord

class MyClient(discord.Client):
    async def on_ready(self):
        print('Logged on as', self.user)
        channel = client.get_channel(6969696969699696969)
        async for command in channel.slash_commands():
            print(command.name)

client = MyClient()
client.run('no token for you trololol')

Expected Results

Shows all slash commands for channel

Actual Results

I get the error

Logged on as [user]
Ignoring exception in on_ready
Traceback (most recent call last):
  File "C:\Users\Oliver\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 301, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\Oliver\Desktop\bot.py", line 7, in on_ready
    async for command in channel.slash_commands():
AttributeError: 'TextChannel' object has no attribute 'slash_commands'

System Information

C:\Windows\system32>python -m discord -v
- Python v3.10.6-final
- discord.py-self v1.9.2-final
- aiohttp v3.7.4.post0
- system info: Windows 10 10.0.19044

Checklist

Additional Information

No response

JU5TDIE commented 2 years ago

Update your discord.py-self to alpha version. pip install git+https://github.com/dolfies/discord.py-self.git

oliverstech commented 2 years ago

Update your discord.py-self to alpha version. pip install git+https://github.com/dolfies/discord.py-self.git

I tried this but this broke the bot from logging in entirely

JU5TDIE commented 2 years ago

Could you share the entire traceback?

dolfies commented 2 years ago

Update your discord.py-self to alpha version. pip install git+https://github.com/dolfies/discord.py-self.git

I tried this but this broke the bot from logging in entirely

The alpha has breaking changes.