1
0
Fork 0
mirror of synced 2024-04-29 10:12:29 +12:00

Somehow carriage returns got set

This commit is contained in:
Dan Hess 2021-03-25 16:03:35 -08:00
parent 7b59155fe6
commit cdccc2b85e

View file

@ -1,115 +1,116 @@
import yaml import yaml
import asyncio import asyncio
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( print(
"You have no config file setup! Please use config.yml.sample to setup a valid config file" "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 bot sites (discord bots and discordbots are TWO DIFFERENT THINGS) # The key for bot sites (discord bots and discordbots are TWO DIFFERENT THINGS)
discord_bots_key = global_config.get("discord_bots_key", "") discord_bots_key = global_config.get("discord_bots_key", "")
discordbots_key = global_config.get("discordbots_key", "") discordbots_key = global_config.get("discordbots_key", "")
carbon_key = global_config.get("carbon_key", "") carbon_key = global_config.get("carbon_key", "")
# The client ID for twitch requests # The client ID for twitch requests
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 e621 calls # The key for e621 calls
e621_key = global_config.get("e621_key", "") e621_key = global_config.get("e621_key", "")
# The username the API key is under # The username the API key is under
e621_user = global_config.get("e621_user", "") e621_user = global_config.get("e621_user", "")
# 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) patreon_link = global_config.get("patreon_link", None)
# The client ID/secret for spotify # The client ID/secret for spotify
spotify_id = global_config.get("spotify_id", None) spotify_id = global_config.get("spotify_id", None)
spotify_secret = global_config.get("spotify_secret", None) spotify_secret = global_config.get("spotify_secret", None)
# Error channel to send uncaught exceptions to # Error channel to send uncaught exceptions to
error_channel = global_config.get("error_channel", None) error_channel = global_config.get("error_channel", None)
# The extensions to load # The extensions to load
extensions = [ extensions = [
"cogs.interaction", "cogs.interaction",
"cogs.misc", "cogs.misc",
"cogs.mod", "cogs.mod",
"cogs.admin", "cogs.admin",
"cogs.config", "cogs.config",
"cogs.images", "cogs.images",
"cogs.birthday", "cogs.birthday",
"cogs.owner", "cogs.owner",
"cogs.stats", "cogs.stats",
"cogs.picarto", "cogs.picarto",
"cogs.links", "cogs.links",
"cogs.roles", "cogs.roles",
"cogs.tictactoe", "cogs.tictactoe",
"cogs.hangman", "cogs.hangman",
"cogs.events", "cogs.events",
"cogs.raffle", "cogs.raffle",
"cogs.blackjack", "cogs.blackjack",
"cogs.osu", "cogs.osu",
"cogs.tags", "cogs.tags",
"cogs.roulette", "cogs.roulette",
"cogs.spotify", "cogs.spotify",
"cogs.polls", "cogs.polls",
"cogs.games", "cogs.games",
] "cogs.japanese",
]
# The default status the bot will use
default_status = global_config.get("default_status", None) # The default status the bot will use
# The database hostname default_status = global_config.get("default_status", None)
db_host = global_config.get("db_host", None) # The database hostname
# The database name db_host = global_config.get("db_host", None)
db_name = global_config.get("db_name", "bonfire") # The database name
# The database port db_name = global_config.get("db_name", "bonfire")
db_port = global_config.get("db_port", None) # The database port
# The user and password assigned db_port = global_config.get("db_port", None)
db_user = global_config.get("db_user", None) # The user and password assigned
db_pass = global_config.get("db_pass", None) db_user = global_config.get("db_user", None)
# We've set all the options we need to be able to connect db_pass = global_config.get("db_pass", None)
# 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 = { # so create a dictionary that we can use to unload to connect
"host": db_host, db_opts = {
"database": db_name, "host": db_host,
"port": db_port, "database": db_name,
"user": db_user, "port": db_port,
"password": db_pass, "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.cache.prefixes.get(message.guild.id) or default_prefix return default_prefix
return bot.cache.prefixes.get(message.guild.id) or default_prefix