I need to get all channels to make a bunker command, which makes all channels read only.
相关问题
- pick a random item from a javascript array
- Get a picture from the message
- Using find_all in BS4 to get text as a list
- Discord.py SSLCertVerificationError
- Discord Bot - "Attribute Error: 'NoneType'
相关文章
- go tutorial select statement
- Guild is not defined
- Line separator/break in discord embded
- Understanding netty channel buffers and watermarks
- Return emoji name instead of emoji
- How to send a message with discord.py without a co
- Discord.js How to check if the user does not accep
- DeprecationWarning: Collection#find: pass a functi
Assuming you are using the async branch, the
Client
class containsservers
, which returns a list ofServer
classes that the bot is connected to. Documentation here: http://discordpy.readthedocs.io/en/latest/api.html#discord.Client.serversIterating over this list, each
Server
class containschannels
, which returns a list ofChannel
classes that the server has. Documentation here: http://discordpy.readthedocs.io/en/latest/api.html#discord.Server.channelsFinally, iterating over this list, you can check each
Channel
class for different properties. For example, if you want to check that the channel is text, you would usechannel.type
. Documentation here: http://discordpy.readthedocs.io/en/latest/api.html#discord.ChannelA rough example of how you can make a list of all
Channel
objects with type 'Text':They changed Client.servers to Client.guilds in new version of discord.py.
You can also use bot instead of Client. And guild.text_channels to get all text channels.
For all channels you can use bot.get_all_channels()