2020-12-20 03:14:45 +00:00
|
|
|
import discord, json, os
|
2020-12-20 00:08:09 +00:00
|
|
|
import database as db
|
2020-12-20 01:26:05 +00:00
|
|
|
import onomancer as ono
|
2020-12-20 00:08:09 +00:00
|
|
|
|
|
|
|
client = discord.Client()
|
|
|
|
|
|
|
|
def config():
|
|
|
|
if not os.path.exists("config.json"):
|
|
|
|
#generate default config
|
|
|
|
config_dic = {
|
|
|
|
"token" : "",
|
|
|
|
"owners" : [
|
|
|
|
0000
|
2020-12-20 01:26:05 +00:00
|
|
|
],
|
|
|
|
"prefix" : ["m;", "m!"],
|
|
|
|
"soulscream channel id" : 0
|
2020-12-20 00:08:09 +00:00
|
|
|
}
|
|
|
|
with open("config.json", "w") as config_file:
|
|
|
|
json.dump(config_dic, config_file, indent=4)
|
|
|
|
print("please fill in bot token and any bot admin discord ids to the new config.json file!")
|
|
|
|
quit()
|
|
|
|
else:
|
|
|
|
with open("config.json") as config_file:
|
|
|
|
return json.load(config_file)
|
|
|
|
|
|
|
|
@client.event
|
|
|
|
async def on_ready():
|
2020-12-20 03:14:45 +00:00
|
|
|
db.initialcheck()
|
2020-12-20 00:08:09 +00:00
|
|
|
print(f"logged in as {client.user} with token {config()['token']}")
|
|
|
|
|
|
|
|
@client.event
|
|
|
|
async def on_message(msg):
|
2020-12-20 05:13:23 +00:00
|
|
|
command_b = False
|
2020-12-20 01:26:05 +00:00
|
|
|
for prefix in config()["prefix"]:
|
|
|
|
if msg.content.startswith(prefix):
|
2020-12-20 05:13:23 +00:00
|
|
|
command_b = True
|
|
|
|
command = msg.content.split(prefix, 1)[1]
|
|
|
|
if not command_b:
|
2020-12-20 01:26:05 +00:00
|
|
|
return
|
|
|
|
|
2020-12-20 05:13:23 +00:00
|
|
|
if msg.author.id in config()["owners"] and command == "introduce":
|
|
|
|
await introduce(msg.channel)
|
|
|
|
|
|
|
|
elif msg.channel.id == config()["soulscream channel id"]:
|
|
|
|
try:
|
|
|
|
await msg.channel.send(ono.get_stats(msg.author.nick))
|
2020-12-20 06:31:48 +00:00
|
|
|
except TypeError or AttributeError:
|
2020-12-20 05:13:23 +00:00
|
|
|
await msg.channel.send(ono.get_stats(msg.author.name))
|
|
|
|
|
2020-12-20 05:17:05 +00:00
|
|
|
elif command == "credit":
|
|
|
|
await msg.channel.send("Our avatar was graciously provided to us, with permission, by @HetreaSky on Twitter.")
|
2020-12-20 05:13:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
async def introduce(channel):
|
|
|
|
text = """**Your name, favorite team, and pronouns**: Matteo Prestige, CHST, they/them ***only.*** There's more than one of us up here, after all.
|
|
|
|
**What are you majoring in (wrong answers only)**: Economics.
|
2020-12-20 05:17:05 +00:00
|
|
|
**Your favorite and least favorite beverage, without specifying which**: Vanilla milkshakes, chocolate milkshakes.
|
2020-12-20 05:13:23 +00:00
|
|
|
**Favorite non-Mild Low team**: The Mills. We hope they're treating Ren alright.
|
|
|
|
**If you were a current blaseball player, who would you be**: We refuse to answer this question.
|
|
|
|
**Your hobbies/interests**: Minigolf, blaseball, felony insider trading.
|
2020-12-20 05:17:05 +00:00
|
|
|
Our avatar was graciously provided to us, with permission, by @HetreaSky on Twitter.
|
2020-12-20 05:13:23 +00:00
|
|
|
"""
|
|
|
|
await channel.send(text)
|
2020-12-20 00:08:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
client.run(config()["token"])
|