mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-23 17:45:03 +00:00
Reply to originally invoking message for reminders
We only do this if we have a reminder body, otherwise we would link to the original message twice.
This commit is contained in:
parent
fb44a6558f
commit
39264d7d12
4 changed files with 24 additions and 1 deletions
|
@ -38,7 +38,7 @@ export class GuildReminders extends BaseGuildRepository {
|
|||
});
|
||||
}
|
||||
|
||||
async add(userId: string, channelId: string, remindAt: string, body: string, created_at: string) {
|
||||
async add(userId: string, channelId: string, remindAt: string, body: string, created_at: string, source_id?: string) {
|
||||
const result = await this.reminders.insert({
|
||||
guild_id: this.guildId,
|
||||
user_id: userId,
|
||||
|
@ -46,6 +46,7 @@ export class GuildReminders extends BaseGuildRepository {
|
|||
remind_at: remindAt,
|
||||
body,
|
||||
created_at,
|
||||
source_message_id: source_id,
|
||||
});
|
||||
|
||||
return (await this.find(result.identifiers[0].id))!;
|
||||
|
|
|
@ -16,4 +16,6 @@ export class Reminder {
|
|||
@Column() body: string;
|
||||
|
||||
@Column() created_at: string;
|
||||
|
||||
@Column() source_message_id: string;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
import { MigrationInterface, QueryRunner, TableColumn } from "typeorm";
|
||||
|
||||
export class AddSourceMessageIdToReminders1631494429170 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.addColumns("reminders", [
|
||||
new TableColumn({
|
||||
name: "source_message_id",
|
||||
type: "bigint",
|
||||
isNullable: true,
|
||||
default: null,
|
||||
unsigned: true,
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.dropColumn("reminders", "source_message_id");
|
||||
}
|
||||
}
|
|
@ -57,6 +57,7 @@ export const RemindCmd = remindersCmd({
|
|||
reminderTime.clone().tz("Etc/UTC").format("YYYY-MM-DD HH:mm:ss"),
|
||||
reminderBody,
|
||||
moment.utc().format("YYYY-MM-DD HH:mm:ss"),
|
||||
args.reminder ? msg.id : undefined,
|
||||
);
|
||||
|
||||
registerUpcomingReminder(reminder);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue