# BOT_SETUP_SETBOT

Sets the working personal Bot.  
Other commands require this command to be invoked first.

```csharp
llMessageLinked(LINK_SET, BOT_SETUP_SETBOT, "My bot name", "BOT API TOKEN");
```

```snippet totalcontrol-variables-EsRYwBUh4J
str | Name of the Bot.
id  | @[Bot API token](mention://a5c44e41-d1fb-4489-ae21-153adbfba78a/document/59840955-2911-490a-af32-80b85502cabb)
```

## Result

One of the following events will be generated:

* [BOT_SETUP_SUCCESS](/doc/d482a906-a622-4f03-8f59-4638d4859b6c)
* [BOT_SETUP_FAILED](/doc/a73e2dda-c4e5-47b7-bff5-6fe28b7a9e09)

## Example

```csharp
integer BOT_SETUP_SETBOT = 280101;

string name = "SmartBots Resident";
string apiToken = "bct_..."; // Your Bot API token

default
{
	state_entry()
	{
		llMessageLinked(LINK_SET, BOT_SETUP_SETBOT, name, apiToken);
	}
	
	link_message(integer sender, integer cmd, string data, key idk)
	{
		string id = (string)idk;
		if(cmd == BOT_SETUP_SUCCESS) {
			llOwnerSay("Setup Success: data=" + data + "\nkey= " + id);
		}
		else if(cmd == BOT_SETUP_FAILED) {
			llOwnerSay("Setup Failed: data=" + data + "\nkey= " + id);
		}
	}
}
```