Turn on strict TS compilation. Fix up and tweak types accordingly.

This commit is contained in:
Dragory 2020-11-09 20:03:57 +02:00
parent 690955a399
commit 629002b8d9
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
172 changed files with 720 additions and 534 deletions

View file

@ -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) {