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

Diff of /trunk/src/commands/moderation/LockallCommand.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 83  export default class LockallCommand exte Line 83  export default class LockallCommand exte
83          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);
84    
85          let role: Role = <Role> msg.guild!.roles.everyone;          let role: Role = <Role> msg.guild!.roles.everyone;
86          let lockall: string[] = [];          let lockall: string[] = [], lockallChannels: Collection<string, TextChannel> = new Collection();
87          // 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);
88    
89          if (options.isInteraction) {          if (options.isInteraction) {
# Line 114  export default class LockallCommand exte Line 114  export default class LockallCommand exte
114                  return;                  return;
115              }              }
116    
117              for (const a of options.args) {              if (!raid) {
118                  if (/^\d+$/g.test(a)) {                  for (const a of options.args) {
119                      lockall.push(a);                      if (/^\d+$/g.test(a)) {
120                            lockall.push(a);
121                        }
122                    }
123        
124                    if ((msg as Message).mentions.channels.first()) {
125                        (msg as Message).mentions.channels.forEach(c => {
126                            if (c instanceof TextChannel)
127                                lockallChannels.set(c.id, c);
128                        });
129                  }                  }
130              }              }
131          }          }
# Line 130  export default class LockallCommand exte Line 139  export default class LockallCommand exte
139    
140          if (channels === null && !raid) {          if (channels === null && !raid) {
141              channels = msg.guild!.channels.cache.filter(c2 => (lockall.includes(c2.id) || lockall.includes(c2.parent?.id!)) && c2.type === 'GUILD_TEXT')!;              channels = msg.guild!.channels.cache.filter(c2 => (lockall.includes(c2.id) || lockall.includes(c2.parent?.id!)) && c2.type === 'GUILD_TEXT')!;
142                channels = channels.merge(lockallChannels, c => ({ keep: true, value: c }), c => ({ keep: true, value: c }), (c1, c2) => ({ keep: true, value: c2 }));
143          }          }
144    
145          await lockAll(client, role, channels as Collection <string, TextChannel>, true);          await lockAll(client, role, channels as Collection <string, TextChannel>, true);

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26