Basic bot start from discordpy guide
This commit is contained in:
parent
c83336e17d
commit
a58a93659c
2 changed files with 30 additions and 0 deletions
|
@ -0,0 +1,8 @@
|
||||||
|
|
||||||
|
|
||||||
|
# Matchy
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
* python3
|
||||||
|
* discord.py python module
|
22
matchy.py
Normal file
22
matchy.py
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
# This example requires the 'message_content' intent.
|
||||||
|
|
||||||
|
import discord
|
||||||
|
|
||||||
|
intents = discord.Intents.default()
|
||||||
|
intents.message_content = True
|
||||||
|
|
||||||
|
client = discord.Client(intents=intents)
|
||||||
|
|
||||||
|
@client.event
|
||||||
|
async def on_ready():
|
||||||
|
print(f'We have logged in as {client.user}')
|
||||||
|
|
||||||
|
@client.event
|
||||||
|
async def on_message(message):
|
||||||
|
if message.author == client.user:
|
||||||
|
return
|
||||||
|
|
||||||
|
if message.content.startswith('$hello'):
|
||||||
|
await message.channel.send('Hello!')
|
||||||
|
|
||||||
|
client.run('your token here')
|
Loading…
Add table
Reference in a new issue