From bcc01dbcd496950ffb73cad57b933e4f0097cf94 Mon Sep 17 00:00:00 2001 From: Veit Progl Date: Sat, 22 Nov 2025 10:09:59 +0100 Subject: [PATCH] add jumprope2 -> jumprope as animated emoji reaction --- .../Reaction Commands/AnimatedEmojiCommand.swift | 14 ++++++++++++++ .../Command/Reaction Commands/This.swift | 10 ---------- Sources/SwiftDEBot/Commands.swift | 2 +- 3 files changed, 15 insertions(+), 11 deletions(-) create mode 100644 Sources/SwiftDEBot/Command/Reaction Commands/AnimatedEmojiCommand.swift delete mode 100644 Sources/SwiftDEBot/Command/Reaction Commands/This.swift diff --git a/Sources/SwiftDEBot/Command/Reaction Commands/AnimatedEmojiCommand.swift b/Sources/SwiftDEBot/Command/Reaction Commands/AnimatedEmojiCommand.swift new file mode 100644 index 0000000..10a48c6 --- /dev/null +++ b/Sources/SwiftDEBot/Command/Reaction Commands/AnimatedEmojiCommand.swift @@ -0,0 +1,14 @@ +import DiscordBM + +struct AnimatedEmojiCommand: ReactionCommand { + func run(client: DiscordClient, reaction: Gateway.MessageReactionAdd) async throws { + let emojiDict: [String: Reaction] = [ + "this2": .guildEmoji(name: "this", id: "785804431597240351"), + "jumprope2": .guildEmoji(name: "jumprope", id: "1441710287257604198"), + ] + + for (name, reactionEmoji) in emojiDict where name == reaction.emoji.name { + try await client.addReaction(reactionEmoji, to: reaction.message_id, in: reaction.channel_id) + } + } +} diff --git a/Sources/SwiftDEBot/Command/Reaction Commands/This.swift b/Sources/SwiftDEBot/Command/Reaction Commands/This.swift deleted file mode 100644 index 7185009..0000000 --- a/Sources/SwiftDEBot/Command/Reaction Commands/This.swift +++ /dev/null @@ -1,10 +0,0 @@ -import DiscordBM - -struct ThisCommand: ReactionCommand { - func run(client: DiscordClient, reaction: Gateway.MessageReactionAdd) async throws { - guard reaction.emoji.name == "this2" else { return } - // "a:this:785804431597240351" - try await client.addReaction( - .guildEmoji(name: "this", id: "785804431597240351"), to: reaction.message_id, in: reaction.channel_id) - } -} diff --git a/Sources/SwiftDEBot/Commands.swift b/Sources/SwiftDEBot/Commands.swift index d7bf2dd..e26ec66 100644 --- a/Sources/SwiftDEBot/Commands.swift +++ b/Sources/SwiftDEBot/Commands.swift @@ -17,5 +17,5 @@ let messageCommands: [MessageCommand] = [ ] let reactionCommands: [ReactionCommand] = [ - ThisCommand() + AnimatedEmojiCommand() ]