-
Notifications
You must be signed in to change notification settings - Fork 0
Examples
FoxWorn3365 edited this page Sep 7, 2024
·
2 revisions
Here you can find some useful examples so you can "inspire" youself
Important
We actually uses the "class implementation": the bot is inside a class
internal class Bot
{
private Client DiscordClient { get; }
public Bot()
{
DiscordClient = new(new()
{
LoadAppInfo = true,
Debug = true,
RegisterCommands = RegisterCommandType.CreateAndEdit
});
DiscordClient.EventHandler.RegisterEvents(this);
}
[SocketEvent("READY")]
public void OnReady()
{
DiscordClient.Presence = new([new("FoxWorn3365 is a furry", 0)], "dnd");
}
[SocketEvent("MESSAGE_CREATE")]
public static void OnMessage(MessageCreate message)
{
message.Message.React(new(null, "🖕"));
}
public async Task Connect()
{
await DiscordClient.LoginAsync("ok the token here", Gateway.allIntents);
}
} internal class Bot
{
private Client DiscordClient { get; }
public Bot()
{
DiscordClient = new(new()
{
LoadAppInfo = true,
Debug = true,
RegisterCommands = RegisterCommandType.CreateAndEdit
});
DiscordClient.EventHandler.RegisterEvents(this);
}
[SocketEvent("READY")]
public void OnReady()
{
DiscordClient.Presence = new([new("FoxWorn3365 is a furry", 0)], "dnd");
}
[SocketEvent("MESSAGE_CREATE")]
public async static void OnMessage(MessageCreate message)
{
if (message.Message.Content is "Fox is a furry")
{
await message.Message.Reply("ur right");
GuildThreadChannel ch = new(await message.Message.StartThread(new("Yeah you're right, let's talk about it!")));
ch?.SendMessage("I love Fox!");
}
}
public async Task Connect()
{
await DiscordClient.LoginAsync("Don't want to give u my bot token uwu", Gateway.allIntents);
}
}If you still need more help you can reach us through our Official Discord server!