aboutsummaryrefslogtreecommitdiff
path: root/examples/reply.py
blob: b35ac669a3f36f09f4c98c705a1198942833adff (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import discord

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

    async def on_message(self, message):
        # we do not want the bot to reply to itself
        if message.author.id == self.user.id:
            return

        if message.content.startswith('!hello'):
            await message.reply('Hello!', mention_author=True)

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