Skip to content

Commit

Permalink
Merge branch 'release/2.1.1' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverbooth committed Nov 4, 2023
2 parents 9ffb608 + e5aed17 commit f525288
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
18 changes: 15 additions & 3 deletions Marco/Commands/MacroCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using DSharpPlus.SlashCommands;
using DSharpPlus.Entities;
using DSharpPlus.SlashCommands;
using DSharpPlus.SlashCommands.Attributes;
using Marco.AutocompleteProviders;
using Marco.Data;
Expand All @@ -22,7 +23,8 @@ public MacroCommand(MacroService macroService)
[SlashCommand("macro", "Executes a macro.")]
[SlashRequireGuild]
public async Task MacroAsync(InteractionContext context,
[Option("macro", "The name of the macro.", true)] [Autocomplete(typeof(MacroAutocompleteProvider))] string macroName)
[Option("macro", "The name of the macro.", true)] [Autocomplete(typeof(MacroAutocompleteProvider))]
string macroName)
{
if (!_macroService.TryGetMacro(context.Guild, macroName, out Macro? macro))
{
Expand All @@ -36,6 +38,16 @@ public async Task MacroAsync(InteractionContext context,
return;
}

await context.CreateResponseAsync(macro.Response).ConfigureAwait(false);
var builder = new DiscordInteractionResponseBuilder();
string response = macro.Response;

if (response.StartsWith("@silent "))
{
response = response[8..];
builder.SuppressNotifications();
}

builder.WithContent(response);
await context.CreateResponseAsync(builder).ConfigureAwait(false);
}
}
2 changes: 1 addition & 1 deletion Marco/Marco.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<VersionPrefix>2.1.0</VersionPrefix>
<VersionPrefix>2.1.1</VersionPrefix>
</PropertyGroup>

<PropertyGroup Condition="'$(VersionSuffix)' != '' And '$(BuildNumber)' == ''">
Expand Down
13 changes: 12 additions & 1 deletion Marco/Services/MacroListeningService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,18 @@ private async Task OnMessageCreated(DiscordClient sender, MessageCreateEventArgs
guild,
user = (DiscordMember) e.Message.Author
});*/
await channel.SendMessageAsync(macro.Response).ConfigureAwait(false);

var builder = new DiscordMessageBuilder();
string response = macro.Response;

if (response.StartsWith("@silent "))
{
response = response[8..];
builder.SuppressNotifications();
}

builder.WithContent(response);
await channel.SendMessageAsync(builder).ConfigureAwait(false);
}
}
else
Expand Down

0 comments on commit f525288

Please sign in to comment.