1
0
Fork 0
mirror of synced 2024-06-16 17:44:33 +12:00

Add patreon_link to config

This commit is contained in:
phxntxm 2017-07-11 14:35:44 -05:00
parent 368914a7c7
commit fab533c07a

View file

@ -1,101 +1,102 @@
import ruamel.yaml as yaml import ruamel.yaml as yaml
import asyncio import asyncio
import rethinkdb as r import rethinkdb as r
import pendulum import pendulum
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()
global_config = {} global_config = {}
# Ensure that the required config.yml file actually exists # Ensure that the required config.yml file actually exists
try: try:
with open("config.yml", "r") as f: with open("config.yml", "r") as f:
global_config = yaml.safe_load(f) global_config = yaml.safe_load(f)
global_config = {k: v for k, v in global_config.items() if v} global_config = {k: v for k, v in global_config.items() if v}
except FileNotFoundError: except FileNotFoundError:
print("You have no config file setup! Please use config.yml.sample to setup a valid config file") print("You have no config file setup! Please use config.yml.sample to setup a valid config file")
quit() quit()
try: try:
bot_token = global_config["bot_token"] bot_token = global_config["bot_token"]
except KeyError: except KeyError:
print("You have no bot_token saved, this is a requirement for running a bot.") print("You have no bot_token saved, this is a requirement for running a bot.")
print("Please use config.yml.sample to setup a valid config file") print("Please use config.yml.sample to setup a valid config file")
quit() quit()
# Default bot's description
# Default bot's description bot_description = global_config.get("description")
bot_description = global_config.get("description") # Bot's default prefix for commands
# Bot's default prefix for commands default_prefix = global_config.get("command_prefix", "!")
default_prefix = global_config.get("command_prefix", "!") # The key for bots.discord.pw and carbonitex
# The key for bots.discord.pw and carbonitex discord_bots_key = global_config.get('discord_bots_key', "")
discord_bots_key = global_config.get('discord_bots_key', "") carbon_key = global_config.get('carbon_key', "")
carbon_key = global_config.get('carbon_key', "") # The client ID for twitch requsets
# The client ID for twitch requsets twitch_key = global_config.get('twitch_key', "")
twitch_key = global_config.get('twitch_key', "") # The key for youtube API calls
# The key for youtube API calls youtube_key = global_config.get("youtube_key", "")
youtube_key = global_config.get("youtube_key", "") # The key for Osu API calls
# The key for Osu API calls osu_key = global_config.get('osu_key', '')
osu_key = global_config.get('osu_key', '') # The key for League of Legends API calls
# The key for League of Legends API calls lol_key = global_config.get('lol_key', '')
lol_key = global_config.get('lol_key', '') # The keys needed for deviant art calls
# The keys needed for deviant art calls # The invite link for the server made for the bot
# The invite link for the server made for the bot dev_server = global_config.get("dev_server", "")
dev_server = global_config.get("dev_server", "") # The User-Agent that we'll use for most requests
# The User-Agent that we'll use for most requests user_agent = global_config.get('user_agent', None)
user_agent = global_config.get('user_agent', None) # The URL to proxy youtube_dl's requests through
# The URL to proxy youtube_dl's requests through ytdl_proxy = global_config.get('youtube_dl_proxy', None)
ytdl_proxy = global_config.get('youtube_dl_proxy', None) # The patreon key, as well as the patreon ID to use
# The patreon key, as well as the patreon ID to use patreon_key = global_config.get('patreon_key', None)
patreon_key = global_config.get('patreon_key', None) patreon_id = global_config.get('patreon_id', None)
patreon_id = global_config.get('patreon_id', None) patreon_link = global_config.get('patreon_link', None)
# The extensions to load
extensions = [ # The extensions to load
'cogs.interaction', extensions = [
'cogs.misc', 'cogs.interaction',
'cogs.mod', 'cogs.misc',
'cogs.admin', 'cogs.mod',
'cogs.images', 'cogs.admin',
'cogs.owner', 'cogs.images',
'cogs.stats', 'cogs.owner',
'cogs.picarto', 'cogs.stats',
'cogs.overwatch', 'cogs.picarto',
'cogs.links', 'cogs.overwatch',
'cogs.roles', 'cogs.links',
'cogs.tictactoe', 'cogs.roles',
'cogs.hangman', 'cogs.events', 'cogs.raffle', 'cogs.tictactoe',
'cogs.twitch', 'cogs.hangman', 'cogs.events', 'cogs.raffle',
'cogs.blackjack', 'cogs.twitch',
'cogs.osu', 'cogs.blackjack',
'cogs.tags', 'cogs.osu',
'cogs.roulette', 'cogs.tags',
'cogs.music', 'cogs.roulette',
'cogs.polls', 'cogs.music',
'cogs.playlist', 'cogs.polls',
'cogs.dj' 'cogs.playlist',
] 'cogs.dj'
]
# The default status the bot will use
default_status = global_config.get("default_status", None) # The default status the bot will use
# The rethinkdb hostname default_status = global_config.get("default_status", None)
db_host = global_config.get('db_host', 'localhost') # The rethinkdb hostname
# The rethinkdb database name db_host = global_config.get('db_host', 'localhost')
db_name = global_config.get('db_name', 'Discord_Bot') # The rethinkdb database name
# The rethinkdb certification db_name = global_config.get('db_name', 'Discord_Bot')
db_cert = global_config.get('db_cert', '') # The rethinkdb certification
# The rethinkdb port db_cert = global_config.get('db_cert', '')
db_port = global_config.get('db_port', 28015) # The rethinkdb port
# The user and password assigned db_port = global_config.get('db_port', 28015)
db_user = global_config.get('db_user', 'admin') # The user and password assigned
db_pass = global_config.get('db_pass', '') db_user = global_config.get('db_user', 'admin')
# We've set all the options we need to be able to connect db_pass = global_config.get('db_pass', '')
# so create a dictionary that we can use to unload to connect # We've set all the options we need to be able to connect
# db_opts = {'host': db_host, 'db': db_name, 'port': db_port, 'ssl': # so create a dictionary that we can use to unload to connect
# {'ca_certs': db_cert}, 'user': db_user, 'password': db_pass} # db_opts = {'host': db_host, 'db': db_name, 'port': db_port, 'ssl':
db_opts = {'host': db_host, 'db': db_name, 'port': db_port, 'user': db_user, 'password': db_pass} # {'ca_certs': db_cert}, 'user': db_user, 'password': db_pass}
db_opts = {'host': db_host, 'db': db_name, 'port': db_port, 'user': db_user, 'password': db_pass}
def command_prefix(bot, message):
if not message.guild: def command_prefix(bot, message):
return default_prefix if not message.guild:
return bot.db.load('server_settings', key=message.guild.id, pluck='prefix') or default_prefix return default_prefix
return bot.db.load('server_settings', key=message.guild.id, pluck='prefix') or default_prefix