3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-10 12:25:02 +00:00

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

@ -11,13 +11,13 @@ import { logger } from "../../../logger";
export async function postToCaseLogChannel(
pluginData: GuildPluginData<CasesPluginType>,
content: MessageContent,
file: MessageFile = null,
file?: MessageFile,
): Promise<Message | null> {
const caseLogChannelId = pluginData.config.get().case_log_channel;
if (!caseLogChannelId) return;
if (!caseLogChannelId) return null;
const caseLogChannel = pluginData.guild.channels.get(caseLogChannelId);
if (!caseLogChannel || !(caseLogChannel instanceof TextChannel)) return;
if (!caseLogChannel || !(caseLogChannel instanceof TextChannel)) return null;
let result;
try {
@ -30,7 +30,7 @@ export async function postToCaseLogChannel(
pluginData.state.logs.log(LogType.BOT_ALERT, {
body: `Missing permissions to post mod cases in <#${caseLogChannel.id}>`,
});
return;
return null;
}
throw e;
@ -44,17 +44,17 @@ export async function postCaseToCaseLogChannel(
caseOrCaseId: Case | number,
): Promise<Message | null> {
const theCase = await pluginData.state.cases.find(resolveCaseId(caseOrCaseId));
if (!theCase) return;
if (!theCase) return null;
const caseEmbed = await getCaseEmbed(pluginData, caseOrCaseId);
if (!caseEmbed) return;
if (!caseEmbed) return null;
if (theCase.log_message_id) {
const [channelId, messageId] = theCase.log_message_id.split("-");
try {
await pluginData.client.editMessage(channelId, messageId, caseEmbed);
return;
return null;
} catch (e) {} // tslint:disable-line:no-empty
}