Skip to content

Commit 2873c3d

Browse files
committed
Added database implementation of user roles when assigned and removed
1 parent 8e1acf4 commit 2873c3d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

commands/course.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,14 @@ module.exports = {
127127
ephemeral: true,
128128
});
129129
}
130+
// // Add it to the existing database to track.
131+
/** @type {DBuser} */
132+
const userDB = global.userDB;
133+
await userDB.add_user_role(interaction.user.id, role.name);
130134

131135
// If they don't, let's add the role to them
132136
await interaction.member.roles.add(role);
137+
133138
return await interaction.reply({
134139
content: `✅ | Added you to the chat for \`${course_with_alias}\`.`,
135140
ephemeral: true,
@@ -190,6 +195,10 @@ module.exports = {
190195
in_overwrites(permissions, role.id)
191196
) {
192197
// If they do remove the role
198+
/** @type {DBuser} */
199+
const userDB = global.userDB;
200+
userDB.remove_user_role(interaction.user.id, role.name);
201+
193202
await interaction.member.roles.remove(role);
194203
return await interaction.reply({
195204
content: `✅ | Removed you from the role and chat for \`${course}\`.`,

0 commit comments

Comments
 (0)