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