-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommands.py
45 lines (35 loc) · 1.25 KB
/
commands.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
#!/bin/python3 -u
import discord
import os
from dotenv import load_dotenv
from discord.ext import commands
load_dotenv()
client = commands.Bot(command_prefix='!')
@client.event
async def on_ready():
print('!commands started on bot {0.user}'.format(client))
@client.event
async def on_message(message):
if message.channel.id == int(os.getenv('channel')):
return
content = message.content
if content.lower() == "!commands":
if message.author == client.user:
if message.channel.id == int(os.getenv('botchan')):
cc_chan = client.get_channel(int(os.getenv('channel')))
cmd_cfg = open("ccbot_commands.cfg", "r")
cmdlist = "Prefix !: "
for cmd in cmd_cfg:
cmdlist = str(cmdlist + cmd.strip() + ", ")
cmd_cfg.close()
await cc_chan.send(str("*" + cmdlist))
else:
cmd_cfg = open("disc_commands.cfg", "r")
cmdlist = ""
for cmd in cmd_cfg:
cmdlist = str(cmdlist + "!" + cmd.strip() + ", ")
cmd_cfg.close()
await message.channel.send(cmdlist)
else:
return
client.run(os.getenv('TOKEN'))