Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePhoDit committed Sep 28, 2021
2 parents b78ea52 + 3b811f2 commit d7ff850
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/commands/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@ export default new Command('delete', async (caller, cmd, log) => {
if (!message || message.type !== 'STAFF_REPLY')
return caller.utils.discord.createMessage(cmd.channel.id, 'The message could not be found.');

caller.db.editMessage(log!, message.id, '[DELETED] ' + message.content);

const userMsg = await caller.utils.discord.fetchMessage(log!.recipient.id, message.complementaryID!, true);
if (!userMsg || !userMsg.embeds[0])
return caller.utils.discord.createMessage(cmd.channel.id, 'The message could not be found.');

// Delete the user message.
userMsg.delete()
.catch(() => {
return caller.utils.discord.createMessage(cmd.channel.id, 'The message could not be deleted.');
return caller.utils.discord.createMessage(cmd.channel.id, 'The message could not be deleted for the user.');
});

caller.db.editMessage(log!, message.id, '[DELETED] ' + message.content);

guildMsg.embeds[0].description = '[DELETED] ' + guildMsg.embeds[0].description;
guildMsg.embeds[0].footer ? guildMsg.embeds[0].footer.text = 'Deleted' : guildMsg.embeds[0].footer = { text: 'Deleted' };
guildMsg.edit({ embed: guildMsg.embeds[0] })
.catch(() => {
return caller.utils.discord.createMessage(cmd.channel.id, 'The message could not be deleted.');
return caller.utils.discord.createMessage(cmd.channel.id, 'The message could not be deleted in this channel.');
});
caller.utils.discord.createMessage(cmd.channel.id, 'The message has been deleted.');
},
Expand Down
8 changes: 4 additions & 4 deletions src/commands/edit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ export default new Command('edit', async (caller, cmd, log) => {
if (!message || message.type !== 'STAFF_REPLY')
return caller.utils.discord.createMessage(cmd.channel.id, 'The message could not be found.');

caller.db.editMessage(log!, message.id, cmd.args.slice(1).join(' '));

const userMsg = await caller.utils.discord.fetchMessage(log!.recipient.id, message.complementaryID!, true);
if (!userMsg || !userMsg.embeds[0])
return caller.utils.discord.createMessage(cmd.channel.id, 'The message could not be found.');
Expand All @@ -24,14 +22,16 @@ export default new Command('edit', async (caller, cmd, log) => {
userMsg.embeds[0].description = cmd.args.slice(1).join(' ');
userMsg.edit({ embed: userMsg.embeds[0] })
.catch(() => {
return caller.utils.discord.createMessage(cmd.channel.id, 'The message could not be edited.');
return caller.utils.discord.createMessage(cmd.channel.id, 'The message could not be edited for the user.');
});

caller.db.editMessage(log!, message.id, cmd.args.slice(1).join(' '));

guildMsg.embeds[0].description = cmd.args.slice(1).join(' ');
guildMsg.embeds[0].footer ? guildMsg.embeds[0].footer.text = 'Edited' : guildMsg.embeds[0].footer = { text: 'Edited' };
guildMsg.edit({ embed: guildMsg.embeds[0] })
.catch(() => {
return caller.utils.discord.createMessage(cmd.channel.id, 'The message could not be edited.');
return caller.utils.discord.createMessage(cmd.channel.id, 'The message could not be edited in this channel.');
});
caller.utils.discord.createMessage(cmd.channel.id, 'The message has been edited.');
},
Expand Down

0 comments on commit d7ff850

Please sign in to comment.