-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
42 lines (37 loc) · 1.13 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
import os
import discord
import asyncio
from datetime import datetime
from src.split import split_args
from src.addCommand import handleMessageForAddingUser
from dotenv import load_dotenv
import sys
load_dotenv('config/.env')
token = os.getenv('TOKEN')
client = discord.Client()
@client.event
async def on_ready():
print("Bot is ready !")
await client.change_presence(activity=discord.Activity(type=discord.ActivityType.listening, name="&el help"))
async def handleMessageCommand(message):
argv = message.content.split()
if len(argv) == 0:
return False
if argv[0] == '&el':
message.content = ' '.join(argv)
await split_args(message, argv, client)
return True
return False
@client.event
async def on_message(message):
if (message.channel.name == 'elyon_bot'):
if await handleMessageForAddingUser(message):
#print('handled as adding user')
x=0
elif await handleMessageCommand(message):
#print ('handle as command')
x=0
#a delete :
#else:
# print('fuck that ' + str(message.author))
client.run(token)