-
Notifications
You must be signed in to change notification settings - Fork 314
Create Custom Listener
AstroX10 edited this page Dec 28, 2024
·
1 revision
These event handlers manage Xstro's operations while the client is active. They efficiently handle various tasks without causing lag or slowing down the bot's performance. Xstro executes all events using Promise-based operations, ensuring each task runs seamlessly without introducing latency or waiting for other tasks to complete. This approach optimizes execution and maintains smooth bot functionality.
-
Navigate to the
bot
folder in the root directory.- Create a new file, e.g.,
foo.js
, and add the following code:
export async function Foo(msg) { if (msg.isGroup) return msg.send('Hey, this is a group, wow!'); }
- Create a new file, e.g.,
-
Go to the
lib
folder and open theevents.js
file.- Scroll down to find the
upserts
function. - Inside this function, locate the
tasks.push()
block. - Import the
Foo
function and include it in thetasks.push()
block.
- Scroll down to find the
-
Run your bot.
- When the bot receives a message in a group, it will always send a response saying, "Hey, this is a group, wow!"
By AstroX11