Table of Contents
Tasks
Tasks are (usually small) bits of code that are run by the bot on a regular schedule.
Guild Admin Cookie
Probably the most important Task is the guild admin token refreshing. This is stored in the CheckSUPlatformAuthorisationTaskCog and, if enabled, will automatically update the guild admin cookie at a configurable interval. This is necessary because MSL has their cookie timeout set very low (approx ~15 minutes as of the time of writing this) and it's not feasible to grab a new cookie manually every 15 minutes. Instead, the bot will automatically refresh the cookie it's given on the interval provided. This will not work if the cookie it is given has already expired. If the cookie has expired before the task can run you will need to manually update it and reboot the bot.
Introduction Reminders
If enabled, the bot will DM users at a configured interval, reminding them to introduce themselves. This can be set to continual so it keeps reminding them until they either introduce, or opt out of reminders or it can also be set to “Once” which can also be configured to wait a certain amount of time (currently set to 24h) before sending this reminder. This task is contained in SendIntroductionRemindersTaskCog and identifies users that are not inducted by checking if they posses any role other than News or Everyone. This is done (instead of simply checking if they have the guest role or not) as we have certain users that are considered to be inducted but that do not posses the Guest role - for example University staff.
The bot also has an optional configuration to kick anyone who has not inducted after a certain interval, though this is currently disabled. Due to a code bug, this once activated accidently and within a few minutes, the bot had kicked almost 1,000 people from the server. This will forever be known as “The Great Purge”.
Role Reminders
Similar to above, if enabled, the bot will send reminders to users to grab some opt-in roles at the specified interval. This is currently disabled. This task is contained in SendGetRolesRemindersTaskCog and works by checking every role of every member, and checking against a hard-coded list of opt-in role names. This probably should be improved at some point to be more automatic, as currently if we add a new opt in role, you'd need to open a new PR to update the list in TeX so it doesn't DM someone who has that opt-in role.
Auto Add Committee To Threads
This one technically isn't a Task, but is a listener. When a new thread is created when the word “committee” is in the category name, all committee and committee elect will automatically be added to the thread silently (i.e. without being pinged). This was done so that everyone has visibility of committee threads as we had occasionally had situations where things were discussed in a thread but some committee members didn't realise because they hadn't joined the thread. This saves everyone an unnecessary ping, and also avoids the problem of the thread creator simply forgetting to ping everyone to bring them into the thread.