-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
46 lines (40 loc) · 1.11 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
43
44
45
46
import os
import discord
import random
from keep_alive import keep_alive
keep_alive()
TOKEN = os.environ['BOT_TOKEN']
client = discord.Client()
random.seed(5)
limit = random.randint(1, 60)
counter = 0
list_msg = []
@client.event
async def on_ready():
print(f'{client.user} has connected to Discord!')
@client.event
async def on_message(message):
global limit
global counter
global list_msg
if message.author == client.user:
return
if message.channel.id != int(os.environ['DISCORD_CHANNEL_A']) and message.channel.id != int(os.environ['DISCORD_CHANNEL_B']) and message.channel.id != int(os.environ['DISCORD_CHANNEL_C']):
return
counter = counter + 1
list_msg.append(message.content)
if counter >= limit:
if counter % 2 == 0:
await message.channel.send('SIUUUUUU')
else:
await message.channel.send(random.choice(list_msg))
counter = 0
list_msg.clear()
limit = random.randint(1, 60)
print("SIUUU")
return
rate = random.randint(1,100)
print(rate)
if (rate > 95):
await message.channel.send(file=discord.File('ronaldo-drinking.jpg'))
client.run(TOKEN)