A library to implement a leveling system into a discord bot. Contains features such as XP, level, ranks, and role awards.
MIT License
Published by Defxult about 2 years ago
discordLevelingSystem.version_info()
has been removed. Use $ pip show discordLevelingSystem
instead to get the library version.path
is now optional in method DiscordLevelingSystem.create_database_file()
. If left as None
, the database file is created in the current working directory.Published by Defxult over 2 years ago
LevelUpAnnouncement.Member.display_avatar_url
. Used to access member avatars that are guild specificLevelUpAnnouncement.Member.banner_url
. Used to access member bannersDiscordLevelingSystem.get_xp_for_level(level: int)
DiscordLevelingSystem.each_member_data(..., limit: Optional[int] = None)
DiscordLevelingSystem.next_level(member: discord.Member)
dict
that represents the leveling systems level/XP requirement process
DiscordLevelingSystem.levels_and_xp()
__repr__
to the DiscordLevelingSystem.Bonus
class__all__
for the library itself (from discordLevelingSystem import *
)typing.Optional
for parameters. Implemented the use of typing.ClassVar
and collections.abc.Sequence
. A handful of parameters that specified a List[x]
never really needed to be a list. All parameters that specified a List[x]
has been changed to Sequence[x]
, but parameters that still require a list are still type hinted as List[x]
Published by Defxult about 3 years ago
on_dls_level_up
. This offers more capabilities compared to LevelUpAnnouncement
(docs)DiscordLevelingSystem.switch_connection(path: str)
DiscordLevelingSystem.database_file_path
. Returns the current path of the active database fileMemberData
class to __init__
for easier access to the class. Should only be used for type hintingDiscordLevelingSystem.rate
& DiscordLevelingSystem.per
wouldn't return their updated values if DiscordLevelingSystem.change_cooldown()
was usedPublished by Defxult about 3 years ago
DiscordLevelingSystem.insert(bot: Union[Bot, AutoShardedBot], guild_id: int, users: Dict[int, int], using: str, overwrite: bool=False, show_results: bool=True)
DiscordLevelingSystem.add_record(guild_id: int, member_id: int, member_name: str, level: int)
MemberData.to_dict()
discordLevelingSystem.version_info()
. This will be the standard way for getting the information about what version of the library you are usingPublished by Defxult about 3 years ago
guild
for the below methods
DiscordLevelingSystem.is_in_database(member: Union[Member, int], guild: Guild=None)
DiscordLevelingSystem.remove_from_database(member: Union[Member, int], guild: Guild=None)
DiscordLevelingSystem.wipe_database(guild: Guild=None, *, intentional: bool=False)
DiscordLevelingSystem.get_awards(guild: Union[Guild, int]=None)
DiscordLevelingSystem.active
- Enable/disable the leveling system (docs)RoleAward.mention
- The discord role mention stringPublished by Defxult over 3 years ago
LevelUpAnnouncement
messages to be embeds (docs)LevelUpAnnouncement
messages (docs)RoleAward
(docs)rate
and per
(the values set in the DiscordLevelingSystem
constructor) (docs)
DiscordLevelingSystem.rate
(property)DiscordLevelingSystem.per
(property)DiscordLevelingSystem.add_xp(member: Member, amount: int)
DiscordLevelingSystem.remove_xp(member: Member, amount: int)
DiscordLevelingSystem.set_level(member: Member, level: int)
LevelUpAnnouncement.Member.avatar_url
LevelUpAnnouncement.Member.created_at
LevelUpAnnouncement.Member.default_avatar_url
LevelUpAnnouncement.Member.discriminator
LevelUpAnnouncement.Member.display_name
LevelUpAnnouncement.Member.id
LevelUpAnnouncement.Member.joined_at
LevelUpAnnouncement.Member.mention
LevelUpAnnouncement.Member.name
LevelUpAnnouncement.Member.nick
LevelUpAnnouncement.Member.Guild.icon_url
LevelUpAnnouncement.Member.Guild.id
LevelUpAnnouncement.Member.Guild.name
v0.0.1
database file records to a v0.0.2+
database file (see Bug Fixes)
DiscordLevelingSystem.transfer(old: str, new: str, guild_id: int)
export_as_json
method. Format is now easier to readaward_xp
amount value was a list and the first value was larger than the second, an error would occur that was not informative. An informative error is now raised.level_up_channel_id
was set for a server and level up occured in a different server, an error would occur (important: see Breaking Change for level_up_channel_id
)LevelUpAnnouncement.AUTHOR_MENTION
LevelUpAnnouncement.Member.mention
LevelUpAnnouncement.XP
AwardedRoleNotFound
has been removed because it is no longer neededLevelUpChannelNotFound
has been removed because it is no longer neededDiscordLevelingSystem.awards
attribute
DiscordLevelingSystem
was removed because there is a necessary check that needs to take place to ensure the role award system can operate smoothly. You can still set the awards
value via the DiscordLevelingSystem
constructorLevelUpAnnouncement
parameter level_up_channel_id
. This was renamed and the type has been changed to support multiple servers having their own level up channel
level_up_channel_id
(int
)level_up_channel_ids
(List[int]
)award_xp
amount
parameter in award_xp
was 100. This has been reduced to a maximum of 25. Why? The goal of this library is to try and mimic the operations of the MEE6 leveling system, and awarding XP less than or equal to 25 has proved to be more of a stable way to earn XP, especially when it comes to bonus XP rolesDiscordLevelingSystem
parameter awards
type
Union[List[RoleAward], None]
Union[Dict[int, List[RoleAward]], None]
clean_database
DiscordLevelingSystem.clean_database(all_members: List[Member])
DiscordLevelingSystem.clean_database(guild: Guild)
reset_everyone
DiscordLevelingSystem.reset_everyone(*, intentional: bool=False)
DiscordLevelingSystem.reset_everyone(guild: Union[Guild, None], *, intentional: bool=False)
export_as_json
DiscordLevelingSystem.export_as_json(path: str)
DiscordLevelingSystem.export_as_json(path: str, guild: Union[Guild, None])
raw_database_contents
DiscordLevelingSystem.raw_database_contents()
DiscordLevelingSystem.raw_database_contents(guild: Guild=None)
get_record_count
DiscordLevelingSystem.get_record_count()
DiscordLevelingSystem.get_record_count(guild: Guild=None)
Published by Defxult over 3 years ago
Initial release (alpha)