mirror of
https://github.com/RPCS3/discord-bot.git
synced 2024-11-23 10:19:39 +00:00
Slash command test.
This commit is contained in:
parent
c7a61fb0c0
commit
81c0e0d364
37
CompatBot/Commands/SlashTest.cs
Normal file
37
CompatBot/Commands/SlashTest.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using CompatBot.Utils;
|
||||
using DSharpPlus;
|
||||
using DSharpPlus.Entities;
|
||||
using DSharpPlus.SlashCommands;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CompatBot.Commands
|
||||
{
|
||||
internal sealed class SlashTest: ApplicationCommandModule
|
||||
{
|
||||
[SlashCommand("credits", "Author Credit")]
|
||||
// TODO [Aliases("about")]
|
||||
public async Task About(InteractionContext ctx)
|
||||
{
|
||||
var hcorion = ctx.Client.GetEmoji(":hcorion:", DiscordEmoji.FromUnicode("🍁"));
|
||||
var clienthax = ctx.Client.GetEmoji(":gooseknife:", DiscordEmoji.FromUnicode("🐱"));
|
||||
var embed = new DiscordEmbedBuilder
|
||||
{
|
||||
Title = "RPCS3 Compatibility Bot",
|
||||
Url = "https://github.com/RPCS3/discord-bot",
|
||||
Color = DiscordColor.Purple,
|
||||
}.AddField("Made by",
|
||||
"💮 13xforever\n" +
|
||||
"🇭🇷 Roberto Anić Banić aka nicba1010\n" +
|
||||
$"{clienthax} clienthax\n"
|
||||
)
|
||||
.AddField("People who ~~broke~~ helped test the bot",
|
||||
"🐱 Juhn\n" +
|
||||
$"{hcorion} hcorion\n" +
|
||||
"🙃 TGE\n" +
|
||||
"🍒 Maru\n" +
|
||||
"♋ Tourghool");
|
||||
await ctx.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, new DiscordInteractionResponseBuilder().AddEmbed(embed.Build()));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -19,6 +19,7 @@ using DSharpPlus.CommandsNext;
|
||||
using DSharpPlus.Entities;
|
||||
using DSharpPlus.Interactivity;
|
||||
using DSharpPlus.Interactivity.Extensions;
|
||||
using DSharpPlus.SlashCommands;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration.UserSecrets;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
@ -142,6 +143,9 @@ namespace CompatBot
|
||||
Intents = DiscordIntents.All,
|
||||
};
|
||||
using var client = new DiscordClient(config);
|
||||
var slashCommands = client.UseSlashCommands();
|
||||
slashCommands.RegisterCommands<SlashTest>();
|
||||
|
||||
var commands = client.UseCommandsNext(new()
|
||||
{
|
||||
StringPrefixes = new[] {Config.CommandPrefix, Config.AutoRemoveCommandPrefix},
|
||||
|
Loading…
Reference in New Issue
Block a user