Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tweak: remind view now uses embed description in place of fields #69

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 9 additions & 15 deletions src/commands/Productivity/remind.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SteveCommand } from '@lib/structures/commands/SteveCommand';
import { CommandOptions, KlasaMessage, RichDisplay } from 'klasa';
import { ColorResolvable, EmbedField, Message, MessageEmbed, TextChannel } from 'discord.js';
import { ColorResolvable, Message, MessageEmbed, TextChannel } from 'discord.js';
import { GuildSettings } from '@lib/types/settings/GuildSettings';
import { Reminder } from '@root/src/extendables/Schedule';
import { UserSettings } from '@lib/types/settings/UserSettings';
Expand Down Expand Up @@ -64,18 +64,15 @@ export default class extends SteveCommand {
const display = new RichDisplay(this.buildViewEmbed(msg));

for (const page of chunk(reminders, 5)) {
const fields: EmbedField[] = [];
let content = '';

for (let i = 0; i < page.length; i++) {
const displayMessage = await this.getReminderDisplayContent(msg, page[i]);
fields.push({
name: `**${reminders.indexOf(page[i]) + 1}: ${displayMessage}**`,
value: embedData.fieldValues(this.getTimeUntilRemind(page[i])),
inline: false
});
content += `**${reminders.indexOf(page[i]) + 1}: ${displayMessage}**\n${
embedData.description(this.getTimeUntilRemind(page[i]))}\n\n`;
}

display.addPage((template: MessageEmbed) => template.addFields(fields));
display.addPage((template: MessageEmbed) => template.setDescription(content));
}

await display.run(response);
Expand All @@ -85,18 +82,15 @@ export default class extends SteveCommand {
const embeds: MessageEmbed[] = [];

for (const page of chunk(reminders, 25)) {
const fields: EmbedField[] = [];
let content = '';

for (let i = 0; i < page.length; i++) {
const displayMessage = await this.getReminderDisplayContent(msg, page[i]);
fields.push({
name: `**${reminders.indexOf(page[i]) + 1}: ${displayMessage}**`,
value: embedData.fieldValues(this.getTimeUntilRemind(page[i])),
inline: false
});
content += `**${reminders.indexOf(page[i]) + 1}: ${displayMessage}**\n${
embedData.description(this.getTimeUntilRemind(page[i]))}\n\n`;
}

embeds.push(this.buildViewEmbed(msg).addFields(fields));
embeds.push(this.buildViewEmbed(msg).setDescription(content));
}
embeds.reverse();

Expand Down
2 changes: 1 addition & 1 deletion src/languages/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ export default class extends Language {
commandReminderDisplayHidden: 'Private reminder: content hidden',
commandRemindViewEmbed: {
title: 'Pending Reminders',
fieldValues: time => `${time} left!`
description: time => `${time} left!`
},
/**
* ################################
Expand Down
2 changes: 1 addition & 1 deletion src/lib/types/Languages.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ declare module 'klasa' {
commandReminderDisplayHidden: string;
commandRemindViewEmbed: {
title: string;
fieldValues: (time: string) => string;
description: (time: string) => string;
};
commandPomodoroDescription: string;
commandPomodoroExtended: string;
Expand Down