Releases: Defxult/discordLevelingSystem
Releases · Defxult/discordLevelingSystem
v1.2.1
v1.2.0
Breaking Changes
- The developer of discord.py has decided to revive the project. Since this library was originally dependent on discord.py, as of this version it is no longer dependent on pycord and will be using discord.py 2.0 or higher for the duration of this library.
- Function
discordLevelingSystem.version_info()has been removed. Use$ pip show discordLevelingSysteminstead to get the library version.
New Features
- Parameter
pathis now optional in methodDiscordLevelingSystem.create_database_file(). If left asNone, the database file is created in the current working directory.
Bug Fixes
- Fixed an issue where an error would occur when a user/guild doesn't have an icon. Now, the icon is the default discord user icon (#5).
v1.1.0
Library Change
- With the discontinuation of discord.py, this library is now dependent on pycord
New Features
- Added
LevelUpAnnouncement.Member.display_avatar_url. Used to access member avatars that are guild specific - Added
LevelUpAnnouncement.Member.banner_url. Used to access member banners - Added the ability to get the total amount of XP needed for a level
DiscordLevelingSystem.get_xp_for_level(level: int)
- Added the ability to limit the amount of records returned from a member data query
DiscordLevelingSystem.each_member_data(..., limit: Optional[int] = None)
- Added the ability to get the next level for a member
DiscordLevelingSystem.next_level(member: discord.Member)
- Added the ability to get the
dictthat represents the leveling systems level/XP requirement processDiscordLevelingSystem.levels_and_xp()
Miscellaneous
- Added
__repr__to theDiscordLevelingSystem.Bonusclass - Added
__all__for the library itself (from discordLevelingSystem import *) - Added more
typing.Optionalfor parameters. Implemented the use oftyping.ClassVarandcollections.abc.Sequence. A handful of parameters that specified aList[x]never really needed to be a list. All parameters that specified aList[x]has been changed toSequence[x], but parameters that still require a list are still type hinted asList[x]
v1.0.2
New Features
- Added the event
on_dls_level_up. This offers more capabilities compared toLevelUpAnnouncement(docs) - Added the ability to connect to a different database file while the leveling system is active
DiscordLevelingSystem.switch_connection(path: str)
- Added property
DiscordLevelingSystem.database_file_path. Returns the current path of the active database file - Added the
MemberDataclass to__init__for easier access to the class. Should only be used for type hinting
Bug Fixes
- Fixed an issue where properties
DiscordLevelingSystem.rate&DiscordLevelingSystem.perwouldn't return their updated values ifDiscordLevelingSystem.change_cooldown()was used
v1.0.1
New Features
- Added the ability to insert your own leveling system data into the library. Typically used if you're currently using a json leveling system, but can be converted from any system as long as the necessary values are given (beta) (docs)
DiscordLevelingSystem.insert(bot: Union[Bot, AutoShardedBot], guild_id: int, users: Dict[int, int], using: str, overwrite: bool=False, show_results: bool=True)
- Added the ability manually add a record to the database
DiscordLevelingSystem.add_record(guild_id: int, member_id: int, member_name: str, level: int)
- Added method
MemberData.to_dict() - Added function
discordLevelingSystem.version_info(). This will be the standard way for getting the information about what version of the library you are using
v1.0.0
New Features
- Added parameter
guildfor the below methods- This allows a more targeted check or removal for the specified member
DiscordLevelingSystem.is_in_database(member: Union[Member, int], guild: Guild=None)DiscordLevelingSystem.remove_from_database(member: Union[Member, int], guild: Guild=None)
- Before, your only option was to delete the entire database file. You can now delete the guild records of your choice
DiscordLevelingSystem.wipe_database(guild: Guild=None, *, intentional: bool=False)
- This allows a more targeted check or removal for the specified member
- Added the ability to get the awards that were set in the constructor as a whole or filtered by a specified guild
DiscordLevelingSystem.get_awards(guild: Union[Guild, int]=None)
- Added a few new attributes
DiscordLevelingSystem.active- Enable/disable the leveling system (docs)RoleAward.mention- The discord role mention string
v0.0.2
New Features
- Added the ability for
LevelUpAnnouncementmessages to be embeds (docs) - Added the ability to have multiple
LevelUpAnnouncementmessages (docs) - Added the ability for multiple servers to have their own level up awards (docs)
- Added the ability to set roles that give bonus XP (docs)
- Added the ability to set the name for a
RoleAward(docs) - Added the ability to access
rateandper(the values set in theDiscordLevelingSystemconstructor) (docs)DiscordLevelingSystem.rate(property)DiscordLevelingSystem.per(property)
- Added the ability to manually set a members XP and level (docs)
DiscordLevelingSystem.add_xp(member: Member, amount: int)DiscordLevelingSystem.remove_xp(member: Member, amount: int)DiscordLevelingSystem.set_level(member: Member, level: int)
- Added the ability to access more of the members information when a level up message is sent (docs)
LevelUpAnnouncement.Member.avatar_urlLevelUpAnnouncement.Member.created_atLevelUpAnnouncement.Member.default_avatar_urlLevelUpAnnouncement.Member.discriminatorLevelUpAnnouncement.Member.display_nameLevelUpAnnouncement.Member.idLevelUpAnnouncement.Member.joined_atLevelUpAnnouncement.Member.mentionLevelUpAnnouncement.Member.nameLevelUpAnnouncement.Member.nickLevelUpAnnouncement.Member.Guild.icon_urlLevelUpAnnouncement.Member.Guild.idLevelUpAnnouncement.Member.Guild.name
- Added the ability to transfer your
v0.0.1database file records to av0.0.2+database file (see Bug Fixes)DiscordLevelingSystem.transfer(old: str, new: str, guild_id: int)
- Improved
export_as_jsonmethod. Format is now easier to read
Bug Fixes
- Fixed an issue where if your bot was in multiple servers and members were in 2 or more of those servers, the leaderboard would be updated regardless of being in the same server or a different one. A member could level up to "1" in a server and their next level would be "2" in another. The member's level and XP would remain the same in all the servers. With this update, member XP and level are now specific to each server and are no longer the same in all servers.
- IMPORTANT: Migrating from v0.0.1 to v0.0.2+
- Fixed an issue where if an
award_xpamount 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. - Fixed an issue where discord system messages would give XP to the member
- Fixed an issue where if a
level_up_channel_idwas set for a server and level up occured in a different server, an error would occur (important: see Breaking Change forlevel_up_channel_id)
Breaking Change
- removed
LevelUpAnnouncement.AUTHOR_MENTION- This has been replaced with
LevelUpAnnouncement.Member.mention
- This has been replaced with
- removed
LevelUpAnnouncement.XP- This was removed because in a level up message the members XP was always reset to zero because of the level up, and accessing that attribute would always give a value of zero
- removed Exception
AwardedRoleNotFoundhas been removed because it is no longer needed - removed Exception
LevelUpChannelNotFoundhas been removed because it is no longer needed - removed
DiscordLevelingSystem.awardsattribute- The ability to set this attribute from an instance of
DiscordLevelingSystemwas 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 theawardsvalue via theDiscordLevelingSystemconstructor
- The ability to set this attribute from an instance of
- changed
LevelUpAnnouncementparameterlevel_up_channel_id. This was renamed and the type has been changed to support multiple servers having their own level up channel- Before:
level_up_channel_id(int) - After:
level_up_channel_ids(List[int])
- Before:
- changed Maximum value allowed in
award_xp- Previously, the maximum value for the
amountparameter inaward_xpwas 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 roles
- Previously, the maximum value for the
- changed
DiscordLevelingSystemparameterawardstype- Before:
Union[List[RoleAward], None] - After:
Union[Dict[int, List[RoleAward]], None]
- Before:
- changed Parameters for method
clean_database- Before:
DiscordLevelingSystem.clean_database(all_members: List[Member]) - After:
DiscordLevelingSystem.clean_database(guild: Guild)
- Before:
- changed Parameters for method
reset_everyone- Before:
DiscordLevelingSystem.reset_everyone(*, intentional: bool=False) - After:
DiscordLevelingSystem.reset_everyone(guild: Union[Guild, None], *, intentional: bool=False)
- Before:
- changed Parameters for method
export_as_json- Before:
DiscordLevelingSystem.export_as_json(path: str) - After:
DiscordLevelingSystem.export_as_json(path: str, guild: Union[Guild, None])
- Before:
- changed Parameters for method
raw_database_contents- Before:
DiscordLevelingSystem.raw_database_contents() - After:
DiscordLevelingSystem.raw_database_contents(guild: Guild=None)
- Before:
- changed Parameters for method
get_record_count- Before:
DiscordLevelingSystem.get_record_count() - After:
DiscordLevelingSystem.get_record_count(guild: Guild=None)
- Before: