discord py get channel code example

Example 1: on message discord py

@bot.event
async def on_message(message):
    if message.content == "pong":
        await message.channel.send('ping')

Example 2: discord.py get channel id by channel name

channel = discord.utils.get(server.channels, name="Channel_name_here", type="ChannelType.voice")

Example 3: discord.py get channel id by channel name

channel_names = ['channel1', 'channel2', 'channel3']
for ch in channel_names:
    channel = discord.get.utils(server.channels, name=ch, type="ChannelType.voice")
    full(channel)

Tags:

Misc Example