mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-18 15:00:00 +00:00
Add optional 'expanded' param to !cases
This commit is contained in:
parent
2aaacef2c3
commit
9769e38f17
1 changed files with 29 additions and 21 deletions
|
@ -691,9 +691,9 @@ export class ModActionsPlugin extends Plugin {
|
||||||
this.displayCase(theCase.id, msg.channel.id);
|
this.displayCase(theCase.id, msg.channel.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@d.command(/cases|usercases/, "<userId:userId>")
|
@d.command(/cases|usercases/, "<userId:userId> [expanded:string]")
|
||||||
@d.permission("view")
|
@d.permission("view")
|
||||||
async usercasesCmd(msg: Message, args: { userId: string }) {
|
async usercasesCmd(msg: Message, args: { userId: string; expanded?: string }) {
|
||||||
const cases = await this.cases.getByUserId(args.userId);
|
const cases = await this.cases.getByUserId(args.userId);
|
||||||
const user = this.bot.users.get(args.userId);
|
const user = this.bot.users.get(args.userId);
|
||||||
const userName = user ? `${user.username}#${user.discriminator}` : "Unknown#0000";
|
const userName = user ? `${user.username}#${user.discriminator}` : "Unknown#0000";
|
||||||
|
@ -702,6 +702,13 @@ export class ModActionsPlugin extends Plugin {
|
||||||
if (cases.length === 0) {
|
if (cases.length === 0) {
|
||||||
msg.channel.createMessage("No cases found for the specified user!");
|
msg.channel.createMessage("No cases found for the specified user!");
|
||||||
} else {
|
} else {
|
||||||
|
if (args.expanded === "expanded") {
|
||||||
|
// Expanded view (= individual case embeds)
|
||||||
|
for (const theCase of cases) {
|
||||||
|
await this.displayCase(theCase.id, msg.channel.id);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Compact view (= regular message with a preview of each case)
|
||||||
const lines = [];
|
const lines = [];
|
||||||
for (const theCase of cases) {
|
for (const theCase of cases) {
|
||||||
const firstNote = await this.cases.findFirstCaseNote(theCase.id);
|
const firstNote = await this.cases.findFirstCaseNote(theCase.id);
|
||||||
|
@ -733,6 +740,7 @@ export class ModActionsPlugin extends Plugin {
|
||||||
msg.channel.createMessage(finalMessage);
|
msg.channel.createMessage(finalMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected canActOn(member1, member2) {
|
protected canActOn(member1, member2) {
|
||||||
if (member1.id === member2.id) {
|
if (member1.id === member2.id) {
|
||||||
|
@ -838,7 +846,7 @@ export class ModActionsPlugin extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
const channel = this.guild.channels.get(channelId) as TextChannel;
|
const channel = this.guild.channels.get(channelId) as TextChannel;
|
||||||
channel.createMessage({ embed });
|
await channel.createMessage({ embed });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue