-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathIris.py
executable file
·96 lines (66 loc) · 2.01 KB
/
Iris.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
"""
Name: Iris
Objective: A discord bot for administrative purposes
Date: 2019-Jul-06
Author: IceCereal
"""
import discord
from discord.ext import commands
from asyncio import sleep
from argparse import ArgumentParser
from pathlib import Path
import os
corePath = Path("core")
resPath = Path("res")
utilsPath = Path("utils")
parser = ArgumentParser()
parser.add_argument('-v', "--verbose", required=False, help="Run Iris.py with verbosity")
args = parser.parse_args()
if args.verbose == "True":
args.verbose = True
else:
args.verbose = None
if args.verbose:
print ("Reading Token...")
with open(resPath / "TOKEN", 'r') as TokenObj:
TOKEN = TokenObj.read()
BOT_PREFIX = ('++', 'i+', '+')
bot = commands.Bot(command_prefix=BOT_PREFIX)
# Set args to bot
bot.verbose = args.verbose
@bot.command(
name="yoo",
alias=["hello", "sup"]
)
async def yoo(ctx):
await ctx.channel.send("What's up" + ctx.message.author.mention+ "? How you hanging?")
@bot.event
async def on_ready():
print ("\nLogged in as:\t" + str(bot.user))
print ("-----------------")
await bot.change_presence(activity=discord.Game(name="The Game of Life"))
if __name__ == '__main__':
# Load Extensions
cogs_dir = corePath / "cogs"
cogs_list = []
for root, directories, files in os.walk(cogs_dir):
for fileName in files:
if '-cog' in fileName.lower() and fileName.endswith('.py'):
cogs_list.append(str(os.path.join(root, fileName )))
updated_cogs_list = []
for cog in cogs_list:
cog_new = str(cog)
# Windows
cog_new = cog_new.replace('\\', '.')
# Linux/Mac
cog_new = cog_new.replace('/', '.')
cog_new = cog_new.replace(".py", "")
updated_cogs_list.append(cog_new)
cogs_list = updated_cogs_list
for cog in cogs_list:
print ("Loading Cog from Iris:\t", cog)
bot.load_extension(cog)
# RUN THE BOT
bot.run(TOKEN)
# Nothing should come after this. It will not be processed
# This comment won't even be encountered, r/funnyandsad :/