async def reload_all(ctx): """Tries to reload every cog and reload settings.json""" for extension in conf.extensions: try: bot.reload_extension(extension) except Exception as e: exc = '{}: {}'.format(type(e).__name__, e) print('Failed to load extension {}\n{}'.format(extension, exc)) conf = loadConfig()
def closestConnectionEmbedGenerator(system): thera = api.API() conf = loadConfig() connections = thera.allConnections(system) connections.sort(key=lambda x: x.jumps) # Sort by number of jumps # Remove any connection that is "zero jumps away" connections = [i for i in connections if i.jumps != 0] embed = generateConnectionEmbed(connections[0], conf) return embed
def __init__(self, bot): self.bot = bot self.conf = loadConfig("./settings.json")
# pylint: disable=no-member # pylint: disable=unused-variable from discord.ext import commands import discord from settingsLoader import loadConfig from os import system import traceback # Load from the config file conf = loadConfig() bot = commands.Bot(command_prefix=conf.commandPrefix) bot.remove_command("help") @bot.event async def on_ready(): print('Logged in as') print(bot.user.name) print(bot.user.id) print('------') helpCommand = f"{conf.commandPrefix}help" # Load in the command prefix await bot.change_presence(activity=discord.Game(name=helpCommand)) @bot.command() @commands.is_owner() async def load(ctx, extension_name: str): """Loads an extension."""
def __init__(self, bot): self.bot = bot self.conf = loadConfig("./settings.json") self.db = dbInterface.DB("./main.db") self.thera = api.API()
def __init__(self,bot): # Load the config and initialise an API object self.bot = bot self.conf = loadConfig("./settings.json") self.thera = api.API()