Ejemplo n.º 1
0

with open('token.txt', 'r') as token:
    TOKEN = token.read().rstrip()

BOT_PREFIX = '>'
COG_FILE = "COGS.txt"

bot = Bot(command_prefix=BOT_PREFIX)

with open("COGS.txt", "r") as cogs:
    bot.all_cogs = [i.rstrip() for i in cogs.readlines()]

bot.COG_FILE = COG_FILE
bot.TOKEN = TOKEN
bot.BOT_PREFIX = '>'
bot.current_invite = None
bot.loaded_cogs, bot.unloaded_cogs = [], []


@bot.event
async def on_ready():

    for i in bot.all_cogs:
        if i not in bot.loaded_cogs:
            bot.load_extension(i)
            bot.loaded_cogs.append(i)

    game = discord.Game("Blightfall")
    await bot.change_presence(status=discord.Status.online, activity=game)
Ejemplo n.º 2
0
    else:
        BOT_PREFIX = (".", "!")
        EXTENSIONS = [filename[:len(filename) - 3] for filename in os.listdir(COGS_FOLDER + "/FF-Bots") if
                      filename[0] != '_']  # We cut the '.py' from every filename,and don't take scripts starting w/ '_'
        COGS_FOLDER = COGS_FOLDER+'.FF-Bots.'

    ###################################################################################################################
    #                        Initializing bot and setting up our 'globals' (between cogs)                             #
    ###################################################################################################################

    # We initialize the bot object as 'client'.
    client = Bot(command_prefix=BOT_PREFIX)

    # Setting up global variables (accessible to all cogs/extensions)
    client.BOT_PREFIX = BOT_PREFIX
    client.COGS_FOLDER = COGS_FOLDER
    client.CURRENT_BOT = token_name
    client.EXTENSIONS = EXTENSIONS

    ###################################################################################################################
    #                             Setting up event handlers (common to all bots)                                      #
    ###################################################################################################################

    # Event handler for boot-up
    @client.event
    async def on_ready():
        if not hasattr(client, 'AppInfo'):
            client.AppInfo = await client.application_info()
        print("---------------------------------------------------------------")
        print("Bot logged in as >>> {0.name} <<< (id : {0.id})".format(client.user))