@@ -5,16 +5,10 @@ import { unwrap } from "../utils/misc.js";
55import { M } from "../utils/debugging-and-logging.js" ;
66import { BotComponent } from "../bot-component.js" ;
77import { CommandSetBuilder } from "../command-abstractions/command-set-builder.js" ;
8- import { EarlyReplyMode , TextBasedCommandBuilder } from "../command-abstractions/text-based-command-builder.js" ;
9- import { TextBasedCommand } from "../command-abstractions/text-based-command.js" ;
108import { skill_roles_order , skill_roles_order_id , Wheatley } from "../wheatley.js" ;
119import { set_interval } from "../utils/node.js" ;
1210import { build_description } from "../utils/strings.js" ;
1311
14- // Role cleanup
15- // Auto-remove pink roles when members are no longer boosting
16- // Auto-remove duplicate skill roles
17-
1812type user_role_entry = {
1913 user_id : string ;
2014 roles : string [ ] ;
@@ -31,7 +25,6 @@ type role_update_listener = {
3125export default class RoleManager extends BotComponent {
3226 private skill_role_log ! : Discord . TextChannel ;
3327 private staff_member_log ! : Discord . TextChannel ;
34- pink_role ! : Discord . Role ;
3528 interval : NodeJS . Timeout | null = null ;
3629
3730 // current database state
@@ -58,22 +51,6 @@ export default class RoleManager extends BotComponent {
5851 override async setup ( commands : CommandSetBuilder ) {
5952 this . skill_role_log = await this . utilities . get_channel ( this . wheatley . channels . skill_role_log ) ;
6053 this . staff_member_log = await this . utilities . get_channel ( this . wheatley . channels . staff_member_log ) ;
61-
62- commands . add (
63- new TextBasedCommandBuilder ( "gimmepink" , EarlyReplyMode . ephemeral )
64- . set_category ( "Misc" )
65- . set_description ( "Gives pink" )
66- . set_slash ( false )
67- . set_handler ( this . gibpink . bind ( this ) ) ,
68- ) ;
69-
70- commands . add (
71- new TextBasedCommandBuilder ( "unpink" , EarlyReplyMode . ephemeral )
72- . set_category ( "Misc" )
73- . set_description ( "Takes pink" )
74- . set_slash ( false )
75- . set_handler ( this . unpink . bind ( this ) ) ,
76- ) ;
7754 }
7855
7956 override async on_ready ( ) {
@@ -107,9 +84,7 @@ export default class RoleManager extends BotComponent {
10784 this . wheatley . roles . herald . id ,
10885 this . wheatley . roles . linked_github . id ,
10986 ] ) ;
110- this . pink_role = unwrap ( await this . wheatley . guild . roles . fetch ( this . wheatley . roles . pink . id ) ) ;
11187
112- this . register_role_check ( this . check_pink . bind ( this ) ) ;
11388 this . register_role_check ( this . check_skill_roles . bind ( this ) ) ;
11489 this . register_role_update_listener ( new Set ( skill_roles_order_id ) , this . check_for_skill_role_bump . bind ( this ) ) ;
11590
@@ -149,38 +124,6 @@ export default class RoleManager extends BotComponent {
149124 }
150125 }
151126
152- async gibpink ( command : TextBasedCommand ) {
153- const member = await command . get_member ( this . wheatley . guild ) ;
154- if ( member . premiumSince == null ) {
155- await command . reply ( "Nice try." , true , true ) ;
156- return ;
157- }
158- if ( member . roles . cache . some ( r => r . id == this . pink_role . id ) ) {
159- await command . reply ( "You are currently pink" , true , true ) ;
160- return ;
161- }
162- await member . roles . add ( this . pink_role ) ;
163- await command . reply ( "You are now pink" , true , true ) ;
164- }
165-
166- async unpink ( command : TextBasedCommand ) {
167- const member = await command . get_member ( this . wheatley . guild ) ;
168- if ( ! member . roles . cache . some ( r => r . id == this . pink_role . id ) ) {
169- await command . reply ( "You are not currently pink" , true , true ) ;
170- return ;
171- }
172- await member . roles . remove ( this . pink_role ) ;
173- }
174-
175- async check_pink ( member : Discord . GuildMember ) {
176- if ( member . roles . cache . some ( role => role . id == this . wheatley . roles . pink . id ) ) {
177- if ( member . premiumSince == null ) {
178- M . log ( "removing pink for" , member . user . tag ) ;
179- await member . roles . remove ( this . pink_role ) ;
180- }
181- }
182- }
183-
184127 async check_skill_roles ( member : Discord . GuildMember ) {
185128 const skill_roles = member . roles . cache . filter ( role =>
186129 Object . values ( this . wheatley . skill_roles ) . some ( skill_role => role . id == skill_role . id ) ,
0 commit comments