Skip to content

Commit aab948d

Browse files
committed
Remove CopyPrevious command
1 parent 02782eb commit aab948d

3 files changed

Lines changed: 0 additions & 29 deletions

File tree

commands.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
## Copy
3434
| Commands | Arguments | Description |
3535
| -------------- | --------------------------------- | ------------------------------------------------------- |
36-
| CopyPrevious | Embed Name, (Channel) | Copy the previous embed in the target channel. |
3736
| CopyTarget | Embed Name, (Channel), Message ID | Copy an embed by its message ID. |
3837
| UpdateOriginal | <none> | Update the original embed this content was copied from. |
3938
| UpdateTarget | (Channel), Message ID | Replace the target message embed with the loaded embed. |

src/main/kotlin/io/github/jakejmattson/embedbot/commands/CopyCommands.kt

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -42,33 +42,6 @@ fun copyCommands(embedService: EmbedService) = commands {
4242
}
4343
}
4444

45-
command("CopyPrevious") {
46-
description = messages.descriptions.COPY_PREVIOUS
47-
expect(arg(WordArg("Embed Name")),
48-
arg(TextChannelArg("Channel"), optional = true, default = { it.channel }))
49-
execute { event ->
50-
val name = event.args.component1() as String
51-
val channel = event.args.component2() as TextChannel
52-
val guild = event.guild!!
53-
val limit = 50
54-
55-
if (guild.hasEmbedWithName(name))
56-
return@execute event.respond(messages.errors.EMBED_ALREADY_EXISTS)
57-
58-
val previousMessages = channel.getHistoryBefore(event.message.id, limit).complete().retrievedHistory
59-
60-
val previousEmbedMessage = previousMessages.firstOrNull { it.getEmbed() != null }
61-
?: return@execute event.respond("No embeds found in the previous $limit messages.")
62-
63-
val builder = previousEmbedMessage.getEmbed()!!.toEmbedBuilder()
64-
val previousEmbed = Embed(name, builder, CopyLocation(channel.id, previousEmbedMessage.id))
65-
66-
embedService.addEmbed(guild, previousEmbed)
67-
68-
event.reactSuccess()
69-
}
70-
}
71-
7245
command("UpdateOriginal") {
7346
description = messages.descriptions.UPDATE_ORIGINAL
7447
requiresLoadedEmbed = true

src/main/kotlin/io/github/jakejmattson/embedbot/locale/Messages.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ class Descriptions(
3232
val SEND: String = "Send the currently loaded embed.",
3333

3434
//Copy
35-
val COPY_PREVIOUS: String = "Copy the previous embed in the target channel.",
3635
val COPY_TARGET: String = "Copy an embed by its message ID.",
3736
val UPDATE_ORIGINAL: String = "Update the original embed this content was copied from.",
3837
val UPDATE_TARGET: String = "Replace the target message embed with the loaded embed.",

0 commit comments

Comments
 (0)