mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 20:35:02 +00:00
Run prettier and check tslint on entire codebase
Mainly to run these checks for the recent pull requests.
This commit is contained in:
parent
65880d2e60
commit
1aceb55a87
15 changed files with 89 additions and 60 deletions
|
@ -125,7 +125,10 @@ export class MessageSaverPlugin extends ZeppelinPlugin<TConfigSchema> {
|
|||
await msg.channel.createMessage(`Saving pins from <#${args.channel.id}>...`);
|
||||
|
||||
const pins = await args.channel.getPins();
|
||||
const { savedCount, failed } = await this.saveMessagesToDB(args.channel, pins.map(m => m.id));
|
||||
const { savedCount, failed } = await this.saveMessagesToDB(
|
||||
args.channel,
|
||||
pins.map(m => m.id),
|
||||
);
|
||||
|
||||
if (failed.length) {
|
||||
msg.channel.createMessage(
|
||||
|
|
|
@ -197,7 +197,10 @@ export class ModActionsPlugin extends ZeppelinPlugin<TConfigSchema> {
|
|||
}
|
||||
|
||||
clearIgnoredEvent(type: IgnoredEventType, userId: any) {
|
||||
this.ignoredEvents.splice(this.ignoredEvents.findIndex(info => type === info.type && userId === info.userId), 1);
|
||||
this.ignoredEvents.splice(
|
||||
this.ignoredEvents.findIndex(info => type === info.type && userId === info.userId),
|
||||
1,
|
||||
);
|
||||
}
|
||||
|
||||
formatReasonWithAttachments(reason: string, attachments: Attachment[]) {
|
||||
|
|
|
@ -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}`;
|
||||
|
|
|
@ -797,11 +797,11 @@ export class UtilityPlugin extends ZeppelinPlugin<TConfigSchema> {
|
|||
name: "compact",
|
||||
shortcut: "c",
|
||||
isSwitch: true,
|
||||
}
|
||||
]
|
||||
},
|
||||
],
|
||||
})
|
||||
@d.permission("can_info")
|
||||
async infoCmd(msg: Message, args: { user?: User | UnknownUser, compact?: boolean }) {
|
||||
async infoCmd(msg: Message, args: { user?: User | UnknownUser; compact?: boolean }) {
|
||||
const user = args.user || msg.author;
|
||||
|
||||
let member;
|
||||
|
@ -823,22 +823,21 @@ export class UtilityPlugin extends ZeppelinPlugin<TConfigSchema> {
|
|||
embed.title = `${user.username}#${user.discriminator}`;
|
||||
embed.thumbnail = { url: user.avatarURL };
|
||||
|
||||
if(args.compact){
|
||||
if (args.compact) {
|
||||
embed.fields.push({
|
||||
name: "User information",
|
||||
value:
|
||||
trimLines(`
|
||||
value: trimLines(`
|
||||
Profile: <@!${user.id}>
|
||||
Created: **${accountAge} ago (${createdAt.format("YYYY-MM-DD[T]HH:mm:ss")})**
|
||||
`),
|
||||
});
|
||||
});
|
||||
if (member) {
|
||||
const joinedAt = moment(member.joinedAt);
|
||||
const joinAge = humanizeDuration(moment().valueOf() - member.joinedAt, {
|
||||
largest: 2,
|
||||
round: true,
|
||||
});
|
||||
embed.fields[0].value += `\nJoined: **${joinAge} ago (${joinedAt.format("YYYY-MM-DD[T]HH:mm:ss")})**`
|
||||
embed.fields[0].value += `\nJoined: **${joinAge} ago (${joinedAt.format("YYYY-MM-DD[T]HH:mm:ss")})**`;
|
||||
} else {
|
||||
embed.fields.push({
|
||||
name: "!! USER IS NOT ON THE SERVER !!",
|
||||
|
@ -847,8 +846,7 @@ export class UtilityPlugin extends ZeppelinPlugin<TConfigSchema> {
|
|||
}
|
||||
msg.channel.createMessage({ embed });
|
||||
return;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
embed.fields.push({
|
||||
name: "User information",
|
||||
value:
|
||||
|
@ -857,7 +855,7 @@ export class UtilityPlugin extends ZeppelinPlugin<TConfigSchema> {
|
|||
Profile: <@!${user.id}>
|
||||
Created: **${accountAge} ago (${createdAt.format("YYYY-MM-DD[T]HH:mm:ss")})**
|
||||
`) + embedPadding,
|
||||
});
|
||||
});
|
||||
}
|
||||
} else {
|
||||
embed.title = `Unknown user`;
|
||||
|
@ -897,7 +895,6 @@ export class UtilityPlugin extends ZeppelinPlugin<TConfigSchema> {
|
|||
name: "!! USER IS NOT ON THE SERVER !!",
|
||||
value: embedPadding,
|
||||
});
|
||||
|
||||
}
|
||||
const cases = (await this.cases.getByUserId(user.id)).filter(c => !c.is_hidden);
|
||||
|
||||
|
@ -920,7 +917,7 @@ export class UtilityPlugin extends ZeppelinPlugin<TConfigSchema> {
|
|||
`),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
msg.channel.createMessage({ embed });
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ import { LocatePlugin } from "./LocateUser";
|
|||
import { GuildConfigReloader } from "./GuildConfigReloader";
|
||||
import { ChannelArchiverPlugin } from "./ChannelArchiver";
|
||||
import { AutomodPlugin } from "./Automod";
|
||||
import { RolesPlugin} from "./Roles";
|
||||
import { RolesPlugin } from "./Roles";
|
||||
|
||||
/**
|
||||
* Plugins available to be loaded for individual guilds
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue