-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
42 lines (31 loc) · 1.06 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import discord
import os
from dotenv import load_dotenv #pip install python-dotenv
#Create an instance of a client
#Intents specification required apparently
intents = discord.Intents.all()
client = discord.Client(intents=intents)
# EVENT on START
@client.event
async def on_ready():
print('I have logged in as {0.user}'.format(client))
channel = client.get_channel() #Put "channel-number" in parentheses
await channel.send("I have been deployed!")
# EVENT on MESSAGE
@client.event
async def on_message(message):
if(message.author == client.user):
return
# GREET A USER
if message.content == 'hello':
await message.channel.send("Hello!")
# PRESENT THE AVAILABLE COMMANDS
if message.content == "help":
help_message = "Theses are my commands:\n"
help_message+= "------------------------\n"
help_message+= "hello: Greets you in a friendly manner\n"
help_message+= "help: Shows this message\n"
await message.channel.send("```" + help_message + "```")
# RUN the CLIENT
load_dotenv()
client.run(os.getenv["KEY1"], bot=True)