@@ -43,6 +43,51 @@ export class InviteCommand implements ICommand {
43
43
await this . ensureInvited ( targetRoomId , resolved ) ;
44
44
}
45
45
46
+ private async runSpeakersSupport ( ) : Promise < void > {
47
+ let people : IPerson [ ] = [ ] ;
48
+ for ( const aud of this . conference . storedAuditoriumBackstages ) {
49
+ people . push ( ...await this . conference . getInviteTargetsForAuditorium ( aud , [ Role . Speaker ] ) ) ;
50
+ }
51
+ const newPeople : IPerson [ ] = [ ] ;
52
+ people . forEach ( p => {
53
+ if ( ! newPeople . some ( n => n . id === p . id ) ) {
54
+ newPeople . push ( p ) ;
55
+ }
56
+ } ) ;
57
+ await this . createInvites ( newPeople , this . config . conference . supportRooms . speakers ) ;
58
+ }
59
+
60
+ private async runCoordinatorsSupport ( ) : Promise < void > {
61
+ let people : IPerson [ ] = [ ] ;
62
+ for ( const aud of this . conference . storedAuditoriums ) {
63
+ // This hack was not wanted in 2023 or 2024.
64
+ // if (!(await aud.getId()).startsWith("D.")) {
65
+ // HACK: Only invite coordinators for D.* auditoriums.
66
+ // TODO: Make invitations for support rooms more configurable.
67
+ // https://github.com/matrix-org/this.conference-bot/issues/76
68
+ // continue;
69
+ // }
70
+
71
+ const inviteTargets = await this . conference . getInviteTargetsForAuditorium ( aud , [ Role . Coordinator ] ) ;
72
+ people . push ( ...inviteTargets ) ;
73
+ }
74
+ const newPeople : IPerson [ ] = [ ] ;
75
+ people . forEach ( p => {
76
+ if ( ! newPeople . some ( n => n . id == p . id ) ) {
77
+ newPeople . push ( p ) ;
78
+ }
79
+ } ) ;
80
+ await this . createInvites ( newPeople , this . config . conference . supportRooms . coordinators ) ;
81
+ }
82
+
83
+ private async runSpecialInterestSupport ( ) : Promise < void > {
84
+ const people : IPerson [ ] = [ ] ;
85
+ for ( const sir of this . conference . storedInterestRooms ) {
86
+ people . push ( ...await this . conference . getInviteTargetsForInterest ( sir ) ) ;
87
+ }
88
+ await this . createInvites ( people , this . config . conference . supportRooms . specialInterest ) ;
89
+ }
90
+
46
91
public async run ( managementRoomId : string , event : any , args : string [ ] ) {
47
92
await this . client . replyNotice ( managementRoomId , event , "Sending invites to participants. This might take a while." ) ;
48
93
@@ -52,46 +97,20 @@ export class InviteCommand implements ICommand {
52
97
// that a subset of people are joined.
53
98
54
99
if ( args [ 0 ] && args [ 0 ] === "speakers-support" ) {
55
- let people : IPerson [ ] = [ ] ;
56
- for ( const aud of this . conference . storedAuditoriumBackstages ) {
57
- people . push ( ...await this . conference . getInviteTargetsForAuditorium ( aud , [ Role . Speaker ] ) ) ;
58
- }
59
- const newPeople : IPerson [ ] = [ ] ;
60
- people . forEach ( p => {
61
- if ( ! newPeople . some ( n => n . id === p . id ) ) {
62
- newPeople . push ( p ) ;
63
- }
64
- } ) ;
65
- await this . createInvites ( newPeople , this . config . conference . supportRooms . speakers ) ;
100
+ await this . runSpeakersSupport ( ) ;
66
101
} else if ( args [ 0 ] && args [ 0 ] === "coordinators-support" ) {
67
- let people : IPerson [ ] = [ ] ;
68
- for ( const aud of this . conference . storedAuditoriums ) {
69
- // This hack was not wanted in 2023 or 2024.
70
- // if (!(await aud.getId()).startsWith("D.")) {
71
- // HACK: Only invite coordinators for D.* auditoriums.
72
- // TODO: Make invitations for support rooms more configurable.
73
- // https://github.com/matrix-org/this.conference-bot/issues/76
74
- // continue;
75
- // }
76
-
77
- const inviteTargets = await this . conference . getInviteTargetsForAuditorium ( aud , [ Role . Coordinator ] ) ;
78
- people . push ( ...inviteTargets ) ;
79
- }
80
- const newPeople : IPerson [ ] = [ ] ;
81
- people . forEach ( p => {
82
- if ( ! newPeople . some ( n => n . id == p . id ) ) {
83
- newPeople . push ( p ) ;
84
- }
85
- } ) ;
86
- await this . createInvites ( newPeople , this . config . conference . supportRooms . coordinators ) ;
102
+ await this . runCoordinatorsSupport ( ) ;
87
103
} else if ( args [ 0 ] && args [ 0 ] === "si-support" ) {
88
- const people : IPerson [ ] = [ ] ;
89
- for ( const sir of this . conference . storedInterestRooms ) {
90
- people . push ( ...await this . conference . getInviteTargetsForInterest ( sir ) ) ;
91
- }
92
- await this . createInvites ( people , this . config . conference . supportRooms . specialInterest ) ;
104
+ await this . runSpecialInterestSupport ( ) ;
93
105
} else {
94
106
await runRoleCommand ( ( _client , room , people ) => this . ensureInvited ( room , people ) , this . conference , this . client , managementRoomId , event , args ) ;
107
+
108
+ if ( args . length === 0 ) {
109
+ // If no specific rooms are requested, then also handle invites to all support rooms.
110
+ await this . runSpeakersSupport ( ) ;
111
+ await this . runCoordinatorsSupport ( ) ;
112
+ await this . runSpecialInterestSupport ( ) ;
113
+ }
95
114
}
96
115
97
116
await this . client . sendNotice ( managementRoomId , "Invites sent!" ) ;
0 commit comments