1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-04-20 00:43:36 +03:00

Mention the event notification role when an event is created

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
Octol1ttle 2023-05-31 16:52:33 +05:00
parent 0bee68af8a
commit b89e557e48
Signed by: Octol1ttle
GPG key ID: B77C34313AEE1FFF

View file

@ -320,6 +320,10 @@ public class GuildScheduledEventCreateResponder : IResponder<IGuildScheduledEven
.Build(); .Build();
if (!embed.IsDefined(out var built)) return Result.FromError(embed); if (!embed.IsDefined(out var built)) return Result.FromError(embed);
var roleMention = guildConfiguration.EventNotificationRole is not 0
? Mention.Role(guildConfiguration.EventNotificationRole.ToDiscordSnowflake())
: string.Empty;
var button = new ButtonComponent( var button = new ButtonComponent(
ButtonComponentStyle.Primary, ButtonComponentStyle.Primary,
Messages.EventDetailsButton, Messages.EventDetailsButton,
@ -329,7 +333,7 @@ public class GuildScheduledEventCreateResponder : IResponder<IGuildScheduledEven
); );
return (Result)await _channelApi.CreateMessageAsync( return (Result)await _channelApi.CreateMessageAsync(
guildConfiguration.EventNotificationChannel.ToDiscordSnowflake(), embeds: new[] { built }, guildConfiguration.EventNotificationChannel.ToDiscordSnowflake(), roleMention, embeds: new[] { built },
components: new[] { new ActionRowComponent(new[] { button }) }, ct: ct); components: new[] { new ActionRowComponent(new[] { button }) }, ct: ct);
} }
} }