mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
Fix error if the bot attempts to save a message that was already saved
This commit is contained in:
parent
a48a58bd3c
commit
1e549ef2a3
1 changed files with 3 additions and 0 deletions
|
@ -147,6 +147,9 @@ export class GuildSavedMessages extends BaseGuildRepository {
|
||||||
}
|
}
|
||||||
|
|
||||||
async createFromMsg(msg: Message, overrides = {}) {
|
async createFromMsg(msg: Message, overrides = {}) {
|
||||||
|
const existingSavedMsg = await this.find(msg.id);
|
||||||
|
if (existingSavedMsg) return;
|
||||||
|
|
||||||
const savedMessageData = this.msgToSavedMessageData(msg);
|
const savedMessageData = this.msgToSavedMessageData(msg);
|
||||||
const postedAt = moment.utc(msg.timestamp, "x").format("YYYY-MM-DD HH:mm:ss.SSS");
|
const postedAt = moment.utc(msg.timestamp, "x").format("YYYY-MM-DD HH:mm:ss.SSS");
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue