-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample_bot.py
More file actions
45 lines (34 loc) · 1.33 KB
/
example_bot.py
File metadata and controls
45 lines (34 loc) · 1.33 KB
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
43
44
45
import discord
import datetime
import config
from helper import welcomeMessage
from helper import startMessage
thumbsup = '👍'
thumbsdown = '👎'
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!')
if message.content.startswith('$create'):
x = datetime.datetime.now()
day = x.strftime("%d")
month = x.strftime("%b")
year = x.strftime("%Y")
response = await message.channel.send('who is coming for hackerspace on ' + day + " " + month + " " + year +" ?")
coming = await response.add_reaction(thumbsup)
notcoming = await response.add_reaction(thumbsdown)
@client.event
async def on_reaction_add(reaction, user):
if reaction.count > 1 and reaction.emoji == thumbsdown:
await user.send(startMessage() + user.name + "! " + welcomeMessage())
if reaction.count > 10 and reaction.emoji == thumbsup:
await message.channel.send('SHEESHHHH we got a lot of people')
client.run(config.TOKEN)