-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
38 lines (32 loc) · 1.42 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
from settings import settings
import discord
# import * - è un modo rapido per importare tutti i file della libreria.
from bot_logic import *
# La variabile intents memorizza i privilegi del bot
intents = discord.Intents.default()
# Abilitazione del privilegio di lettura dei messaggi
intents.message_content = True
# Creare un bot nella variabile client e trasferirgli i privilegi
client = discord.Client(intents=intents)
# Una volta che il bot è pronto, stamperà il suo nome!
@client.event
async def on_ready():
print(f'Przeprowadziliśmy dostęp jako' {client.user}')
# Qua0ndo il bot riceve un messaggio, invia messaggi nello stesso canale!
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith('$hello'):
await message.channel.send('Elo! Jestem robotem!')
elif message.content.startswith('$smile'):
await message.channel.send(gen_emodji())
elif message.content.startswith('$coin'):
await message.channel.send(flip_coin())
elif message.content.startswith('$pass'):
await message.channel.send(gen_pass(10))
elif message.content.startswith('c'):
await message.channel.send(ekologic_answers())
else:
await message.channel.send("Nie ma takiej komendy! OwO")
client.run(settings["MTA2NzQ3ODUwODM0NDk4MzYzNQ.GGzdoO.uy15H-sV_glrs44-DtFhihN2ypN_Ljo9FpUuVk"])