discord.py discord.channel code example

Example 1: python discord

import discord

class MyClient(discord.Client):
    async def on_ready(self):
        print('Logged on as', self.user)

    async def on_message(self, message):
        # don't respond to ourselves
        if message.author == self.user:
            return

        if message.content == 'ping':
            await message.channel.send('pong')

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

Example 2: discord py server.channels

# Returns a list of all channels from all guilds( as channel IDs )

bot.get_all_channels()

Tags:

Misc Example