Exemplo n.º 1
0
            if hasattr(e, "original"):
                print(
                    f"| Failed to load extension {cog}\n|   {type(e.original).__name__}: {e.original}"
                )
            else:
                print(
                    f"| Failed to load extension {cog}\n|   {type(e).__name__}: {e}"
                )

            error = exc_info()
            await bot.errorlog.send(error, event="Load Initial Cog")

    print(f"| Syncing commands...", end="\r")
    await bot.tree.sync()
    await bot.tree.sync(guild=await bot.fetch_guild(699399549218717707))
    print(f"| Commands synced    ")

    print(f"#-------------------------------#\n"
          f"| Successfully logged in.\n"
          f"#-------------------------------#\n"
          f"| User:      {bot.user}\n"
          f"| User ID:   {bot.user.id}\n"
          f"| Owner:     {bot.owner}\n"
          f"| Guilds:    {len(bot.guilds)}\n"
          f"| OAuth URL: {oauth_url(app_info.id, permissions=permissions)}\n"
          f"#------------------------------#\n")


if __name__ == "__main__":
    bot.run()
Exemplo n.º 2
0
            bot.load_extension(f"cogs.{cog}")
        except Exception as e:
            print(
                f"| Failed to load extension {cog}\n|   {type(e).__name__}: {e}"
            )

    # "Ready" status message
    ready = f"{config.hget('prefix:config', 'default_prefix')}help for help"
    await bot.change_presence(activity=Activity(name=ready, type=2))

    # Pretty printing ready message and general stats
    print(f"#-------------------------------#\n"
          f"| Successfully logged in.\n"
          f"#-------------------------------#\n"
          f"| Username:  {bot.user.name}\n"
          f"| User ID:   {bot.user.id}\n"
          f"| Owner:     {bot.owner}\n"
          f"| Guilds:    {len(bot.guilds)}\n"
          f"| Users:     {len(list(bot.get_all_members()))}\n"
          f"| OAuth URL: {oauth_url(bot.app_info.id)}\n"
          f"# ------------------------------#")


@bot.event
async def on_message(msg: Message):
    await bot.process_commands(msg)


if __name__ == "__main__":
    bot.run(**config.hgetall("run"))