Aw botgram send
Minimum requirements | ||
---|---|---|
Added in version 3.5 | ||
SDK | build 37 | |
Universe | build 51 |
int aw_botgram_send (void)
Description
Sends a botgram to all bots that are owned by the specified citizen number.
Callback
Notes
This method triggers AW_EVENT_BOTGRAM for all currently connected instances that are owned by the specified citizen number. The botgram is sent via the universe server and will succeed even if no targeted bots were found.
Note that if the targeted citizen is blocking telegrams then botgrams will be blocked aswell.
Arguments
None
Argument attributes
- AW_BOTGRAM_TYPE
- Is reserved for future use and may only be set to 0 (the server will currently reset it to 0).
- AW_BOTGRAM_TEXT
- AW_BOTGRAM_TO
Return values
- RC_SUCCESS (1) (2)
- RC_NOT_INITIALIZED (1)
- RC_NO_INSTANCE (1)
- RC_NO_CONNECTION (1)
- Network connection to the universe is down.
- RC_NOT_YET (1)
- It would exceed the maximum number of botgrams per second (defined by AW_MAX_BOTGRAMS_PER_SECOND in Aw.h).
- RC_NO_SUCH_CITIZEN (2)
- RC_TELEGRAM_BLOCKED (2)
- Recipient is blocking telegrams from the owner of the instance.
- RC_TELEGRAM_TOO_LONG (2) (3)
- Telegram text is longer than 1000 characters.
(1) Possible return values when a callback has been established.
(2) Returned from the universe server and is passed to a callback handler.
(3) Version 4.1 and later will truncate the text at 1000 characters instead.
Blocking calls may return any of the listed reason codes.
Returned attributes
None
Usage
Send a botgram to the bot owner.
void handle_botgram (void) { printf ("Botgram From %s (#%d): %s\n", aw_string (AW_BOTGRAM_FROM_NAME), aw_int (AW_BOTGRAM_FROM), aw_string (AW_BOTGRAM_TEXT)); } aw_event_set (AW_EVENT_BOTGRAM, handle_botgram); aw_int_set (AW_BOTGRAM_TYPE, 0); aw_int_set (AW_BOTGRAM_TO, aw_int (AW_LOGIN_OWNER)); aw_string_set (AW_BOTGRAM_TEXT, "Hello"); rc = aw_botgram_send (); if (rc != RC_SUCCESS) printf ("Unable to send botgram reason %d\n", rc);