-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.py
39 lines (33 loc) · 1.16 KB
/
bot.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
import discord
from responses import handleResponses
botToken = "YOUR TOKEN"
async def sendMessage(message, userMessage):
try:
response = handleResponses(userMessage)
await message.channel.send(response)
except Exception as e:
print(e)
async def sendPicture(message, userMessage):
try:
response = handleResponses(userMessage)
await message.channel.send(file = discord.File(response +".png"))
except Exception as e:
print(e)
def runDicsordBot():
intents = discord.Intents.all()
client = discord.Client(intents=intents)
@client.event
async def on_ready():
print(f'{client.user} is now running!')
@client.event
async def on_message(message):
if message.author == client.user:
return
userMessage = str(message.content)
userName = str(message.author)
if userMessage[0:8] == "!refresh":
await sendMessage(message, userMessage)
if userMessage[0:8] == "!tracker":
await sendPicture(message, userMessage)
await message.channel.send("Here is your tracker score @" + userName)
client.run(botToken)