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.
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.
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
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.
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.
This code adds Leaderboards and Achievements.
Leaderboards
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.
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.Reaction Champ Again uses the
timestamp
from the database to parse songs only from the current month. This uses theSpotify
object to interact with the API and get playlist information.Achievements
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.
Playlist duration This required more abstraction in the
playlist_update.py
file. I also saw fit to create anacheivements.py
to abstract more functions from the mainspotbot.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) areached_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.