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:
parent
690955a399
commit
629002b8d9
172 changed files with 720 additions and 534 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue