-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The bot can acknowledge a message by reacting with ✅ This provides the caller some feedback that the bot is indeed running, and a lack of response may be down to erroneous code
- Loading branch information
1 parent
b849d77
commit 520033c
Showing
2 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using DisCatSharp.CommandsNext; | ||
|
||
namespace Hammer.Extensions; | ||
|
||
/// <summary> | ||
/// Extension methods for <see cref="CommandContext" />. | ||
/// </summary> | ||
internal static class CommandContextExtensions | ||
{ | ||
/// <summary> | ||
/// Acknowledges the message provided by a <see cref="CommandContext" /> by reacting to it. | ||
/// </summary> | ||
/// <param name="context">The command context.</param> | ||
public static Task AcknowledgeAsync(this CommandContext context) | ||
{ | ||
return context.Message.AcknowledgeAsync(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using DisCatSharp.Entities; | ||
|
||
namespace Hammer.Extensions; | ||
|
||
/// <summary> | ||
/// Extension methods for <see cref="DiscordMessage" />. | ||
/// </summary> | ||
internal static class DiscordMessageExtensions | ||
{ | ||
/// <summary> | ||
/// Acknowledges a message by reacting to it. | ||
/// </summary> | ||
/// <param name="message">The message to acknowledge.</param> | ||
public static Task AcknowledgeAsync(this DiscordMessage message) | ||
{ | ||
return message.CreateReactionAsync(DiscordEmoji.FromUnicode("✅")); | ||
} | ||
} |