-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.py
More file actions
55 lines (41 loc) · 1.43 KB
/
bot.py
File metadata and controls
55 lines (41 loc) · 1.43 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
46
47
48
49
50
51
52
53
54
55
import commands as cm
import imports
from dotenv import load_dotenv
load_dotenv()
token = imports.os.getenv("TOKEN")
intents = imports.discord.Intents.default()
intents.message_content = True
bot = imports.discord.Client(intents=intents)
commands = []
for fun in dir(cm):
if not fun.startswith('__') and not fun.startswith('make'):
commands.append(fun)
@bot.event
async def on_ready():
print(f'Logged in as {bot.user}')
@bot.event
async def on_message(message):
if message.author == bot.user:
return
# if message.channel.id != 747178040798347393:
# return
# emote :P
loser = imports.discord.utils.get(bot.emojis, name='pepeLoser')
# message and args
msg = message.content
args = msg.split(' ')
user_id = message.author.id
# evaluate commands
if msg == '.test':
value = eval('cm.' + msg[1:] + '()')
await message.reply(file=value[0], embed=value[1])
elif len(args) > 1 and msg.startswith('.') and any(word in msg for word in commands):
value = eval('cm.' + args[0][1:] + f'({args},{user_id})')
await message.reply(embed=value)
elif msg.startswith('.') and any(word in msg for word in commands):
value = eval('cm.' + args[0][1:] + f'({user_id})')
await message.reply(embed=value)
else:
await message.reply(f"Not a real command {loser} Try .help instead {loser}")
print(f'COMMANDS LIST: {commands}')
bot.run(token)