new commands

This commit is contained in:
2026-03-29 02:07:51 +01:00
parent f84120883a
commit 5a44d56a24
8 changed files with 846 additions and 92 deletions

View File

@@ -1,24 +1,24 @@
# Add the bot to a Planet
Bots join planets the same way users do - through invite links or the Discovery page.
<br>
There are a few way of doing this. I will be going through **two** of them in this guide.
There are two ways to do this. Both are covered below.
## 1. Using my website
The easiest way to add a bot to your Planet is to use my website [here](https://skyjoshua.xyz/planetjoiner)
<br>
You should see something like this below:
<br>
The easiest way to add a bot to your Planet is to use my website [here](https://skyjoshua.xyz/planetjoiner).
You should see something like this:
![Planet Joiner Site](https://sxsc.xyz/files/images/.PlanetJoiner.png)
<br>
Fill in the boxes with the required information and hit **Join Planet** and the bot should join the desired planet.
<br>
*Note: Sometimes the Invite Code is not required if the Planet you are trying to join is Discoverable*
*Note: Sometimes the Invite Code is not required if the Planet you are trying to join is Discoverable.*
## 2. Using code
To make a Bot join your Planet using code we can add 1 line to the previous code.
To join a planet from code, call `JoinPlanetAsync` with the planet's ID. If the planet is not open to discovery, you also need to pass an invite code.
```c#
// If the planet is open to discovery only the planet ID is required.
@@ -26,11 +26,13 @@ await client.PlanetService.JoinPlanetAsync(planetId);
```
or
```c#
// If the planet is not open to discovery an the last part of an invite (the invite code) is also required.
// If the planet requires an invite, pass the invite code as the second argument.
await client.PlanetService.JoinPlanetAsync(planetId, "INVITE_CODE");
```
Below is the full code required to add the bot to a planet. (Comments are new parts added.)
You can find a planet's ID and invite code from its settings page inside Valour.
<br><br>
### Full code below
```c#
using Valour.Sdk.Client;
@@ -44,7 +46,7 @@ Env.Load();
string token = Environment.GetEnvironmentVariable("TOKEN") ?? string.Empty;
if (string.IsNullOrWhiteSpace(token))
if (string.IsNullOrWhiteSpace(token))
{
Console.WriteLine($"Token invalid. Please make sure you set a valid token in your .env");
return;
@@ -58,13 +60,11 @@ if (!loginResult.Success)
Console.WriteLine($"Logged in as {client.Me.Name} (ID: {client.Me.Id})");
// Join a planet
// Join a planet using its ID and invite code
await client.PlanetService.JoinPlanetAsync(00000000000000000, "ABCDEF");
await Task.Delay(Timeout.Infinite);
```
##
## [The Next step is to Connecting and Sending a message to a Planet](3.ConnectingAndSending.md)
---
## [The Next step is Connecting and Sending a message to a Planet](3.ConnectingAndSending.md)