-
Notifications
You must be signed in to change notification settings - Fork 0
/
info.py
45 lines (37 loc) · 1.24 KB
/
info.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('!info 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() == "!info":
if message.author == client.user:
if message.channel.id == int(os.getenv('botchan')):
try:
info_file = open("info_cc.msg", "r")
info_msg = info_file.read()
info_file.close()
except:
info_msg = "No info message is set"
cc_chan = client.get_channel(int(os.getenv('channel')))
await cc_chan.send(str('*' + info_msg))
else:
try:
info_file = open("info_disc.msg", "r")
info_msg = info_file.read()
info_file.close()
except:
info_msg = "No info message is set"
await message.channel.send(str(info_msg))
else:
return
client.run(os.getenv('TOKEN'))