wildxmxtt / spotbot2

A discord bot made for adding songs to a spotify playlist ; Upgraded version of my old and private spotbot program.
MIT License
0 stars 0 forks source link

SpotBot Leaderboard and Achievements #7

Closed karltrowbridge1 closed 3 months ago

karltrowbridge1 commented 3 months ago

This code adds Leaderboards and Achievements.

Leaderboards

  1. All time leaderboard Every 5 messages, the number of songs is compared to the pre-set number of milestones that grow in size. The leaderboard is ranked in total songs sent by a user.

  2. This month leaderboard Uses timestamp from the database to parse songs only from the current month. The leaderboard is ranked in total songs sent by a user.

  3. Reaction Champ Again uses the timestamp from the database to parse songs only from the current month. This uses the Spotify object to interact with the API and get playlist information.

Achievements

  1. Number of songs Every 5 messages, the number of songs is compared to the pre-set number of milestones that grow in size from 25 to the 100's of songs. If one of these numbers is met, a message is crafted and sent to the server in celebration.

  2. Playlist duration This required more abstraction in the playlist_update.py file. I also saw fit to create an acheivements.py to abstract more functions from the main spotbot.py file. This is also rate-limited via the song count, every 5th song this is called. In order to ensure an hour is celebrated several times (8.03 hours, 8.29 hours) a reached_at field is present. This is filled out when the server is celebrated, this field is populated ensuring that it is not celebrated again.

It is important to note that this feature is not yet toggleable via flask. I propose that we hold off on this until flask is remade and maybe even utilize the database to help with Linux functionality.