/[sudobot]/trunk/src/commands/moderation/UnlockallCommand.ts
ViewVC logotype

Diff of /trunk/src/commands/moderation/UnlockallCommand.ts

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 103 by rakin, Mon Jul 29 17:28:36 2024 UTC revision 107 by rakin, Mon Jul 29 17:28:37 2024 UTC
# Line 87  export default class UnlockallCommand ex Line 87  export default class UnlockallCommand ex
87          const raid = options.isInteraction ? options.options.getBoolean('raid') === true : (options.options.indexOf('--raid') !== -1);          const raid = options.isInteraction ? options.options.getBoolean('raid') === true : (options.options.indexOf('--raid') !== -1);
88    
89          let role: Role = <Role> msg.guild!.roles.everyone;          let role: Role = <Role> msg.guild!.roles.everyone;
90          let unlockall: string[] = [];          let unlockall: string[] = [], unlockallChannels: Collection<string, TextChannel> = new Collection();
91          const force = options.isInteraction ? options.options.getBoolean('force') === true : (options.options.indexOf('--force') !== -1);          const force = options.isInteraction ? options.options.getBoolean('force') === true : (options.options.indexOf('--force') !== -1);
92    
93          if (options.isInteraction) {          if (options.isInteraction) {
# Line 116  export default class UnlockallCommand ex Line 116  export default class UnlockallCommand ex
116                  return;                  return;
117              }              }
118    
119              for (const a of options.args) {              if (!raid) {
120                  if (/^\d+$/g.test(a)) {                  for (const a of options.args) {
121                      unlockall.push(a);                      if (/^\d+$/g.test(a)) {
122                            unlockall.push(a);
123                        }
124                    }
125        
126                    if ((msg as Message).mentions.channels.first()) {
127                        (msg as Message).mentions.channels.forEach(c => {
128                            if (c instanceof TextChannel)
129                                unlockallChannels.set(c.id, c);
130                        });
131                  }                  }
132              }              }
133          }          }
# Line 132  export default class UnlockallCommand ex Line 141  export default class UnlockallCommand ex
141    
142          if (channels === null && !raid) {          if (channels === null && !raid) {
143              channels = msg.guild!.channels.cache.filter(c2 => (unlockall.includes(c2.id) || unlockall.includes(c2.parent?.id!)) && c2.type === 'GUILD_TEXT')!;              channels = msg.guild!.channels.cache.filter(c2 => (unlockall.includes(c2.id) || unlockall.includes(c2.parent?.id!)) && c2.type === 'GUILD_TEXT')!;
144                channels = channels.merge(unlockallChannels, c => ({ keep: true, value: c }), c => ({ keep: true, value: c }), (c1, c2) => ({ keep: true, value: c2 }));
145          }          }
146    
147          await unlockAll(client, role, msg, options, channels as Collection <string, TextChannel>, force);          await unlockAll(client, role, msg, options, channels as Collection <string, TextChannel>, force);

Legend:
Removed from v.103  
changed lines
  Added in v.107

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26