3
0
Fork 0
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:
Dark 2021-09-13 03:09:06 +02:00
parent fb44a6558f
commit 39264d7d12
No known key found for this signature in database
GPG key ID: 384C4B4F5B1E25A8
4 changed files with 24 additions and 1 deletions

View file

@ -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))!;

View file

@ -16,4 +16,6 @@ export class Reminder {
@Column() body: string;
@Column() created_at: string;
@Column() source_message_id: string;
}

View file

@ -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");
}
}

View file

@ -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);