Difference between revisions of "Bot Playground/Events/friendship offer"
From SmartBots Developers Docs
(Created page with "{{DISPLAYTITLE:friendship_offer}} <onlyinclude>Fires when bot receives a friendship offer</onlyinclude> <syntaxhighlight lang="javascript"> Bot.on("friendship_offer", functio...") |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
Bot.on("friendship_offer", function(event) { ... }); | Bot.on("friendship_offer", function(event) { ... }); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
Line 17: | Line 15: | ||
{{API Variables Table End}} | {{API Variables Table End}} | ||
+ | |||
+ | == See also == | ||
+ | |||
+ | Use [[Bot_Playground/Commands/acceptFriendshipOffer|acceptFriendshipOffer]] command to accept an offer. | ||
== Example == | == Example == | ||
Line 22: | Line 24: | ||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
Bot.on("friendship_offer", function(event) { | Bot.on("friendship_offer", function(event) { | ||
− | console.log(` | + | console.log(`${event.avatar_name} offer friendship and says: ${event.message}`); |
}); | }); | ||
Latest revision as of 16:36, 17 October 2022
Fires when bot receives a friendship offer
Bot.on("friendship_offer", function(event) { ... });
Reference
This event comes with the following event object:
Variable | Required | Description | |
---|---|---|---|
event object properties: | |||
avatar_name | name of the sender | ||
avatar_uuid | UUID of the sender | ||
message | Text message sent along with the offer | ||
session_id | Session UUID to accept an offer. |
See also
Use acceptFriendshipOffer command to accept an offer.
Example
Bot.on("friendship_offer", function(event) {
console.log(`${event.avatar_name} offer friendship and says: ${event.message}`);
});
console.log("Bot is listening to friendship offers");