This repository was archived by the owner on Sep 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Events
Gabriel edited this page Feb 7, 2023
·
2 revisions
To listen to events, the only thing you're going to need is a client (DeckClient). Then you can just call .on<NameOfTheEventHere> and handle the event in any way you would like.
client.on<MessageCreateEvent> { // Here you are inside the MessageCreateEvent scope, so you can already handle the event
// We're making sure that whoever sent the message isn't the bot itself
if (message.authorId == client.selfId)
return@on // We're just going to return, since we won't be handling this event
message.sendReply("You said: ${message.content}")
}
If you're getting an error anywhere in this code, make sure you've imported everything, since some of these functions are extensions.
This is Deck's official documentation. For questions, you can either contact me in Guilded (https://www.guilded.gg/gabriel) or in Discord (Gaabriel#1911). If you don't have any of those, try opening an issue!
I'm not a native English speaker, so for any typos or grammar mistakes please do contact me as well.