Incapamentum / Exalted-Sage

Discord bot that does API requests to retrieve a collection of daily achievements for the next day and pushes an alert when any that is in a watchlist shows up.
3 stars 0 forks source link

Feature Request - Notify on Leave from server (in-game roles only) #9

Closed Incapamentum closed 1 year ago

Incapamentum commented 1 year ago

Currently, there is no existing mechanism that kicks a player from the guild if they leave the server.

Leadership requested a way for the bot to send a notification to a specific channel when a user with in-game roles (i.e. Ascended, Gilded, etc) leaves the server.

The API does fire an event when a user leaves a server, with a signature of Func<SocketGuild, SocketUser, Task>. According to docs, the SocketUser class does not have any kind of support on retrieving the roles and nickname of the user. However, SocketGuildUser does support ways of retrieving such information.

Implementation should be straightforward: take the SocketUser, safely convert to SocketGuildUser, grab their roles, check if there's a match, then do further processing depending on whether it is or not.

Incapamentum commented 1 year ago

Finally getting around to work on this. The roles to be on the lookout for are the following:

Ascended (925131744636727348)
Vault Keeper (925131749850251334)
Designer (925131745622388837)
Gilded (925131746821931019)
Vacation (925131748256411668)
Tarnished (1018288131881050244)

The database will have to be updated with a new schema. The exact collection will have to be determined at a later point. A new handler will also have to be created and assigned with the event.

Incapamentum commented 1 year ago

Summary of work done up to this point:

These changes are a bit difficult to test in a dev environment, so a live-testing will be done by merging to main, which would then kick-off the workflows to deploy to the VPS.

Incapamentum commented 1 year ago

As with any other deployment, there will always be some uncaught issues. Especially if it turns out to be difficult to not be able to properly test in a dev environment.

The following changes were done that fixed two issues:

Will go ahead and merge the above changes again.