Closed Incapamentum closed 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.
Summary of work done up to this point:
roles
category (also new) and relevant CRUD operations.UserEventHandler.cs
, which currently processes when a user leaves the server, notifying leadership if and only if the user had relevant in-game roles.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.
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:
SocketConfig
intents. The more important one are the GatewayIntents
to make use of the privileged GUILD_MEMBERS
intent, which had to be enabled on the Discord dev portal.SocketConfig
intent should already be configured to download all members to the cache, but this is a fail-safe.Will go ahead and merge the above changes again.
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, theSocketUser
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 toSocketGuildUser
, grab their roles, check if there's a match, then do further processing depending on whether it is or not.