-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1038 from discord-csharp/channel-designations-ref…
…actor V3: Refactor channel designations, add relay service
- Loading branch information
Showing
23 changed files
with
406 additions
and
1,278 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
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
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,25 @@ | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Discord; | ||
using Discord.WebSocket; | ||
using MediatR; | ||
using Modix.Services; | ||
|
||
namespace Modix.Bot.Handlers; | ||
|
||
public class SendMessageHandler(DiscordSocketClient discordSocketClient) | ||
: IRequestHandler<SendMessageInDiscordRequest, bool> | ||
{ | ||
public async Task<bool> Handle(SendMessageInDiscordRequest request, CancellationToken cancellationToken) | ||
{ | ||
var channel = await discordSocketClient.GetChannelAsync(request.ChannelId); | ||
|
||
if (channel is ITextChannel textChannel) | ||
{ | ||
await textChannel.SendMessageAsync(request.Message, false, request.Embed, allowedMentions: AllowedMentions.None); | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
} |
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
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
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
Oops, something went wrong.