Signal
Signals in Sunar correspond to events in discord.js. They allow you to handle various actions and responses that occur within your Discord bot, such as messages being sent, users joining or leaving, and more.
Usage
import { Signal, Signals, execute } from 'sunar';
const signal = new Signal(Signals.GuildMemberAdd);
execute(signal, (message) => {
// handle execution
});
export { signal };Implementation
The following example demonstrates how to implement a Signal using Sunar:
import { Signal, Signals, execute } from 'sunar';
import { TextChannel } from 'discord.js';
const signal = new Signal(Signals.GuildMemberAdd);
execute(signal, (member) => {
const channel = member.guild.channels.cache.find(
(c) => c.name === 'welcomes',
);
if (!(channel instanceof TextChannel)) return;
channel.send({ content: `${member} just joined!` });
});
export { signal };Reference
SignalOptions
Prop
Type
Sunar Signals
Prop
Type
Find all available events in the discord.js documentation.
How is this guide?
Last updated on
SelectMenu
Select menus allow users to choose from a list of options. They are useful for forms, surveys, or any scenario where the user needs to make a selection from multiple choices.
Slash
Slash commands are one of the primary ways users interact with bots. They provide a structured way for users to issue commands directly within the chat interface.