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) { |
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 |
} |
} |
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); |