added main
This commit is contained in:
parent
351c7ef6b5
commit
c222471302
29
main.py
Normal file
29
main.py
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
import discord
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def readToken(filePath):
|
||||||
|
with open(filePath, 'r') as f:
|
||||||
|
return f.readline()
|
||||||
|
|
||||||
|
|
||||||
|
intents = discord.Intents.default()
|
||||||
|
intents.message_content = True
|
||||||
|
token = readToken("token.token")
|
||||||
|
|
||||||
|
|
||||||
|
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(token)
|
||||||
Loading…
Reference in New Issue
Block a user