async def on_ready(): print("Logged in as:\n{}/{}#{}\n----------".format(bot.user.id, bot.user.name, bot.user.discriminator)) print("Bot version: {}\nAuthor(s): {}\nCode name: {}\nBuild date: {}".format(BUILD_VERSION, BUILD_AUTHORS, BUILD_CODENAME, BUILD_DATE)) log.debug("Debugging enabled!") await set_default_status() for extension in extensions: try: bot.load_extension(extension) except Exception as e: log.error("Failed to load extension {}\n{}: {}".format(extension, type(e).__name__, e)) if config.enableMal: try: bot.load_extension("commands.myanimelist") log.info("The MyAnimeList module has been enabled!") except Exception as e: log.error("Failed to load the MyAnimeList module\n{}: {}".format(type(e).__name__, e)) if config.enableOsu: log.info("The osu! module has been enabled in the config!") if config._dbots_token: log.info("Updating DBots Statistics...") r = requests.post("https://bots.discord.pw/api/bots/{}/stats".format(bot.user.id), json={"server_count":len(bot.servers)}, headers={"Authorization":config._dbots_token}) if r.status_code == "200": log.info("Discord Bots Server count updated.") elif r.status_code == "401": log.error("An error occurred while trying to update the server count!") load_opus_lib()
async def on_ready(): print("\n") print("Logged in as:\n{}/{}#{}\n----------".format(bot.user.id, bot.user.name, bot.user.discriminator)) print( "Bot version: {}\nAuthor(s): {}\nCode name: {}\nBuild date: {}".format( BUILD_VERSION, BUILD_AUTHORS, BUILD_CODENAME, BUILD_DATE)) log.debug("Debugging enabled!") await set_default_status() for extension in extensions: try: bot.load_extension(extension) except Exception as e: log.error("Failed to load extension {}\n{}: {}".format( extension, type(e).__name__, e)) if config.enableMal: try: bot.load_extension("commands.myanimelist") log.info("The MyAnimeList module has been enabled!") except Exception as e: log.error("Failed to load the MyAnimeList module\n{}: {}".format( type(e).__name__, e)) if config.enableOsu: log.info("The osu! module has been enabled in the config!") if config._dbots_token: log.info("Updating DBots Statistics...") r = requests.post("https://bots.discord.pw/api/bots/{}/stats".format( bot.user.id), json={ "shard_id": shard_id, "shard_count": shard_count, "server_count": len(bot.servers) }, headers={"Authorization": config._dbots_token}) if r.status_code == 200: log.info("Discord Bots Server count updated.") elif r.status_code == 401: log.error("Woah, unauthorized?") if os.path.isdir("data/music"): try: bot.cogs["Music"].clear_cache() log.info("The music cache has been cleared!") except: log.warning("Failed to clear the music cache!") load_opus_lib()
async def on_ready(): log.info("\n") log.info("Logged in as:\n{}/{}#{}\n----------".format( bot.user.id, bot.user.name, bot.user.discriminator)) log.info( "Bot version: {}\nAuthor(s): {}\nCode name: {}\nBuild date: {}".format( BUILD_VERSION, BUILD_AUTHORS, BUILD_CODENAME, BUILD_DATE)) log.debug("Debugging enabled!") await set_default_status() for extension in extensions: try: bot.load_extension(extension) except Exception as e: log.error("Failed to load extension {}\n{}: {}".format( extension, type(e).__name__, e)) traceback.print_exc() if config.enableOsu: log.info("The osu! module has been enabled in the config!") if config._dbots_token: #log.info("Updating DBots Statistics...") #try: # r = requests.post("https://discord.bots.gg/api/v1/bots/:{}/stats".format(bot.user.id), # json={"server_count": len(bot.guilds)}, # headers={"Authorization": config._dbots_token}, timeout=3) # if r.status_code == 200: # log.info("Discord Bots Server count updated.") # elif r.status_code == 401: # log.error("Woah, unauthorized?") #except requests.exceptions.Timeout: # log.error("The server failed to respond in time. Unable to update the bot statistics.") pass if os.path.isdir("data/music"): try: bot.cogs["Music"].clear_data() log.info("The music cache has been cleared!") except: log.warning("Failed to clear the music cache!") #await bot.cogs["Music"].disconnect_all_voice_clients() #log.info("Disconnected all voice clients!") load_opus_lib()
async def on_ready(): print("Logged in as:\n{}/{}#{}\n----------".format(bot.user.id, bot.user.name, bot.user.discriminator)) print( "Bot version: {}\nAuthor(s): {}\nCode name: {}\nBuild date: {}".format( BUILD_VERSION, BUILD_AUTHORS, BUILD_CODENAME, BUILD_DATE)) log.debug("Debugging enabled!") await set_default_status() for extension in extensions: try: bot.load_extension(extension) except Exception as e: log.error("Failed to load extension {}\n{}: {}".format( extension, type(e).__name__, e)) if config.enableMal: try: bot.load_extension("commands.myanimelist") log.info("The MyAnimeList module has been enabled!") except Exception as e: log.error("Failed to load the MyAnimeList module\n{}: {}".format( type(e).__name__, e)) if config.enableOsu: log.info("The osu! module has been enabled in the config!") if config._dbots_token: log.info("Updating DBots Statistics...") r = requests.post("https://bots.discord.pw/api/bots/{}/stats".format( bot.user.id), json={"server_count": len(bot.servers)}, headers={"Authorization": config._dbots_token}) if r.status_code == "200": log.info("Discord Bots Server count updated.") elif r.status_code == "401": log.error( "An error occurred while trying to update the server count!") load_opus_lib()
import asyncio import traceback import shutil import discord import youtube_dl from discord.ext import commands from utils.mysql import * from utils.logger import log from utils.opus_loader import load_opus_lib from utils.config import Config load_opus_lib() config = Config() ytdl_format_options = { "format": "bestaudio/best", "extractaudio": True, "audioformat": "mp3", "noplaylist": True, "nocheckcertificate": True, "ignoreerrors": False, "logtostderr": False, "quiet": True, "no_warnings": True, "default_search": "auto", "source_address": "0.0.0.0", "preferredcodec": "libmp3lame" }