示例#1
0
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
示例#3
0
 def __init__(self, bot):
     self.bot = bot
     self.conf = loadConfig("./settings.json")
示例#4
0
# 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."""
示例#5
0
 def __init__(self, bot):
     self.bot = bot
     self.conf = loadConfig("./settings.json")
     self.db = dbInterface.DB("./main.db")
     self.thera = api.API()
示例#6
0
 def __init__(self,bot):
     # Load the config and initialise an API object
     self.bot = bot
     self.conf = loadConfig("./settings.json")
     self.thera = api.API()