Leveling Manager

This page shows you everything about LevelingManager.

RoleManager (todo)

LevelingAccount

class discordSuperUtils.Leveling.LevelingAccount(database, table, guild: int, member: int, rank_multiplier=1.5)

Initializer of LevelingAccount, represents a leveling account.

database

xp

table

level

guild

next_level

member

percentage_next_level

rank_multiplier

initial_rank_xp

set_xp

set_level

set_next_level

Attributes

  • database (DatabaseManager)

    • The database of the member.

  • table (str)

    • The table of the database.

  • guild (int)

    • The guild id of the guild.

  • member (discord.Member)

    • The member id of the member.

  • rank_multiplier (float)

    • The rank multiplier of the xp.

    • Not supposed to be used by the user.

Methods

  • xp() Returns the xp, this function is a coroutine.

  • level() Returns the level of the member, this function is a coroutine.

  • next_level() Returns the xp until next level of the member, this function is a coroutine.

  • percentage_next_level() Returns the percentage until level up of the member, this function is a coroutine.

  • initial_rank_xp()

    Returns the initial rank xp of the member's current level, this function is a coroutine Not meant to be used by the user.

  • set_xp(value)

    Sets the xp of the member to value, this function is a coroutine.

  • set_level(value)

    Sets the level of the member to value, this function is a coroutine.

  • set_next_level(value)

    Sets the xp until next level to value, this function is a coroutine.

LevelingManager

class discordSuperUtils.LevelingManager(bot, role_manager=None, xp_on_message=5, rank_multiplier=1.5, xp_cooldown=60)

Initializer of LevelingManager, represents a leveling manager that manages the ranking system for the bot. Inherits DatabaseChecker.

All inherited methods and attributes from DatabaseChecker are unlisted.

xp_cooldown

generate_checks

on_level_up

role_manager

create_account

bot

get_account

xp_on_message

get_leaderboard

rank_multiplier

cooldown_members

Attributes

  • bot (commands.Bot)

    • The bot the leveling manager will work on.

    • Passed in initializer.

  • xp_on_message(float)

    • XP granted on each new message, cooldown of 10 seconds between messages.

    • Passed in initializer.

    • Defaults to 5.

  • xp_cooldown (float)

    • The cooldown in seconds between messages.

  • rank_multiplier (float)

    • The multiplier of XP needed to level up on each level up.

    • Passed in initializer.

    • Defaults to 1.5.

  • cooldown_members (Dict[str, Dict[int, str]])

    • The XP cooldown data necessary for members.

Methods

get_account(member) -> LevelingAccount Gets a member's XP account. Returns None if account is not found.

This functions is a coroutine Parameters

  • member (discord.Member)

    • Member to get account from.

generate_checks(member) -> Dict[str, Any] Generates database checks for the member Parameters

  • member (discord.Member)

    • The member to generate checks to.

get_leaderboard(guild) -> List[LevelingAccount] Returns the leaderboard of the guild.

This function is a coroutine Parameters

  • guild (discord.Guild)

    • The guild of the leaderboard.

create_account(member) Creates an account for the member.

This function is a coroutine Parameters

  • member (discord.Member)

    • Member to create an account for.

Events

  • on_level_up(message, member, roles) This event is called when a member levels up. Parameters

    • message (discord.Message)

      • The message the member leveled up from.

    • member (LevelingAccount)

      • The member's XP data.

    • roles (List[discord.Roles])

      • The roles given to the member on level-up.

Last updated