Run prettier and check tslint on entire codebase

Mainly to run these checks for the recent pull requests.
This commit is contained in:
Dragory 2020-01-12 11:47:54 +02:00
parent 65880d2e60
commit 1aceb55a87
15 changed files with 89 additions and 60 deletions

View file

@ -70,19 +70,18 @@ export class RemindersPlugin extends ZeppelinPlugin<TConfigSchema> {
const channel = this.guild.channels.get(reminder.channel_id);
if (channel && channel instanceof TextChannel) {
try {
//Only show created at date if one exists
if(moment(reminder.created_at).isValid()){
// Only show created at date if one exists
if (moment(reminder.created_at).isValid()) {
const target = moment();
const diff = target.diff(moment(reminder.created_at , "YYYY-MM-DD HH:mm:ss"));
const result = humanizeDuration(diff, { largest: 2, round: true });
const diff = target.diff(moment(reminder.created_at, "YYYY-MM-DD HH:mm:ss"));
const result = humanizeDuration(diff, { largest: 2, round: true });
await channel.createMessage(
disableLinkPreviews(`Reminder for <@!${reminder.user_id}>: ${reminder.body} \n\`Set at ${reminder.created_at} (${result} ago)\``),
);
}
else{
await channel.createMessage(
disableLinkPreviews(`Reminder for <@!${reminder.user_id}>: ${reminder.body}`),
disableLinkPreviews(
`Reminder for <@!${reminder.user_id}>: ${reminder.body} \n\`Set at ${reminder.created_at} (${result} ago)\``,
),
);
} else {
await channel.createMessage(disableLinkPreviews(`Reminder for <@!${reminder.user_id}>: ${reminder.body}`));
}
} catch (e) {
// Probably random Discord internal server error or missing permissions or somesuch
@ -138,7 +137,13 @@ export class RemindersPlugin extends ZeppelinPlugin<TConfigSchema> {
}
const reminderBody = args.reminder || `https://discordapp.com/channels/${this.guildId}/${msg.channel.id}/${msg.id}`;
await this.reminders.add(msg.author.id, msg.channel.id, reminderTime.format("YYYY-MM-DD HH:mm:ss"), reminderBody, moment().format("YYYY-MM-DD HH:mm:ss"));
await this.reminders.add(
msg.author.id,
msg.channel.id,
reminderTime.format("YYYY-MM-DD HH:mm:ss"),
reminderBody,
moment().format("YYYY-MM-DD HH:mm:ss"),
);
const msUntilReminder = reminderTime.diff(now);
const timeUntilReminder = humanizeDuration(msUntilReminder, { largest: 2, round: true });
@ -163,7 +168,7 @@ export class RemindersPlugin extends ZeppelinPlugin<TConfigSchema> {
const lines = Array.from(reminders.entries()).map(([i, reminder]) => {
const num = i + 1;
const paddedNum = num.toString().padStart(longestNum, " ");
const target = moment(reminder.remind_at , "YYYY-MM-DD HH:mm:ss");
const target = moment(reminder.remind_at, "YYYY-MM-DD HH:mm:ss");
const diff = target.diff(moment());
const result = humanizeDuration(diff, { largest: 2, round: true });
return `\`${paddedNum}.\` \`${reminder.remind_at} (${result})\` ${reminder.body}`;