Turn on strict TS compilation. Fix up and tweak types accordingly.
This commit is contained in:
parent
690955a399
commit
629002b8d9
172 changed files with 720 additions and 534 deletions
|
@ -15,7 +15,8 @@ export function getCompanionChannelOptsForVoiceChannelId(
|
|||
return Object.values(config.entries)
|
||||
.filter(
|
||||
opts =>
|
||||
opts.voice_channel_ids.includes(voiceChannel.id) || opts.voice_channel_ids.includes(voiceChannel.parentID),
|
||||
opts.voice_channel_ids.includes(voiceChannel.id) ||
|
||||
(voiceChannel.parentID && opts.voice_channel_ids.includes(voiceChannel.parentID)),
|
||||
)
|
||||
.map(opts => Object.assign({}, defaultCompanionChannelOpts, opts));
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ export async function handleCompanionPermissions(
|
|||
export async function handleCompanionPermissions(
|
||||
pluginData: GuildPluginData<CompanionChannelsPluginType>,
|
||||
userId: string,
|
||||
voiceChannel?: VoiceChannel,
|
||||
voiceChannel: VoiceChannel | null,
|
||||
oldChannel?: VoiceChannel,
|
||||
) {
|
||||
if (pluginData.state.errorCooldownManager.isOnCooldown(ERROR_COOLDOWN_KEY)) {
|
||||
|
@ -65,7 +65,7 @@ export async function handleCompanionPermissions(
|
|||
for (const channelId of permsToDelete) {
|
||||
const channel = pluginData.guild.channels.get(channelId);
|
||||
if (!channel || !(channel instanceof TextChannel)) continue;
|
||||
await channel.deletePermission(userId, `Companion Channel for ${oldChannel.id} | User Left`);
|
||||
await channel.deletePermission(userId, `Companion Channel for ${oldChannel!.id} | User Left`);
|
||||
}
|
||||
|
||||
for (const [channelId, permissions] of permsToSet) {
|
||||
|
@ -76,7 +76,7 @@ export async function handleCompanionPermissions(
|
|||
permissions,
|
||||
0,
|
||||
"member",
|
||||
`Companion Channel for ${voiceChannel.id} | User Joined`,
|
||||
`Companion Channel for ${voiceChannel!.id} | User Joined`,
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue