<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.helionet.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Lucash</id>
	<title>HelioHost Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.helionet.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Lucash"/>
	<link rel="alternate" type="text/html" href="https://wiki.helionet.org/Special:Contributions/Lucash"/>
	<updated>2026-04-27T08:09:22Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.42.3</generator>
	<entry>
		<id>https://wiki.helionet.org/index.php?title=Discord_Bot_-_Rust&amp;diff=2211</id>
		<title>Discord Bot - Rust</title>
		<link rel="alternate" type="text/html" href="https://wiki.helionet.org/index.php?title=Discord_Bot_-_Rust&amp;diff=2211"/>
		<updated>2026-02-15T03:08:44Z</updated>

		<summary type="html">&lt;p&gt;Lucash: /* Upload Files to Plesk */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Preface ==&lt;br /&gt;
Rust is a compiled, strongly and statically typed general purpose programming language. Compared to Python, Rust applications must be compiled for each operating system and architecture combination, and all variables defined should have a single type.&lt;br /&gt;
&lt;br /&gt;
To learn more about Rust, read [https://doc.rust-lang.org/book/ &amp;quot;The Book&amp;quot;], or follow a more [https://doc.rust-lang.org/rust-by-example/ interactive learning guide] with example code and output.&lt;br /&gt;
&lt;br /&gt;
== Getting Started ==&lt;br /&gt;
What to expect in this section:&lt;br /&gt;
# Installing Rust and Cargo&lt;br /&gt;
# Setting up a Rust project&lt;br /&gt;
# Installing needed dependencies (also known as &amp;quot;crates&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
To get started, install Rust and Cargo (the package manager for Rust) using [https://rustup.rs/ rustup].&lt;br /&gt;
&lt;br /&gt;
Once installed, create a new project by using Cargo.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cargo init ping-pong-rs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running &amp;lt;code&amp;gt;cargo init ping-pong-rs&amp;lt;/code&amp;gt; will create a folder named &amp;lt;code&amp;gt;ping-pong-rs&amp;lt;/code&amp;gt; with the basic structure of a Rust project.&lt;br /&gt;
&lt;br /&gt;
[[File:Rust_discord_init_folder.png]]&lt;br /&gt;
&lt;br /&gt;
Next, we need to install some dependencies (crates). For this tutorial, we&#039;ll be using [https://crates.io/crates/serenity serenity] to interact with Discord, [https://crates.io/crates/tokio tokio] with the &amp;quot;full&amp;quot; feature to manage asynchronous behavior, and [https://crates.io/crates/dotenvy dotenvy] to read your Discord bot token from a file.&lt;br /&gt;
&lt;br /&gt;
To install these crates, use need to use Cargo again.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cargo add dotenvy tokio serenity -F tokio/full&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Once you have the crates installed, you are now ready to code!&lt;br /&gt;
&lt;br /&gt;
== Writing the Discord Bot ==&lt;br /&gt;
What to expect in this section:&lt;br /&gt;
# Creating an example ping-pong bot&lt;br /&gt;
# Building and testing your Discord bot on your machine&lt;br /&gt;
&lt;br /&gt;
We&#039;ll be using a modified version of serenity&#039;s sample ping-pong bot. Open the &amp;lt;code&amp;gt;main.rs&amp;lt;/code&amp;gt; file located in the &amp;lt;code&amp;gt;src&amp;lt;/code&amp;gt; folder and paste the following code inside of it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
use std::env;&lt;br /&gt;
&lt;br /&gt;
use dotenvy::dotenv;&lt;br /&gt;
use serenity::async_trait;&lt;br /&gt;
use serenity::model::channel::Message;&lt;br /&gt;
use serenity::prelude::*;&lt;br /&gt;
&lt;br /&gt;
struct Handler;&lt;br /&gt;
&lt;br /&gt;
#[async_trait]&lt;br /&gt;
impl EventHandler for Handler {&lt;br /&gt;
    async fn message(&amp;amp;self, ctx: Context, msg: Message) {&lt;br /&gt;
        if msg.content == &amp;quot;!ping&amp;quot; {&lt;br /&gt;
            if let Err(why) = msg.channel_id.say(&amp;amp;ctx.http, &amp;quot;Pong!&amp;quot;).await {&lt;br /&gt;
                println!(&amp;quot;Error sending message: {why:?}&amp;quot;);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#[tokio::main]&lt;br /&gt;
async fn main() {&lt;br /&gt;
    // Load all variables from a local environment variable file&lt;br /&gt;
    dotenv().expect(&amp;quot;Expected a .env file to be created&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    // Login with a bot token from the environment&lt;br /&gt;
    let token = env::var(&amp;quot;DISCORD_TOKEN&amp;quot;).expect(&amp;quot;Expected a token in the environment&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    // Set gateway intents, which decides what events the bot will be notified about&lt;br /&gt;
    let intents = GatewayIntents::GUILD_MESSAGES&lt;br /&gt;
        | GatewayIntents::DIRECT_MESSAGES&lt;br /&gt;
        | GatewayIntents::MESSAGE_CONTENT;&lt;br /&gt;
&lt;br /&gt;
    // Create a new instance of the Client, logging in as a bot.&lt;br /&gt;
    let mut client = Client::builder(&amp;amp;token, intents)&lt;br /&gt;
        .event_handler(Handler)&lt;br /&gt;
        .await&lt;br /&gt;
        .expect(&amp;quot;Err creating client&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    println!(&amp;quot;Starting bot&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    // Start listening for events by starting a single shard&lt;br /&gt;
    if let Err(why) = client.start().await {&lt;br /&gt;
        println!(&amp;quot;Client error: {why:?}&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, you&#039;ll need to copy your Discord bot token into a file named &amp;lt;code&amp;gt;.env&amp;lt;/code&amp;gt;. &#039;&#039;&#039;This file should be located in the same place as the &amp;lt;code&amp;gt;src&amp;lt;/code&amp;gt; folder, NOT inside of it&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
[[File:Rust_env_folder_structure.png]]&lt;br /&gt;
&lt;br /&gt;
The environment file should contain your token:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DISCORD_TOKEN=your_discord_bot_token&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, you are now ready to run your bot locally to test it out!&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cargo run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The run command will build and run your bot locally. Remember, Rust is a compiled language. This means that your bot must be compiled before it can be run, this can take around a minute.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
lucas@fozziebear:~/heliohost/ping-pong-rs$ cargo run&lt;br /&gt;
   Compiling proc-macro2 v1.0.106&lt;br /&gt;
   Compiling quote v1.0.44&lt;br /&gt;
   .&lt;br /&gt;
   .&lt;br /&gt;
   .&lt;br /&gt;
   Compiling hyper-rustls v0.27.7&lt;br /&gt;
   Compiling reqwest v0.12.28&lt;br /&gt;
   Compiling ping-pong-rs v0.1.0 (/home/lucas/heliohost/ping-pong-rs)&lt;br /&gt;
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 41.00s&lt;br /&gt;
     Running `target/debug/ping-pong-rs`&lt;br /&gt;
Starting bot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see the message &amp;lt;code&amp;gt;Starting bot&amp;lt;/code&amp;gt; at the end if everything compiled successfully.&lt;br /&gt;
&lt;br /&gt;
Once your project is up and running, return to Discord and type &amp;lt;code&amp;gt;!ping&amp;lt;/code&amp;gt; in the channel your bot is located in and see it return your message!&lt;br /&gt;
&lt;br /&gt;
[[File:Rust_discord_pong.png]]&lt;br /&gt;
&lt;br /&gt;
== Building your Discord Bot for HelioHost ==&lt;br /&gt;
What to expect in this section:&lt;br /&gt;
# How to build the correct file to work in HelioHost&lt;br /&gt;
&lt;br /&gt;
Rust applications must be built to run on the machine that you want to run your application on. In simple terms, this means that to run a Rust Discord bot on HelioHost, you should build a Linux x86_64 application.&lt;br /&gt;
&lt;br /&gt;
For users that are writing code on a Windows machine (this does not include WSL2), or a MacOS machine, you will need to cross compile to the correct architecture.&lt;br /&gt;
&lt;br /&gt;
=== Building a release binary on the same architecture and host ===&lt;br /&gt;
If you are on a system that &#039;&#039;&#039;matches&#039;&#039;&#039; the HelioHost machines (Linux x86_64), then you do not need to cross compile. Simply running a normal release build is enough.&lt;br /&gt;
&amp;lt;pre&amp;gt;cargo build --release&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will build the final file under &amp;lt;code&amp;gt;target/release/ping-pong-rs&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:Rust_discord_build_cargo.png]]&lt;br /&gt;
&lt;br /&gt;
=== Building a release binary on a different host ===&lt;br /&gt;
If you are on a system that &#039;&#039;&#039;does not match&#039;&#039;&#039; the HelioHost machines (Linux x86_64), then you do not need to cross compile. This includes Windows, MacOS, or Linux ARM machines.&lt;br /&gt;
&lt;br /&gt;
The most straightforward way to do this is by using [https://github.com/cross-rs/cross cross] to build your application inside of a Docker container.&lt;br /&gt;
&lt;br /&gt;
To get started, install [https://www.docker.com/ Docker]. This is most commonly done by installing Docker Desktop for those using Windows or MacOS.&lt;br /&gt;
&lt;br /&gt;
Once you have Docker installed and running, install cross by using Cargo.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cargo install cross --git https://github.com/cross-rs/cross&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After cross has completed building and installing, create a release build for the Linux x86_64 architecture using the tool.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cross build --target x86_64-unknown-linux-gnu --release&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will build the final file under &amp;lt;code&amp;gt;target/x86_64-unknown-linux-gnu/release/ping-pong-rs&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:Rust_discord_build_cross.png]]&lt;br /&gt;
&lt;br /&gt;
== Upload Files to Plesk ==&lt;br /&gt;
You will need to upload both your environment variable file and the binary to your Plesk account to setup.&lt;br /&gt;
&lt;br /&gt;
Navigate to your &#039;&#039;&#039;Home Directory&#039;&#039;&#039; and upload both the &amp;lt;code&amp;gt;.env&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;ping-pong-rs&amp;lt;/code&amp;gt; files.&lt;br /&gt;
&lt;br /&gt;
[[File:Rust_upload_plesk.png]]&lt;br /&gt;
&lt;br /&gt;
Now, we need to set the permissions of the &amp;lt;code&amp;gt;ping-pong-rs&amp;lt;/code&amp;gt; file to be executable. On the file manager click the &amp;lt;code&amp;gt;rw- r-- r--&amp;lt;/code&amp;gt; and check all the &amp;lt;code&amp;gt;Execute/search&amp;lt;/code&amp;gt; boxes&lt;br /&gt;
&lt;br /&gt;
[[File:755_permissions.png]]&lt;br /&gt;
&lt;br /&gt;
This will allow the file to be run in later sections.&lt;br /&gt;
&lt;br /&gt;
== Starting the Discord Bot ==&lt;br /&gt;
To start the Discord bot, read up on the rest of the guide at the [[:Discord_Bot#Starting_and_Stopping_Your_Bot|end of the Discord tutorial]].&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Lucash</name></author>
	</entry>
	<entry>
		<id>https://wiki.helionet.org/index.php?title=Discord_Bot_-_Rust&amp;diff=2210</id>
		<title>Discord Bot - Rust</title>
		<link rel="alternate" type="text/html" href="https://wiki.helionet.org/index.php?title=Discord_Bot_-_Rust&amp;diff=2210"/>
		<updated>2026-02-14T09:10:00Z</updated>

		<summary type="html">&lt;p&gt;Lucash: /* Building a release binary on a different host */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Preface ==&lt;br /&gt;
Rust is a compiled, strongly and statically typed general purpose programming language. Compared to Python, Rust applications must be compiled for each operating system and architecture combination, and all variables defined should have a single type.&lt;br /&gt;
&lt;br /&gt;
To learn more about Rust, read [https://doc.rust-lang.org/book/ &amp;quot;The Book&amp;quot;], or follow a more [https://doc.rust-lang.org/rust-by-example/ interactive learning guide] with example code and output.&lt;br /&gt;
&lt;br /&gt;
== Getting Started ==&lt;br /&gt;
What to expect in this section:&lt;br /&gt;
# Installing Rust and Cargo&lt;br /&gt;
# Setting up a Rust project&lt;br /&gt;
# Installing needed dependencies (also known as &amp;quot;crates&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
To get started, install Rust and Cargo (the package manager for Rust) using [https://rustup.rs/ rustup].&lt;br /&gt;
&lt;br /&gt;
Once installed, create a new project by using Cargo.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cargo init ping-pong-rs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running &amp;lt;code&amp;gt;cargo init ping-pong-rs&amp;lt;/code&amp;gt; will create a folder named &amp;lt;code&amp;gt;ping-pong-rs&amp;lt;/code&amp;gt; with the basic structure of a Rust project.&lt;br /&gt;
&lt;br /&gt;
[[File:Rust_discord_init_folder.png]]&lt;br /&gt;
&lt;br /&gt;
Next, we need to install some dependencies (crates). For this tutorial, we&#039;ll be using [https://crates.io/crates/serenity serenity] to interact with Discord, [https://crates.io/crates/tokio tokio] with the &amp;quot;full&amp;quot; feature to manage asynchronous behavior, and [https://crates.io/crates/dotenvy dotenvy] to read your Discord bot token from a file.&lt;br /&gt;
&lt;br /&gt;
To install these crates, use need to use Cargo again.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cargo add dotenvy tokio serenity -F tokio/full&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Once you have the crates installed, you are now ready to code!&lt;br /&gt;
&lt;br /&gt;
== Writing the Discord Bot ==&lt;br /&gt;
What to expect in this section:&lt;br /&gt;
# Creating an example ping-pong bot&lt;br /&gt;
# Building and testing your Discord bot on your machine&lt;br /&gt;
&lt;br /&gt;
We&#039;ll be using a modified version of serenity&#039;s sample ping-pong bot. Open the &amp;lt;code&amp;gt;main.rs&amp;lt;/code&amp;gt; file located in the &amp;lt;code&amp;gt;src&amp;lt;/code&amp;gt; folder and paste the following code inside of it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
use std::env;&lt;br /&gt;
&lt;br /&gt;
use dotenvy::dotenv;&lt;br /&gt;
use serenity::async_trait;&lt;br /&gt;
use serenity::model::channel::Message;&lt;br /&gt;
use serenity::prelude::*;&lt;br /&gt;
&lt;br /&gt;
struct Handler;&lt;br /&gt;
&lt;br /&gt;
#[async_trait]&lt;br /&gt;
impl EventHandler for Handler {&lt;br /&gt;
    async fn message(&amp;amp;self, ctx: Context, msg: Message) {&lt;br /&gt;
        if msg.content == &amp;quot;!ping&amp;quot; {&lt;br /&gt;
            if let Err(why) = msg.channel_id.say(&amp;amp;ctx.http, &amp;quot;Pong!&amp;quot;).await {&lt;br /&gt;
                println!(&amp;quot;Error sending message: {why:?}&amp;quot;);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#[tokio::main]&lt;br /&gt;
async fn main() {&lt;br /&gt;
    // Load all variables from a local environment variable file&lt;br /&gt;
    dotenv().expect(&amp;quot;Expected a .env file to be created&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    // Login with a bot token from the environment&lt;br /&gt;
    let token = env::var(&amp;quot;DISCORD_TOKEN&amp;quot;).expect(&amp;quot;Expected a token in the environment&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    // Set gateway intents, which decides what events the bot will be notified about&lt;br /&gt;
    let intents = GatewayIntents::GUILD_MESSAGES&lt;br /&gt;
        | GatewayIntents::DIRECT_MESSAGES&lt;br /&gt;
        | GatewayIntents::MESSAGE_CONTENT;&lt;br /&gt;
&lt;br /&gt;
    // Create a new instance of the Client, logging in as a bot.&lt;br /&gt;
    let mut client = Client::builder(&amp;amp;token, intents)&lt;br /&gt;
        .event_handler(Handler)&lt;br /&gt;
        .await&lt;br /&gt;
        .expect(&amp;quot;Err creating client&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    println!(&amp;quot;Starting bot&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    // Start listening for events by starting a single shard&lt;br /&gt;
    if let Err(why) = client.start().await {&lt;br /&gt;
        println!(&amp;quot;Client error: {why:?}&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, you&#039;ll need to copy your Discord bot token into a file named &amp;lt;code&amp;gt;.env&amp;lt;/code&amp;gt;. &#039;&#039;&#039;This file should be located in the same place as the &amp;lt;code&amp;gt;src&amp;lt;/code&amp;gt; folder, NOT inside of it&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
[[File:Rust_env_folder_structure.png]]&lt;br /&gt;
&lt;br /&gt;
The environment file should contain your token:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DISCORD_TOKEN=your_discord_bot_token&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, you are now ready to run your bot locally to test it out!&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cargo run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The run command will build and run your bot locally. Remember, Rust is a compiled language. This means that your bot must be compiled before it can be run, this can take around a minute.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
lucas@fozziebear:~/heliohost/ping-pong-rs$ cargo run&lt;br /&gt;
   Compiling proc-macro2 v1.0.106&lt;br /&gt;
   Compiling quote v1.0.44&lt;br /&gt;
   .&lt;br /&gt;
   .&lt;br /&gt;
   .&lt;br /&gt;
   Compiling hyper-rustls v0.27.7&lt;br /&gt;
   Compiling reqwest v0.12.28&lt;br /&gt;
   Compiling ping-pong-rs v0.1.0 (/home/lucas/heliohost/ping-pong-rs)&lt;br /&gt;
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 41.00s&lt;br /&gt;
     Running `target/debug/ping-pong-rs`&lt;br /&gt;
Starting bot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see the message &amp;lt;code&amp;gt;Starting bot&amp;lt;/code&amp;gt; at the end if everything compiled successfully.&lt;br /&gt;
&lt;br /&gt;
Once your project is up and running, return to Discord and type &amp;lt;code&amp;gt;!ping&amp;lt;/code&amp;gt; in the channel your bot is located in and see it return your message!&lt;br /&gt;
&lt;br /&gt;
[[File:Rust_discord_pong.png]]&lt;br /&gt;
&lt;br /&gt;
== Building your Discord Bot for HelioHost ==&lt;br /&gt;
What to expect in this section:&lt;br /&gt;
# How to build the correct file to work in HelioHost&lt;br /&gt;
&lt;br /&gt;
Rust applications must be built to run on the machine that you want to run your application on. In simple terms, this means that to run a Rust Discord bot on HelioHost, you should build a Linux x86_64 application.&lt;br /&gt;
&lt;br /&gt;
For users that are writing code on a Windows machine (this does not include WSL2), or a MacOS machine, you will need to cross compile to the correct architecture.&lt;br /&gt;
&lt;br /&gt;
=== Building a release binary on the same architecture and host ===&lt;br /&gt;
If you are on a system that &#039;&#039;&#039;matches&#039;&#039;&#039; the HelioHost machines (Linux x86_64), then you do not need to cross compile. Simply running a normal release build is enough.&lt;br /&gt;
&amp;lt;pre&amp;gt;cargo build --release&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will build the final file under &amp;lt;code&amp;gt;target/release/ping-pong-rs&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:Rust_discord_build_cargo.png]]&lt;br /&gt;
&lt;br /&gt;
=== Building a release binary on a different host ===&lt;br /&gt;
If you are on a system that &#039;&#039;&#039;does not match&#039;&#039;&#039; the HelioHost machines (Linux x86_64), then you do not need to cross compile. This includes Windows, MacOS, or Linux ARM machines.&lt;br /&gt;
&lt;br /&gt;
The most straightforward way to do this is by using [https://github.com/cross-rs/cross cross] to build your application inside of a Docker container.&lt;br /&gt;
&lt;br /&gt;
To get started, install [https://www.docker.com/ Docker]. This is most commonly done by installing Docker Desktop for those using Windows or MacOS.&lt;br /&gt;
&lt;br /&gt;
Once you have Docker installed and running, install cross by using Cargo.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cargo install cross --git https://github.com/cross-rs/cross&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After cross has completed building and installing, create a release build for the Linux x86_64 architecture using the tool.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cross build --target x86_64-unknown-linux-gnu --release&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will build the final file under &amp;lt;code&amp;gt;target/x86_64-unknown-linux-gnu/release/ping-pong-rs&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:Rust_discord_build_cross.png]]&lt;br /&gt;
&lt;br /&gt;
== Upload Files to Plesk ==&lt;br /&gt;
You will need to upload both your environment variable file and the binary to your Plesk account to setup.&lt;br /&gt;
&lt;br /&gt;
Navigate to your &#039;&#039;&#039;Home Directory&#039;&#039;&#039; and upload both the &amp;lt;code&amp;gt;.env&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;ping-pong-rs&amp;lt;/code&amp;gt; files.&lt;br /&gt;
&lt;br /&gt;
[[File:Rust_upload_plesk.png]]&lt;br /&gt;
&lt;br /&gt;
== Starting the Discord Bot ==&lt;br /&gt;
To start the Discord bot, read up on the rest of the guide at the [[:Discord_Bot#Starting_and_Stopping_Your_Bot|end of the Discord tutorial]].&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Lucash</name></author>
	</entry>
	<entry>
		<id>https://wiki.helionet.org/index.php?title=Discord_Bot&amp;diff=2209</id>
		<title>Discord Bot</title>
		<link rel="alternate" type="text/html" href="https://wiki.helionet.org/index.php?title=Discord_Bot&amp;diff=2209"/>
		<updated>2026-02-14T09:05:47Z</updated>

		<summary type="html">&lt;p&gt;Lucash: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Preface ==&lt;br /&gt;
&lt;br /&gt;
This guide will work on any of the HelioHost servers.&lt;br /&gt;
&lt;br /&gt;
Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together. Python&#039;s simple, easy to learn syntax emphasizes readability and therefore reduces the cost of program maintenance. Python supports modules and packages, which encourages program modularity and code reuse.&lt;br /&gt;
&lt;br /&gt;
The Discord app works with desktop and mobile platforms, combining the features of a chat lobby, a message board and a VoIP chatting system into one app that&#039;s not going to hog resources on your phone or PC. Discord&#039;s popularity has only multiplied in recent years, with the app now reaching over 90 million registered users.&lt;br /&gt;
&lt;br /&gt;
Bots and apps are the lifeblood of the Discord development community. They come in all shapes and sizes, from small hobby projects for your server with friends, to huge projects that live in hundreds of thousands of servers. We love seeing the unique, fun, and sometimes downright strange (in a good way) creations that come from our community.&lt;br /&gt;
&lt;br /&gt;
== How to get Started with a Discord Bot ==&lt;br /&gt;
&lt;br /&gt;
First you&#039;ll need to have a Discord account, and a Discord channel that you&#039;ll add the bot to later. Here&#039;s a [https://www.howtogeek.com/364075/how-to-create-set-up-and-manage-your-discord-server/ good guide] to get started.&lt;br /&gt;
&lt;br /&gt;
== Create the Bot ==&lt;br /&gt;
&lt;br /&gt;
Once you have your Discord server all set up it&#039;s time to create the bot through Discord&#039;s site. Go to [https://discordapp.com/developers/applications discordapp.com/developers/applications] and make sure you&#039;re logged in. Then click &#039;New Application&#039; in the top right.&lt;br /&gt;
&lt;br /&gt;
[[File:New_application.png]]&lt;br /&gt;
&lt;br /&gt;
Type a name and hit create. I decided to name my bot &#039;HelioBot&#039;.&lt;br /&gt;
&lt;br /&gt;
== Add the Bot to your Discord Server ==&lt;br /&gt;
&lt;br /&gt;
Click &#039;OAuth2&#039; on the left navigation.&lt;br /&gt;
&lt;br /&gt;
[[File:oauth2.png]]&lt;br /&gt;
&lt;br /&gt;
Then check the bot box under &#039;SCOPES&#039;, and scroll down and select &#039;Administrator&#039; under &#039;BOT PERMISSIONS&#039;. You could select the exact permissions that your bot needs one by one, but for this simple example it&#039;s easier to just allow the bot permission to do everything.&lt;br /&gt;
&lt;br /&gt;
[[File:bot_admin.png]]&lt;br /&gt;
&lt;br /&gt;
Click copy next to the URL that is generated and open that URL in a new tab. Then, select your Discord server from the dropdown menu.&lt;br /&gt;
&lt;br /&gt;
[[File:add_to_server.png]]&lt;br /&gt;
&lt;br /&gt;
Click &#039;Authorize&#039; and complete the reCAPTCHA to add the bot to the Discord server. If you go to your Discord now you can see the bot on the offline user list.&lt;br /&gt;
&lt;br /&gt;
[[File:offline_bot.png]]&lt;br /&gt;
&lt;br /&gt;
== Setup the Discord Bot Intents and Token ==&lt;br /&gt;
Go back to the Discord bot page and click bot on the left navigation again.&lt;br /&gt;
&lt;br /&gt;
[[File:select_bot.png]]&lt;br /&gt;
&lt;br /&gt;
The first thing we need to do on this page is enable &#039;Presence Intent&#039;, &#039;Server Members Intent&#039;, and &#039;Message Content Intent&#039;. If you&#039;re sure your bot doesn&#039;t need all three of these enable just what you need, but for simplicity of this guide we&#039;re going to enable all three, and then save the changes.&lt;br /&gt;
&lt;br /&gt;
[[File:discord_intents.png]]&lt;br /&gt;
&lt;br /&gt;
On the same page click the &#039;Reset Token&#039; button, and then copy/paste the token. Keep this token somewhere for now, we will use it later when writing the bot code.&lt;br /&gt;
&lt;br /&gt;
[[File:copy_token.png]]&lt;br /&gt;
&lt;br /&gt;
If you ever think someone has gotten your token, for instance if you posted it on a public wiki like I just did, be sure to come back to this page and reset it. Anyone who has your token can do whatever permissions you granted your bot to your server.&lt;br /&gt;
&lt;br /&gt;
== Write your Bot Code ==&lt;br /&gt;
We have provided some basic tutorials on how to write and build Discord bots in different programming languages.&lt;br /&gt;
* [[:Discord_Bot_-_Python|Python]]&lt;br /&gt;
* [[:Discord_Bot_-_Rust|Rust]]&lt;br /&gt;
This is not an exhaustive list, just a list of languages that we have verified to work. If you know of another method of creating a Discord bot on HelioHost we welcome [[:Contributing_to_the_Wiki|contributions]].&lt;br /&gt;
&lt;br /&gt;
== Starting and Stopping Your Bot ==&lt;br /&gt;
&lt;br /&gt;
You have a functional bot now, but you need a way to start and stop it.&lt;br /&gt;
&lt;br /&gt;
{{Info|&lt;br /&gt;
Side note: Previous versions of this guide used Python scripts to start and stop the Discord bot. Unfortunately, the people who wanted to write their bot in Node.js always complained that they didn&#039;t want to use Python for anything. Likewise, if we used Node.js to start and stop the bot, the Python people would inevitably complain about not wanting to use Node.js for anything. Therefore, we wrote the start and stop scripts in Bash CGI to make absolutely sure that no one is happy.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
We&#039;ll use Bash CGI to do that so you can control your bot through your web page. With the file manager, navigate to &#039;/httpdocs&#039; and create a new directory called &#039;bot_control&#039;.&lt;br /&gt;
&lt;br /&gt;
[[File:bot_control.png]]&lt;br /&gt;
&lt;br /&gt;
Now create a new file named &#039;.htaccess&#039; in the &#039;/httpdocs/bot_control&#039; directory.&lt;br /&gt;
&lt;br /&gt;
[[File:create_htaccess.png]]&lt;br /&gt;
&lt;br /&gt;
Paste this code into the new &#039;.htaccess&#039; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Options +ExecCGI&lt;br /&gt;
AddHandler cgi-script .sh&lt;br /&gt;
DirectoryIndex index.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next create a new file named &#039;index.sh&#039; in the &#039;/httpdocs/bot_control&#039; directory.&lt;br /&gt;
&lt;br /&gt;
[[File:create_indexsh.png]]&lt;br /&gt;
&lt;br /&gt;
Paste the code below into the new file. Remember to use either &#039;helio&#039;&#039;&#039;ho.st&#039;&#039;&#039;&#039; or &#039;helioho&#039;&#039;&#039;st.us&#039;&#039;&#039;&#039; at the end of your domain, unless you&#039;re one of the very few users who still have a legacy heliohost.org domain:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
# edit this to match your bot filename&lt;br /&gt;
bot_name=&amp;quot;heliobot.py&amp;quot;&lt;br /&gt;
&lt;br /&gt;
###################################################################&lt;br /&gt;
&lt;br /&gt;
printf &#039;Content-Type: text/html\n\n&#039;&lt;br /&gt;
username=`whoami`&lt;br /&gt;
pwd=`printenv|grep &#039;^PWD&#039;|cut -f2 -d&#039;=&#039;`&lt;br /&gt;
main_domain=`echo &amp;quot;$pwd&amp;quot;|cut -f3 -d&#039;/&#039;`&lt;br /&gt;
control=`echo &amp;quot;$pwd&amp;quot;|cut -f5 -d&#039;/&#039;`&lt;br /&gt;
temp=`ps axo user:16,pid,pcpu,pmem,vsz,rss,tty,stat,start,time,command|grep -v grep|grep &amp;quot;^$username &amp;quot;`&lt;br /&gt;
running=`echo &amp;quot;$temp&amp;quot;|grep -c &amp;quot;$bot_name&amp;quot;`&lt;br /&gt;
file_base=`echo $bot_name|tr -cd &amp;quot;a-zA-Z0-9&amp;quot;`&lt;br /&gt;
log_name=&amp;quot;$file_base.txt&amp;quot;&lt;br /&gt;
if [ &amp;quot;$QUERY_STRING&amp;quot; == &amp;quot;&amp;quot; ]; then&lt;br /&gt;
    if [ $running -ne 0 ]; then&lt;br /&gt;
        mem_kb=`echo &amp;quot;$temp&amp;quot;|grep &amp;quot;$bot_name&amp;quot;|awk &#039;{print $6}&#039;`&lt;br /&gt;
        mem_mb=$( echo &amp;quot;scale=2;$mem_kb/1024&amp;quot;|bc )&lt;br /&gt;
        mem_24=$( echo &amp;quot;scale=2;$mem_kb*1440/1048576&amp;quot;|bc )&lt;br /&gt;
        echo &amp;quot;$bot_name is running. &amp;lt;a href=&#039;?action=stop&#039;&amp;gt;Stop&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;Current memory usage: $mem_mb MB&amp;lt;br&amp;gt;Estimated 24 hour usage: $mem_24 GB - &amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
        echo &amp;quot;$bot_name is not running. &amp;lt;a href=&#039;?action=start&#039;&amp;gt;Start&amp;lt;/a&amp;gt; - &amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
    echo &amp;quot;&amp;lt;a href=&#039;https://heliohost.org/dashboard/load/&#039; target=&#039;_blank&#039;&amp;gt;Check Load&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;Logs: &amp;lt;a href=&#039;?action=clear&#039;&amp;gt;Clear Logs&amp;lt;/a&amp;gt; - &amp;lt;a href=&#039;/$control/$log_name&#039;&amp;gt;Full Logs&amp;lt;/a&amp;gt;&amp;lt;pre&amp;gt;&amp;quot;&lt;br /&gt;
    tail -30 $pwd/$log_name&lt;br /&gt;
    echo &amp;quot;&amp;amp;lt;/pre&amp;amp;gt;&amp;lt;script&amp;gt;reloading = setTimeout(&#039;window.location.reload();&#039;, 10000);&amp;lt;/script&amp;gt;&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
ts=`date +&amp;quot;%Y-%m-%d %H:%M:%S&amp;quot;`&lt;br /&gt;
if [ &amp;quot;$QUERY_STRING&amp;quot; == &amp;quot;action=stop&amp;quot; ]; then&lt;br /&gt;
    echo &amp;quot;[$ts] Stopping $bot_name.&amp;quot; &amp;gt;&amp;gt; $pwd/$log_name&lt;br /&gt;
    pid=`echo &amp;quot;$temp&amp;quot;|grep &amp;quot;$bot_name&amp;quot;|tail -1|awk &#039;{print $2}&#039;`&lt;br /&gt;
    if [ ${#pid} -ne 0 ]; then&lt;br /&gt;
        kill $pid&lt;br /&gt;
    fi&lt;br /&gt;
    echo &amp;quot;Stopping $bot_name...&amp;lt;script&amp;gt;setInterval(\&amp;quot;window.location.replace(&#039;/$control/&#039;);\&amp;quot;, 2000);&amp;lt;/script&amp;gt;&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
if [ &amp;quot;$QUERY_STRING&amp;quot; == &amp;quot;action=start&amp;quot; ]; then&lt;br /&gt;
    if [ $running -ne 0 ]; then&lt;br /&gt;
        echo &amp;quot;$bot_name is already running...&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
        echo &amp;quot;[$ts] Starting $bot_name.&amp;quot; &amp;gt;&amp;gt; $pwd/$log_name&lt;br /&gt;
        /usr/bin/python3.12 -u /home/$main_domain/$bot_name &amp;gt;&amp;gt; $pwd/$log_name 2&amp;gt;&amp;amp;1 &amp;amp;&lt;br /&gt;
        echo &amp;quot;Starting $bot_name...&amp;lt;script&amp;gt;window.location.replace(&#039;/$control/&#039;);&amp;lt;/script&amp;gt;&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
fi&lt;br /&gt;
if [ &amp;quot;$QUERY_STRING&amp;quot; == &amp;quot;action=clear&amp;quot; ]; then&lt;br /&gt;
    cat /dev/null &amp;gt; $pwd/$log_name&lt;br /&gt;
    echo &amp;quot;Clearing logs...&amp;lt;script&amp;gt;window.location.replace(&#039;/$control/&#039;);&amp;lt;/script&amp;gt;&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
exit 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be sure to edit the variable at the top of the file to match your bot filename.&lt;br /&gt;
&lt;br /&gt;
Now, we need to set the permissions of this &#039;index.sh&#039; file to be executable. On the file manager click the &#039;rw- r-- r--&#039; and check all the &#039;Execute/Search&#039; boxes just like we did the heliobot.py file earlier.&lt;br /&gt;
&lt;br /&gt;
[[File:755_permissions.png]]&lt;br /&gt;
&lt;br /&gt;
== Test It Out ==&lt;br /&gt;
&lt;br /&gt;
Now everything should be ready to be tested. Open your browser and go to &#039;yourdomain.helioho.st/bot_control/&#039; and when you click Start it should start the bot. You can check if the bot is running by going to Discord and seeing if HelioBot is showing up as online now. If it is, test it out by typing the command if you have been following the Python tutorial:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
!hello&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It should respond to you.&lt;br /&gt;
&lt;br /&gt;
[[File:testing_discord_bot.png]]&lt;br /&gt;
&lt;br /&gt;
If it doesn&#039;t work go back and check all the steps again to make sure you did everything correctly. You can also check out the logs in the bot_control dashboard to see if there is any errors listed. For example, if you try to import a modules that isn&#039;t already installed it will give an error like this:&lt;br /&gt;
&lt;br /&gt;
[[File:bot_error.png]]&lt;br /&gt;
&lt;br /&gt;
If you can&#039;t figure out what is wrong let us know by opening [https://helionet.org/index/forum/45-customer-service/?do=add a customer service ticket].&lt;br /&gt;
&lt;br /&gt;
== Watch Your Account Load ==&lt;br /&gt;
&lt;br /&gt;
{{Caution|Bots use a lot of system resources so we recommend [https://heliohost.org/dashboard/load/ keeping an eye on your account load].}}&lt;br /&gt;
&lt;br /&gt;
We enforce a memory limit of no more than {{Template:MemoryLimit}} per day and a limit of {{Template:CPULimit}} usage per day on our shared hosting servers.&lt;br /&gt;
* On the [[:Tommy|Tommy]] and [[:Johnny|Johnny]] servers, if you exceed these limits, your account will be [[:Suspension_Policy#High_Server_Usage|suspended]].&lt;br /&gt;
* On the [[:Morty|Morty]] server, if you exceed these limits, we will charge you for overages.&lt;br /&gt;
&lt;br /&gt;
On the bot_control dashboard it shows the current memory usage, and the estimated usage over the next 24 hours if your bot continues using the same amount of memory.&lt;br /&gt;
&lt;br /&gt;
[[File:bot_dashboard.png]]&lt;br /&gt;
&lt;br /&gt;
If you followed the Python guide exactly your bot will use about 50 GB of memory per day, which is 1/4 of your allowed amount. If you edit your bot code, make your bot more complicated, and import more modules it will increase the memory usage though. Obviously if you have some sort of memory leak it could easily allow your bot to continue consuming more and more memory until you get [[:Suspension_Policy#High_Server_Usage|suspended]] on [[:Tommy]] and [[:Johnny]], or charged for overages on [[:Morty|Morty]].&lt;br /&gt;
&lt;br /&gt;
If everything is working you can shut your bot down by clicking the Stop button on the bot_control dashboard. It&#039;s a good idea to keep your bot offline if you don&#039;t need it so you don&#039;t cause too much load. If you&#039;re having trouble staying under the limits you could also consider [https://heliohost.org/dashboard/move/?move=morty-prepay moving to the Morty plan] where there is no load limit. You could also move to a VPS where you have root SSH access, dedicated memory, dedicated CPU, and no load limits. {{Template:VPSInfo}}&lt;br /&gt;
&lt;br /&gt;
== Automatically Restarting the Bot ==&lt;br /&gt;
&lt;br /&gt;
We&#039;ve had a lot of people ask us if we intentionally stop their bots after 60 minutes or so. The answer is no. The only time we kill processes automatically is if your account got suspended for high load. In our testing the bots can run for weeks or longer without needing to be restarted. Our servers are stable enough to run for months or years without a reboot as well. The issue is undoubtedly that people write bad code that crashes, but rather than admitting that their code is buggy, it&#039;s easier to just blame us.&lt;br /&gt;
&lt;br /&gt;
If your bot keeps stopping on its own, the best solution is to check the logs and fix the issue. If there is nothing shown in the logs that means you need to add more logging to your code to figure out why it&#039;s crashing. If you still can&#039;t figure it out you could enable auto-restart, but it&#039;s really just a crutch for buggy code rather than a real fix. If your bot code really is stable enough to run for weeks or months without crashing, auto-restart can also benefit you in the rare case of us rebooting the whole server, your bot will automatically start up as soon as the reboot is finished.&lt;br /&gt;
&lt;br /&gt;
{{Caution|&lt;br /&gt;
Enabling auto-restart could increase your chance of getting suspended. If you don&#039;t currently need your bot online we recommend shutting it down entirely rather than leaving it restarting over and over.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
To set up auto-restart login to Plesk and navigate to:  &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Login &amp;gt; Plesk &amp;gt; Websites &amp;amp; Domains &amp;gt; [ domain ] &amp;gt; Scheduled Tasks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:plesk-scheduled-tasks.png]]&lt;br /&gt;
&lt;br /&gt;
Next, click &#039;Add Task&#039; and select the &#039;Fetch a URL&#039; option.&lt;br /&gt;
&lt;br /&gt;
[[File:Plesk-schedule-a-task.png]]&lt;br /&gt;
&lt;br /&gt;
In the URL box put the start link from your bot_control page if you would click &#039;Start&#039;. The easiest way to get this value is to stop your bot, and then right click on the &#039;Start&#039; link, and &#039;Copy link address&#039;.&lt;br /&gt;
&lt;br /&gt;
[[File:Telegram-start-link.png]]&lt;br /&gt;
&lt;br /&gt;
If you followed this guide without changing too much it should be something like &#039;yourdomain.helioho.st/bot_control/?action=start&#039;.&lt;br /&gt;
&lt;br /&gt;
[[File:Telegram-cron-job.png]]&lt;br /&gt;
&lt;br /&gt;
For those of you who want to minimize the downtime, and maximize your suspension chance you can set the schedule task up to run every minute like this with Cron Style and &#039;* * * * *&#039;. If everything is working correctly it will check if the bot is up every minute. Then if the bot is stopped it will restart it, and if the bot is already running it won&#039;t do anything.&lt;br /&gt;
&lt;br /&gt;
{{Danger|&lt;br /&gt;
Running a scheduled task every minute increases your load by quite a bit even if your bot never needs to be restarted. Simply checking if it has crashed causes some load. Worst case scenario: this scheduled task starts a new bot process every minute even though you already have a copy of the bot running, and you get suspended on [[:Tommy|Tommy]] or [[:Johnny|Johnny]] in record time, or reach the maximum billing on [[:Morty|Morty]] faster than anyone has ever dreamed possible.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Lucash</name></author>
	</entry>
	<entry>
		<id>https://wiki.helionet.org/index.php?title=Discord_Bot_-_Rust&amp;diff=2208</id>
		<title>Discord Bot - Rust</title>
		<link rel="alternate" type="text/html" href="https://wiki.helionet.org/index.php?title=Discord_Bot_-_Rust&amp;diff=2208"/>
		<updated>2026-02-14T08:53:38Z</updated>

		<summary type="html">&lt;p&gt;Lucash: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Preface ==&lt;br /&gt;
Rust is a compiled, strongly and statically typed general purpose programming language. Compared to Python, Rust applications must be compiled for each operating system and architecture combination, and all variables defined should have a single type.&lt;br /&gt;
&lt;br /&gt;
To learn more about Rust, read [https://doc.rust-lang.org/book/ &amp;quot;The Book&amp;quot;], or follow a more [https://doc.rust-lang.org/rust-by-example/ interactive learning guide] with example code and output.&lt;br /&gt;
&lt;br /&gt;
== Getting Started ==&lt;br /&gt;
What to expect in this section:&lt;br /&gt;
# Installing Rust and Cargo&lt;br /&gt;
# Setting up a Rust project&lt;br /&gt;
# Installing needed dependencies (also known as &amp;quot;crates&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
To get started, install Rust and Cargo (the package manager for Rust) using [https://rustup.rs/ rustup].&lt;br /&gt;
&lt;br /&gt;
Once installed, create a new project by using Cargo.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cargo init ping-pong-rs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running &amp;lt;code&amp;gt;cargo init ping-pong-rs&amp;lt;/code&amp;gt; will create a folder named &amp;lt;code&amp;gt;ping-pong-rs&amp;lt;/code&amp;gt; with the basic structure of a Rust project.&lt;br /&gt;
&lt;br /&gt;
[[File:Rust_discord_init_folder.png]]&lt;br /&gt;
&lt;br /&gt;
Next, we need to install some dependencies (crates). For this tutorial, we&#039;ll be using [https://crates.io/crates/serenity serenity] to interact with Discord, [https://crates.io/crates/tokio tokio] with the &amp;quot;full&amp;quot; feature to manage asynchronous behavior, and [https://crates.io/crates/dotenvy dotenvy] to read your Discord bot token from a file.&lt;br /&gt;
&lt;br /&gt;
To install these crates, use need to use Cargo again.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cargo add dotenvy tokio serenity -F tokio/full&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Once you have the crates installed, you are now ready to code!&lt;br /&gt;
&lt;br /&gt;
== Writing the Discord Bot ==&lt;br /&gt;
What to expect in this section:&lt;br /&gt;
# Creating an example ping-pong bot&lt;br /&gt;
# Building and testing your Discord bot on your machine&lt;br /&gt;
&lt;br /&gt;
We&#039;ll be using a modified version of serenity&#039;s sample ping-pong bot. Open the &amp;lt;code&amp;gt;main.rs&amp;lt;/code&amp;gt; file located in the &amp;lt;code&amp;gt;src&amp;lt;/code&amp;gt; folder and paste the following code inside of it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
use std::env;&lt;br /&gt;
&lt;br /&gt;
use dotenvy::dotenv;&lt;br /&gt;
use serenity::async_trait;&lt;br /&gt;
use serenity::model::channel::Message;&lt;br /&gt;
use serenity::prelude::*;&lt;br /&gt;
&lt;br /&gt;
struct Handler;&lt;br /&gt;
&lt;br /&gt;
#[async_trait]&lt;br /&gt;
impl EventHandler for Handler {&lt;br /&gt;
    async fn message(&amp;amp;self, ctx: Context, msg: Message) {&lt;br /&gt;
        if msg.content == &amp;quot;!ping&amp;quot; {&lt;br /&gt;
            if let Err(why) = msg.channel_id.say(&amp;amp;ctx.http, &amp;quot;Pong!&amp;quot;).await {&lt;br /&gt;
                println!(&amp;quot;Error sending message: {why:?}&amp;quot;);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#[tokio::main]&lt;br /&gt;
async fn main() {&lt;br /&gt;
    // Load all variables from a local environment variable file&lt;br /&gt;
    dotenv().expect(&amp;quot;Expected a .env file to be created&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    // Login with a bot token from the environment&lt;br /&gt;
    let token = env::var(&amp;quot;DISCORD_TOKEN&amp;quot;).expect(&amp;quot;Expected a token in the environment&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    // Set gateway intents, which decides what events the bot will be notified about&lt;br /&gt;
    let intents = GatewayIntents::GUILD_MESSAGES&lt;br /&gt;
        | GatewayIntents::DIRECT_MESSAGES&lt;br /&gt;
        | GatewayIntents::MESSAGE_CONTENT;&lt;br /&gt;
&lt;br /&gt;
    // Create a new instance of the Client, logging in as a bot.&lt;br /&gt;
    let mut client = Client::builder(&amp;amp;token, intents)&lt;br /&gt;
        .event_handler(Handler)&lt;br /&gt;
        .await&lt;br /&gt;
        .expect(&amp;quot;Err creating client&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    println!(&amp;quot;Starting bot&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    // Start listening for events by starting a single shard&lt;br /&gt;
    if let Err(why) = client.start().await {&lt;br /&gt;
        println!(&amp;quot;Client error: {why:?}&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, you&#039;ll need to copy your Discord bot token into a file named &amp;lt;code&amp;gt;.env&amp;lt;/code&amp;gt;. &#039;&#039;&#039;This file should be located in the same place as the &amp;lt;code&amp;gt;src&amp;lt;/code&amp;gt; folder, NOT inside of it&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
[[File:Rust_env_folder_structure.png]]&lt;br /&gt;
&lt;br /&gt;
The environment file should contain your token:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DISCORD_TOKEN=your_discord_bot_token&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, you are now ready to run your bot locally to test it out!&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cargo run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The run command will build and run your bot locally. Remember, Rust is a compiled language. This means that your bot must be compiled before it can be run, this can take around a minute.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
lucas@fozziebear:~/heliohost/ping-pong-rs$ cargo run&lt;br /&gt;
   Compiling proc-macro2 v1.0.106&lt;br /&gt;
   Compiling quote v1.0.44&lt;br /&gt;
   .&lt;br /&gt;
   .&lt;br /&gt;
   .&lt;br /&gt;
   Compiling hyper-rustls v0.27.7&lt;br /&gt;
   Compiling reqwest v0.12.28&lt;br /&gt;
   Compiling ping-pong-rs v0.1.0 (/home/lucas/heliohost/ping-pong-rs)&lt;br /&gt;
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 41.00s&lt;br /&gt;
     Running `target/debug/ping-pong-rs`&lt;br /&gt;
Starting bot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see the message &amp;lt;code&amp;gt;Starting bot&amp;lt;/code&amp;gt; at the end if everything compiled successfully.&lt;br /&gt;
&lt;br /&gt;
Once your project is up and running, return to Discord and type &amp;lt;code&amp;gt;!ping&amp;lt;/code&amp;gt; in the channel your bot is located in and see it return your message!&lt;br /&gt;
&lt;br /&gt;
[[File:Rust_discord_pong.png]]&lt;br /&gt;
&lt;br /&gt;
== Building your Discord Bot for HelioHost ==&lt;br /&gt;
What to expect in this section:&lt;br /&gt;
# How to build the correct file to work in HelioHost&lt;br /&gt;
&lt;br /&gt;
Rust applications must be built to run on the machine that you want to run your application on. In simple terms, this means that to run a Rust Discord bot on HelioHost, you should build a Linux x86_64 application.&lt;br /&gt;
&lt;br /&gt;
For users that are writing code on a Windows machine (this does not include WSL2), or a MacOS machine, you will need to cross compile to the correct architecture.&lt;br /&gt;
&lt;br /&gt;
=== Building a release binary on the same architecture and host ===&lt;br /&gt;
If you are on a system that &#039;&#039;&#039;matches&#039;&#039;&#039; the HelioHost machines (Linux x86_64), then you do not need to cross compile. Simply running a normal release build is enough.&lt;br /&gt;
&amp;lt;pre&amp;gt;cargo build --release&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will build the final file under &amp;lt;code&amp;gt;target/release/ping-pong-rs&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:Rust_discord_build_cargo.png]]&lt;br /&gt;
&lt;br /&gt;
=== Building a release binary on a different host ===&lt;br /&gt;
If you are on a system that &#039;&#039;&#039;does not match&#039;&#039;&#039; the HelioHost machines (Linux x86_64), then you do not need to cross compile. This includes Windows, MacOS, or Linux ARM machines.&lt;br /&gt;
&lt;br /&gt;
The most straightforward way to do this is by using [https://github.com/cross-rs/cross cross]] to build your application inside of a Docker container.&lt;br /&gt;
&lt;br /&gt;
To get started, install [https://www.docker.com/ Docker]. This is most commonly done by installing Docker Desktop for those using Windows or MacOS.&lt;br /&gt;
&lt;br /&gt;
Once you have Docker installed and running, install cross by using Cargo.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cargo install cross --git https://github.com/cross-rs/cross&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After cross has completed building and installing, create a release build for the Linux x86_64 architecture using the tool.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cross build --target x86_64-unknown-linux-gnu --release&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will build the final file under &amp;lt;code&amp;gt;target/x86_64-unknown-linux-gnu/release/ping-pong-rs&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:Rust_discord_build_cross.png]]&lt;br /&gt;
&lt;br /&gt;
== Upload Files to Plesk ==&lt;br /&gt;
You will need to upload both your environment variable file and the binary to your Plesk account to setup.&lt;br /&gt;
&lt;br /&gt;
Navigate to your &#039;&#039;&#039;Home Directory&#039;&#039;&#039; and upload both the &amp;lt;code&amp;gt;.env&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;ping-pong-rs&amp;lt;/code&amp;gt; files.&lt;br /&gt;
&lt;br /&gt;
[[File:Rust_upload_plesk.png]]&lt;br /&gt;
&lt;br /&gt;
== Starting the Discord Bot ==&lt;br /&gt;
To start the Discord bot, read up on the rest of the guide at the [[:Discord_Bot#Starting_and_Stopping_Your_Bot|end of the Discord tutorial]].&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Lucash</name></author>
	</entry>
	<entry>
		<id>https://wiki.helionet.org/index.php?title=Discord_Bot_-_Python&amp;diff=2207</id>
		<title>Discord Bot - Python</title>
		<link rel="alternate" type="text/html" href="https://wiki.helionet.org/index.php?title=Discord_Bot_-_Python&amp;diff=2207"/>
		<updated>2026-02-14T08:53:35Z</updated>

		<summary type="html">&lt;p&gt;Lucash: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Preface ==&lt;br /&gt;
&lt;br /&gt;
Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together. Python&#039;s simple, easy to learn syntax emphasizes readability and therefore reduces the cost of program maintenance. Python supports modules and packages, which encourages program modularity and code reuse.&lt;br /&gt;
&lt;br /&gt;
== Write the Bot Script in Python ==&lt;br /&gt;
&lt;br /&gt;
[https://heliohost.org/login Log in] and continue to Plesk. Then load up the file manager.&lt;br /&gt;
&lt;br /&gt;
[[File:file_manager.png]]&lt;br /&gt;
&lt;br /&gt;
In the top left corner click the &#039;+&#039; plus sign, and select &#039;Create File&#039;.&lt;br /&gt;
&lt;br /&gt;
[[File:plus_file.png]]&lt;br /&gt;
&lt;br /&gt;
Then type the name of your new file: &#039;heliobot.py&#039;.&lt;br /&gt;
&lt;br /&gt;
[[File:create_heliobot.png]]&lt;br /&gt;
&lt;br /&gt;
You want to create this bot in your home directory so random hackers and bots on the internet can&#039;t access it directly. Make sure it says &#039;Add a file to: /&#039; not &#039;Add a file to: /httpdocs&#039; or any other folder.&lt;br /&gt;
&lt;br /&gt;
Scroll down in the file manager and click on the new &#039;heliobot.py&#039; file to edit it. Then copy/paste this code in:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/python3.12&lt;br /&gt;
&lt;br /&gt;
import os&lt;br /&gt;
import discord&lt;br /&gt;
from dotenv import load_dotenv&lt;br /&gt;
&lt;br /&gt;
load_dotenv()&lt;br /&gt;
token = os.getenv(&#039;DISCORD_TOKEN&#039;)&lt;br /&gt;
&lt;br /&gt;
import certifi&lt;br /&gt;
os.environ[&amp;quot;SSL_CERT_FILE&amp;quot;] = certifi.where()&lt;br /&gt;
&lt;br /&gt;
client = discord.Client(intents=discord.Intents.default())&lt;br /&gt;
&lt;br /&gt;
class MyClient(discord.Client):&lt;br /&gt;
    async def on_ready(self):&lt;br /&gt;
        print(f&#039;Logged in as {self.user} (ID: {self.user.id})&#039;)&lt;br /&gt;
        print(&#039;------&#039;)&lt;br /&gt;
&lt;br /&gt;
    async def on_message(self, message):&lt;br /&gt;
        # we do not want the bot to reply to itself&lt;br /&gt;
        if message.author.id == self.user.id:&lt;br /&gt;
            return&lt;br /&gt;
&lt;br /&gt;
        if message.content.startswith(&#039;!hello&#039;):&lt;br /&gt;
            await message.reply(&#039;Hello!&#039;, mention_author=True)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
intents = discord.Intents.default()&lt;br /&gt;
intents.message_content = True&lt;br /&gt;
&lt;br /&gt;
client = MyClient(intents=intents)&lt;br /&gt;
client.run(token)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first line is called the shebang, and it tells the system which version of Python you want to use. Morty, Tommy, and Johnny also have Python 3.9, but we recommend using Python 3.12 like in the example.&lt;br /&gt;
&lt;br /&gt;
Once you have your code copy/pasted in click save in the bottom left corner. Now we need the bot to be executable so in the file manager click the &#039;rw- r-- r--&#039; on the heliobot.py line. &lt;br /&gt;
&lt;br /&gt;
[[File:change_permissions.png]]&lt;br /&gt;
&lt;br /&gt;
Check all three of the &#039;Execute/Search&#039; boxes so it looks like this and then click save in the bottom left corner.&lt;br /&gt;
&lt;br /&gt;
[[File:755_permissions.png]]&lt;br /&gt;
&lt;br /&gt;
Now we need to provide our Discord token to the bot so click the &#039;+&#039; plus sign, and select &#039;Create File&#039; again and this time name the file &#039;.env&#039;.&lt;br /&gt;
&lt;br /&gt;
[[File:dot_env.png]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Make sure you start the filename with a period.&#039;&#039;&#039; It&#039;s easy to miss that in the screenshot. This file needs to be in the &#039;&#039;&#039;same&#039;&#039;&#039; directory as your Python script.&lt;br /&gt;
Now you need to paste your Discord bot token into your &#039;.env&#039; file that you created. So go back to the Plesk file manager and click the &#039;.env&#039; file to edit it. Paste the token into the file like this:&lt;br /&gt;
&lt;br /&gt;
[[File:paste_the_token.png]]&lt;br /&gt;
&lt;br /&gt;
Make sure the line starts with &#039;DISCORD_TOKEN=&#039; like that. Then click &#039;Save Changes&#039; and close the tab. Saving your token separate from your Python code is good practice because this way you can share the code on GitHub or something like that without worrying about people getting access to your bot.&lt;br /&gt;
&lt;br /&gt;
== Starting the Discord Bot ==&lt;br /&gt;
To start the Discord bot, read up on the rest of the guide at the [[:Discord_Bot#Starting_and_Stopping_Your_Bot|end of the Discord tutorial]].&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Lucash</name></author>
	</entry>
	<entry>
		<id>https://wiki.helionet.org/index.php?title=File:Rust_upload_plesk.png&amp;diff=2206</id>
		<title>File:Rust upload plesk.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.helionet.org/index.php?title=File:Rust_upload_plesk.png&amp;diff=2206"/>
		<updated>2026-02-14T08:46:15Z</updated>

		<summary type="html">&lt;p&gt;Lucash: Lucash uploaded a new version of File:Rust upload plesk.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Lucash</name></author>
	</entry>
	<entry>
		<id>https://wiki.helionet.org/index.php?title=File:Rust_upload_plesk.png&amp;diff=2205</id>
		<title>File:Rust upload plesk.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.helionet.org/index.php?title=File:Rust_upload_plesk.png&amp;diff=2205"/>
		<updated>2026-02-14T08:44:15Z</updated>

		<summary type="html">&lt;p&gt;Lucash: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Lucash</name></author>
	</entry>
	<entry>
		<id>https://wiki.helionet.org/index.php?title=Discord_Bot_-_Python&amp;diff=2204</id>
		<title>Discord Bot - Python</title>
		<link rel="alternate" type="text/html" href="https://wiki.helionet.org/index.php?title=Discord_Bot_-_Python&amp;diff=2204"/>
		<updated>2026-02-14T08:31:51Z</updated>

		<summary type="html">&lt;p&gt;Lucash: Created page with &amp;quot;== Preface ==  Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together. Python&amp;#039;s simple, easy to learn syntax emphasizes readability and therefore reduces the cost of program maintenance. Pyt...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Preface ==&lt;br /&gt;
&lt;br /&gt;
Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together. Python&#039;s simple, easy to learn syntax emphasizes readability and therefore reduces the cost of program maintenance. Python supports modules and packages, which encourages program modularity and code reuse.&lt;br /&gt;
&lt;br /&gt;
== Write the Bot Script in Python ==&lt;br /&gt;
&lt;br /&gt;
[https://heliohost.org/login Log in] and continue to Plesk. Then load up the file manager.&lt;br /&gt;
&lt;br /&gt;
[[File:file_manager.png]]&lt;br /&gt;
&lt;br /&gt;
In the top left corner click the &#039;+&#039; plus sign, and select &#039;Create File&#039;.&lt;br /&gt;
&lt;br /&gt;
[[File:plus_file.png]]&lt;br /&gt;
&lt;br /&gt;
Then type the name of your new file: &#039;heliobot.py&#039;.&lt;br /&gt;
&lt;br /&gt;
[[File:create_heliobot.png]]&lt;br /&gt;
&lt;br /&gt;
You want to create this bot in your home directory so random hackers and bots on the internet can&#039;t access it directly. Make sure it says &#039;Add a file to: /&#039; not &#039;Add a file to: /httpdocs&#039; or any other folder.&lt;br /&gt;
&lt;br /&gt;
Scroll down in the file manager and click on the new &#039;heliobot.py&#039; file to edit it. Then copy/paste this code in:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/python3.12&lt;br /&gt;
&lt;br /&gt;
import os&lt;br /&gt;
import discord&lt;br /&gt;
from dotenv import load_dotenv&lt;br /&gt;
&lt;br /&gt;
load_dotenv()&lt;br /&gt;
token = os.getenv(&#039;DISCORD_TOKEN&#039;)&lt;br /&gt;
&lt;br /&gt;
import certifi&lt;br /&gt;
os.environ[&amp;quot;SSL_CERT_FILE&amp;quot;] = certifi.where()&lt;br /&gt;
&lt;br /&gt;
client = discord.Client(intents=discord.Intents.default())&lt;br /&gt;
&lt;br /&gt;
class MyClient(discord.Client):&lt;br /&gt;
    async def on_ready(self):&lt;br /&gt;
        print(f&#039;Logged in as {self.user} (ID: {self.user.id})&#039;)&lt;br /&gt;
        print(&#039;------&#039;)&lt;br /&gt;
&lt;br /&gt;
    async def on_message(self, message):&lt;br /&gt;
        # we do not want the bot to reply to itself&lt;br /&gt;
        if message.author.id == self.user.id:&lt;br /&gt;
            return&lt;br /&gt;
&lt;br /&gt;
        if message.content.startswith(&#039;!hello&#039;):&lt;br /&gt;
            await message.reply(&#039;Hello!&#039;, mention_author=True)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
intents = discord.Intents.default()&lt;br /&gt;
intents.message_content = True&lt;br /&gt;
&lt;br /&gt;
client = MyClient(intents=intents)&lt;br /&gt;
client.run(token)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first line is called the shebang, and it tells the system which version of Python you want to use. Morty, Tommy, and Johnny also have Python 3.9, but we recommend using Python 3.12 like in the example.&lt;br /&gt;
&lt;br /&gt;
Once you have your code copy/pasted in click save in the bottom left corner. Now we need the bot to be executable so in the file manager click the &#039;rw- r-- r--&#039; on the heliobot.py line. &lt;br /&gt;
&lt;br /&gt;
[[File:change_permissions.png]]&lt;br /&gt;
&lt;br /&gt;
Check all three of the &#039;Execute/Search&#039; boxes so it looks like this and then click save in the bottom left corner.&lt;br /&gt;
&lt;br /&gt;
[[File:755_permissions.png]]&lt;br /&gt;
&lt;br /&gt;
Now we need to provide our Discord token to the bot so click the &#039;+&#039; plus sign, and select &#039;Create File&#039; again and this time name the file &#039;.env&#039;.&lt;br /&gt;
&lt;br /&gt;
[[File:dot_env.png]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Make sure you start the filename with a period.&#039;&#039;&#039; It&#039;s easy to miss that in the screenshot. This file needs to be in the &#039;&#039;&#039;same&#039;&#039;&#039; directory as your Python script.&lt;br /&gt;
Now you need to paste your Discord bot token into your &#039;.env&#039; file that you created. So go back to the Plesk file manager and click the &#039;.env&#039; file to edit it. Paste the token into the file like this:&lt;br /&gt;
&lt;br /&gt;
[[File:paste_the_token.png]]&lt;br /&gt;
&lt;br /&gt;
Make sure the line starts with &#039;DISCORD_TOKEN=&#039; like that. Then click &#039;Save Changes&#039; and close the tab. Saving your token separate from your Python code is good practice because this way you can share the code on GitHub or something like that without worrying about people getting access to your bot.&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Lucash</name></author>
	</entry>
	<entry>
		<id>https://wiki.helionet.org/index.php?title=Template:DiscordBotToken&amp;diff=2203</id>
		<title>Template:DiscordBotToken</title>
		<link rel="alternate" type="text/html" href="https://wiki.helionet.org/index.php?title=Template:DiscordBotToken&amp;diff=2203"/>
		<updated>2026-02-14T08:24:05Z</updated>

		<summary type="html">&lt;p&gt;Lucash: Created page with &amp;quot;Go back to the Discord bot page and click bot on the left navigation again.  File:select_bot.png  The first thing we need to do on this page is enable &amp;#039;Presence Intent&amp;#039;, &amp;#039;Server Members Intent&amp;#039;, and &amp;#039;Message Content Intent&amp;#039;. If you&amp;#039;re sure your bot doesn&amp;#039;t need all three of these enable just what you need, but for simplicity of this guide we&amp;#039;re going to enable all three, and then save the changes.  File:discord_intents.png  On the same page click the &amp;#039;Reset Token...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Go back to the Discord bot page and click bot on the left navigation again.&lt;br /&gt;
&lt;br /&gt;
[[File:select_bot.png]]&lt;br /&gt;
&lt;br /&gt;
The first thing we need to do on this page is enable &#039;Presence Intent&#039;, &#039;Server Members Intent&#039;, and &#039;Message Content Intent&#039;. If you&#039;re sure your bot doesn&#039;t need all three of these enable just what you need, but for simplicity of this guide we&#039;re going to enable all three, and then save the changes.&lt;br /&gt;
&lt;br /&gt;
[[File:discord_intents.png]]&lt;br /&gt;
&lt;br /&gt;
On the same page click the &#039;Reset Token&#039; button, and then copy/paste the token.&lt;br /&gt;
&lt;br /&gt;
[[File:copy_token.png]]&lt;br /&gt;
&lt;br /&gt;
If you ever think someone has gotten your token, for instance if you posted it on a public wiki like I just did, be sure to come back to this page and reset it. Anyone who has your token can do whatever permissions you granted your bot to your server.&lt;/div&gt;</summary>
		<author><name>Lucash</name></author>
	</entry>
	<entry>
		<id>https://wiki.helionet.org/index.php?title=Discord_Bot_Rust&amp;diff=2202</id>
		<title>Discord Bot Rust</title>
		<link rel="alternate" type="text/html" href="https://wiki.helionet.org/index.php?title=Discord_Bot_Rust&amp;diff=2202"/>
		<updated>2026-02-14T08:06:51Z</updated>

		<summary type="html">&lt;p&gt;Lucash: Lucash moved page Discord Bot Rust to Discord Bot - Rust&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Discord Bot - Rust]]&lt;/div&gt;</summary>
		<author><name>Lucash</name></author>
	</entry>
	<entry>
		<id>https://wiki.helionet.org/index.php?title=Discord_Bot_-_Rust&amp;diff=2201</id>
		<title>Discord Bot - Rust</title>
		<link rel="alternate" type="text/html" href="https://wiki.helionet.org/index.php?title=Discord_Bot_-_Rust&amp;diff=2201"/>
		<updated>2026-02-14T08:06:51Z</updated>

		<summary type="html">&lt;p&gt;Lucash: Lucash moved page Discord Bot Rust to Discord Bot - Rust&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Preface ==&lt;br /&gt;
Rust is a compiled, strongly and statically typed general purpose programming language. Compared to Python, Rust applications must be compiled for each operating system and architecture combination, and all variables defined should have a single type.&lt;br /&gt;
&lt;br /&gt;
To learn more about Rust, read [https://doc.rust-lang.org/book/ &amp;quot;The Book&amp;quot;], or follow a more [https://doc.rust-lang.org/rust-by-example/ interactive learning guide] with example code and output.&lt;br /&gt;
&lt;br /&gt;
== Getting Started ==&lt;br /&gt;
What to expect in this section:&lt;br /&gt;
# Installing Rust and Cargo&lt;br /&gt;
# Setting up a Rust project&lt;br /&gt;
# Installing needed dependencies (also known as &amp;quot;crates&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
To get started, install Rust and Cargo (the package manager for Rust) using [https://rustup.rs/ rustup].&lt;br /&gt;
&lt;br /&gt;
Once installed, create a new project by using Cargo.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cargo init ping-pong-rs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running &amp;lt;code&amp;gt;cargo init ping-pong-rs&amp;lt;/code&amp;gt; will create a folder named &amp;lt;code&amp;gt;ping-pong-rs&amp;lt;/code&amp;gt; with the basic structure of a Rust project.&lt;br /&gt;
&lt;br /&gt;
[[File:Rust_discord_init_folder.png]]&lt;br /&gt;
&lt;br /&gt;
Next, we need to install some dependencies (crates). For this tutorial, we&#039;ll be using [https://crates.io/crates/serenity serenity] to interact with Discord, [https://crates.io/crates/tokio tokio] with the &amp;quot;full&amp;quot; feature to manage asynchronous behavior, and [https://crates.io/crates/dotenvy dotenvy] to read your Discord bot token from a file.&lt;br /&gt;
&lt;br /&gt;
To install these crates, use need to use Cargo again.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cargo add dotenvy tokio serenity -F tokio/full&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Once you have the crates installed, you are now ready to code!&lt;br /&gt;
&lt;br /&gt;
== Writing the Discord Bot ==&lt;br /&gt;
What to expect in this section:&lt;br /&gt;
# Creating an example ping-pong bot&lt;br /&gt;
# Building and testing your Discord bot on your machine&lt;br /&gt;
&lt;br /&gt;
We&#039;ll be using a modified version of serenity&#039;s sample ping-pong bot. Open the &amp;lt;code&amp;gt;main.rs&amp;lt;/code&amp;gt; file located in the &amp;lt;code&amp;gt;src&amp;lt;/code&amp;gt; folder and paste the following code inside of it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
use std::env;&lt;br /&gt;
&lt;br /&gt;
use dotenvy::dotenv;&lt;br /&gt;
use serenity::async_trait;&lt;br /&gt;
use serenity::model::channel::Message;&lt;br /&gt;
use serenity::prelude::*;&lt;br /&gt;
&lt;br /&gt;
struct Handler;&lt;br /&gt;
&lt;br /&gt;
#[async_trait]&lt;br /&gt;
impl EventHandler for Handler {&lt;br /&gt;
    async fn message(&amp;amp;self, ctx: Context, msg: Message) {&lt;br /&gt;
        if msg.content == &amp;quot;!ping&amp;quot; {&lt;br /&gt;
            if let Err(why) = msg.channel_id.say(&amp;amp;ctx.http, &amp;quot;Pong!&amp;quot;).await {&lt;br /&gt;
                println!(&amp;quot;Error sending message: {why:?}&amp;quot;);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#[tokio::main]&lt;br /&gt;
async fn main() {&lt;br /&gt;
    // Load all variables from a local environment variable file&lt;br /&gt;
    dotenv().expect(&amp;quot;Expected a .env file to be created&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    // Login with a bot token from the environment&lt;br /&gt;
    let token = env::var(&amp;quot;DISCORD_TOKEN&amp;quot;).expect(&amp;quot;Expected a token in the environment&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    // Set gateway intents, which decides what events the bot will be notified about&lt;br /&gt;
    let intents = GatewayIntents::GUILD_MESSAGES&lt;br /&gt;
        | GatewayIntents::DIRECT_MESSAGES&lt;br /&gt;
        | GatewayIntents::MESSAGE_CONTENT;&lt;br /&gt;
&lt;br /&gt;
    // Create a new instance of the Client, logging in as a bot.&lt;br /&gt;
    let mut client = Client::builder(&amp;amp;token, intents)&lt;br /&gt;
        .event_handler(Handler)&lt;br /&gt;
        .await&lt;br /&gt;
        .expect(&amp;quot;Err creating client&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    println!(&amp;quot;Starting bot&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    // Start listening for events by starting a single shard&lt;br /&gt;
    if let Err(why) = client.start().await {&lt;br /&gt;
        println!(&amp;quot;Client error: {why:?}&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, you&#039;ll need to copy your Discord bot token into a file named &amp;lt;code&amp;gt;.env&amp;lt;/code&amp;gt;. &#039;&#039;&#039;This file should be located in the same place as the &amp;lt;code&amp;gt;src&amp;lt;/code&amp;gt; folder, NOT inside of it&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
[[File:Rust_env_folder_structure.png]]&lt;br /&gt;
&lt;br /&gt;
The environment file should contain your token:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DISCORD_TOKEN=your_discord_bot_token&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, you are now ready to run your bot locally to test it out!&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cargo run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The run command will build and run your bot locally. Remember, Rust is a compiled language. This means that your bot must be compiled before it can be run, this can take around a minute.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
lucas@fozziebear:~/heliohost/ping-pong-rs$ cargo run&lt;br /&gt;
   Compiling proc-macro2 v1.0.106&lt;br /&gt;
   Compiling quote v1.0.44&lt;br /&gt;
   .&lt;br /&gt;
   .&lt;br /&gt;
   .&lt;br /&gt;
   Compiling hyper-rustls v0.27.7&lt;br /&gt;
   Compiling reqwest v0.12.28&lt;br /&gt;
   Compiling ping-pong-rs v0.1.0 (/home/lucas/heliohost/ping-pong-rs)&lt;br /&gt;
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 41.00s&lt;br /&gt;
     Running `target/debug/ping-pong-rs`&lt;br /&gt;
Starting bot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see the message &amp;lt;code&amp;gt;Starting bot&amp;lt;/code&amp;gt; at the end if everything compiled successfully.&lt;br /&gt;
&lt;br /&gt;
Once your project is up and running, return to Discord and type &amp;lt;code&amp;gt;!ping&amp;lt;/code&amp;gt; in the channel your bot is located in and see it return your message!&lt;br /&gt;
&lt;br /&gt;
[[File:Rust_discord_pong.png]]&lt;br /&gt;
&lt;br /&gt;
== Building your Discord Bot for HelioHost ==&lt;br /&gt;
What to expect in this section:&lt;br /&gt;
# How to build the correct file to work in HelioHost&lt;br /&gt;
&lt;br /&gt;
Rust applications must be built to run on the machine that you want to run your application on. In simple terms, this means that to run a Rust Discord bot on HelioHost, you should build a Linux x86_64 application.&lt;br /&gt;
&lt;br /&gt;
For users that are writing code on a Windows machine (this does not include WSL2), or a MacOS machine, you will need to cross compile to the correct architecture.&lt;br /&gt;
&lt;br /&gt;
=== Building a release binary on the same architecture and host ===&lt;br /&gt;
If you are on a system that &#039;&#039;&#039;matches&#039;&#039;&#039; the HelioHost machines (Linux x86_64), then you do not need to cross compile. Simply running a normal release build is enough.&lt;br /&gt;
&amp;lt;pre&amp;gt;cargo build --release&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will build the final file under &amp;lt;code&amp;gt;target/release/ping-pong-rs&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:Rust_discord_build_cargo.png]]&lt;br /&gt;
&lt;br /&gt;
=== Building a release binary on a different host ===&lt;br /&gt;
If you are on a system that &#039;&#039;&#039;does not match&#039;&#039;&#039; the HelioHost machines (Linux x86_64), then you do not need to cross compile. This includes Windows, MacOS, or Linux ARM machines.&lt;br /&gt;
&lt;br /&gt;
The most straightforward way to do this is by using [https://github.com/cross-rs/cross cross]] to build your application inside of a Docker container.&lt;br /&gt;
&lt;br /&gt;
To get started, install [https://www.docker.com/ Docker]. This is most commonly done by installing Docker Desktop for those using Windows or MacOS.&lt;br /&gt;
&lt;br /&gt;
Once you have Docker installed and running, install cross by using Cargo.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cargo install cross --git https://github.com/cross-rs/cross&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After cross has completed building and installing, create a release build for the Linux x86_64 architecture using the tool.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cross build --target x86_64-unknown-linux-gnu --release&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will build the final file under &amp;lt;code&amp;gt;target/x86_64-unknown-linux-gnu/release/ping-pong-rs&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:Rust_discord_build_cross.png]]&lt;/div&gt;</summary>
		<author><name>Lucash</name></author>
	</entry>
	<entry>
		<id>https://wiki.helionet.org/index.php?title=Discord_Bot_-_Rust&amp;diff=2200</id>
		<title>Discord Bot - Rust</title>
		<link rel="alternate" type="text/html" href="https://wiki.helionet.org/index.php?title=Discord_Bot_-_Rust&amp;diff=2200"/>
		<updated>2026-02-14T08:04:52Z</updated>

		<summary type="html">&lt;p&gt;Lucash: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Preface ==&lt;br /&gt;
Rust is a compiled, strongly and statically typed general purpose programming language. Compared to Python, Rust applications must be compiled for each operating system and architecture combination, and all variables defined should have a single type.&lt;br /&gt;
&lt;br /&gt;
To learn more about Rust, read [https://doc.rust-lang.org/book/ &amp;quot;The Book&amp;quot;], or follow a more [https://doc.rust-lang.org/rust-by-example/ interactive learning guide] with example code and output.&lt;br /&gt;
&lt;br /&gt;
== Getting Started ==&lt;br /&gt;
What to expect in this section:&lt;br /&gt;
# Installing Rust and Cargo&lt;br /&gt;
# Setting up a Rust project&lt;br /&gt;
# Installing needed dependencies (also known as &amp;quot;crates&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
To get started, install Rust and Cargo (the package manager for Rust) using [https://rustup.rs/ rustup].&lt;br /&gt;
&lt;br /&gt;
Once installed, create a new project by using Cargo.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cargo init ping-pong-rs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running &amp;lt;code&amp;gt;cargo init ping-pong-rs&amp;lt;/code&amp;gt; will create a folder named &amp;lt;code&amp;gt;ping-pong-rs&amp;lt;/code&amp;gt; with the basic structure of a Rust project.&lt;br /&gt;
&lt;br /&gt;
[[File:Rust_discord_init_folder.png]]&lt;br /&gt;
&lt;br /&gt;
Next, we need to install some dependencies (crates). For this tutorial, we&#039;ll be using [https://crates.io/crates/serenity serenity] to interact with Discord, [https://crates.io/crates/tokio tokio] with the &amp;quot;full&amp;quot; feature to manage asynchronous behavior, and [https://crates.io/crates/dotenvy dotenvy] to read your Discord bot token from a file.&lt;br /&gt;
&lt;br /&gt;
To install these crates, use need to use Cargo again.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cargo add dotenvy tokio serenity -F tokio/full&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Once you have the crates installed, you are now ready to code!&lt;br /&gt;
&lt;br /&gt;
== Writing the Discord Bot ==&lt;br /&gt;
What to expect in this section:&lt;br /&gt;
# Creating an example ping-pong bot&lt;br /&gt;
# Building and testing your Discord bot on your machine&lt;br /&gt;
&lt;br /&gt;
We&#039;ll be using a modified version of serenity&#039;s sample ping-pong bot. Open the &amp;lt;code&amp;gt;main.rs&amp;lt;/code&amp;gt; file located in the &amp;lt;code&amp;gt;src&amp;lt;/code&amp;gt; folder and paste the following code inside of it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
use std::env;&lt;br /&gt;
&lt;br /&gt;
use dotenvy::dotenv;&lt;br /&gt;
use serenity::async_trait;&lt;br /&gt;
use serenity::model::channel::Message;&lt;br /&gt;
use serenity::prelude::*;&lt;br /&gt;
&lt;br /&gt;
struct Handler;&lt;br /&gt;
&lt;br /&gt;
#[async_trait]&lt;br /&gt;
impl EventHandler for Handler {&lt;br /&gt;
    async fn message(&amp;amp;self, ctx: Context, msg: Message) {&lt;br /&gt;
        if msg.content == &amp;quot;!ping&amp;quot; {&lt;br /&gt;
            if let Err(why) = msg.channel_id.say(&amp;amp;ctx.http, &amp;quot;Pong!&amp;quot;).await {&lt;br /&gt;
                println!(&amp;quot;Error sending message: {why:?}&amp;quot;);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#[tokio::main]&lt;br /&gt;
async fn main() {&lt;br /&gt;
    // Load all variables from a local environment variable file&lt;br /&gt;
    dotenv().expect(&amp;quot;Expected a .env file to be created&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    // Login with a bot token from the environment&lt;br /&gt;
    let token = env::var(&amp;quot;DISCORD_TOKEN&amp;quot;).expect(&amp;quot;Expected a token in the environment&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    // Set gateway intents, which decides what events the bot will be notified about&lt;br /&gt;
    let intents = GatewayIntents::GUILD_MESSAGES&lt;br /&gt;
        | GatewayIntents::DIRECT_MESSAGES&lt;br /&gt;
        | GatewayIntents::MESSAGE_CONTENT;&lt;br /&gt;
&lt;br /&gt;
    // Create a new instance of the Client, logging in as a bot.&lt;br /&gt;
    let mut client = Client::builder(&amp;amp;token, intents)&lt;br /&gt;
        .event_handler(Handler)&lt;br /&gt;
        .await&lt;br /&gt;
        .expect(&amp;quot;Err creating client&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    println!(&amp;quot;Starting bot&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    // Start listening for events by starting a single shard&lt;br /&gt;
    if let Err(why) = client.start().await {&lt;br /&gt;
        println!(&amp;quot;Client error: {why:?}&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, you&#039;ll need to copy your Discord bot token into a file named &amp;lt;code&amp;gt;.env&amp;lt;/code&amp;gt;. &#039;&#039;&#039;This file should be located in the same place as the &amp;lt;code&amp;gt;src&amp;lt;/code&amp;gt; folder, NOT inside of it&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
[[File:Rust_env_folder_structure.png]]&lt;br /&gt;
&lt;br /&gt;
The environment file should contain your token:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DISCORD_TOKEN=your_discord_bot_token&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, you are now ready to run your bot locally to test it out!&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cargo run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The run command will build and run your bot locally. Remember, Rust is a compiled language. This means that your bot must be compiled before it can be run, this can take around a minute.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
lucas@fozziebear:~/heliohost/ping-pong-rs$ cargo run&lt;br /&gt;
   Compiling proc-macro2 v1.0.106&lt;br /&gt;
   Compiling quote v1.0.44&lt;br /&gt;
   .&lt;br /&gt;
   .&lt;br /&gt;
   .&lt;br /&gt;
   Compiling hyper-rustls v0.27.7&lt;br /&gt;
   Compiling reqwest v0.12.28&lt;br /&gt;
   Compiling ping-pong-rs v0.1.0 (/home/lucas/heliohost/ping-pong-rs)&lt;br /&gt;
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 41.00s&lt;br /&gt;
     Running `target/debug/ping-pong-rs`&lt;br /&gt;
Starting bot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see the message &amp;lt;code&amp;gt;Starting bot&amp;lt;/code&amp;gt; at the end if everything compiled successfully.&lt;br /&gt;
&lt;br /&gt;
Once your project is up and running, return to Discord and type &amp;lt;code&amp;gt;!ping&amp;lt;/code&amp;gt; in the channel your bot is located in and see it return your message!&lt;br /&gt;
&lt;br /&gt;
[[File:Rust_discord_pong.png]]&lt;br /&gt;
&lt;br /&gt;
== Building your Discord Bot for HelioHost ==&lt;br /&gt;
What to expect in this section:&lt;br /&gt;
# How to build the correct file to work in HelioHost&lt;br /&gt;
&lt;br /&gt;
Rust applications must be built to run on the machine that you want to run your application on. In simple terms, this means that to run a Rust Discord bot on HelioHost, you should build a Linux x86_64 application.&lt;br /&gt;
&lt;br /&gt;
For users that are writing code on a Windows machine (this does not include WSL2), or a MacOS machine, you will need to cross compile to the correct architecture.&lt;br /&gt;
&lt;br /&gt;
=== Building a release binary on the same architecture and host ===&lt;br /&gt;
If you are on a system that &#039;&#039;&#039;matches&#039;&#039;&#039; the HelioHost machines (Linux x86_64), then you do not need to cross compile. Simply running a normal release build is enough.&lt;br /&gt;
&amp;lt;pre&amp;gt;cargo build --release&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will build the final file under &amp;lt;code&amp;gt;target/release/ping-pong-rs&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:Rust_discord_build_cargo.png]]&lt;br /&gt;
&lt;br /&gt;
=== Building a release binary on a different host ===&lt;br /&gt;
If you are on a system that &#039;&#039;&#039;does not match&#039;&#039;&#039; the HelioHost machines (Linux x86_64), then you do not need to cross compile. This includes Windows, MacOS, or Linux ARM machines.&lt;br /&gt;
&lt;br /&gt;
The most straightforward way to do this is by using [https://github.com/cross-rs/cross cross]] to build your application inside of a Docker container.&lt;br /&gt;
&lt;br /&gt;
To get started, install [https://www.docker.com/ Docker]. This is most commonly done by installing Docker Desktop for those using Windows or MacOS.&lt;br /&gt;
&lt;br /&gt;
Once you have Docker installed and running, install cross by using Cargo.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cargo install cross --git https://github.com/cross-rs/cross&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After cross has completed building and installing, create a release build for the Linux x86_64 architecture using the tool.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cross build --target x86_64-unknown-linux-gnu --release&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will build the final file under &amp;lt;code&amp;gt;target/x86_64-unknown-linux-gnu/release/ping-pong-rs&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:Rust_discord_build_cross.png]]&lt;/div&gt;</summary>
		<author><name>Lucash</name></author>
	</entry>
	<entry>
		<id>https://wiki.helionet.org/index.php?title=Discord_Bot_-_Rust&amp;diff=2199</id>
		<title>Discord Bot - Rust</title>
		<link rel="alternate" type="text/html" href="https://wiki.helionet.org/index.php?title=Discord_Bot_-_Rust&amp;diff=2199"/>
		<updated>2026-02-14T08:02:36Z</updated>

		<summary type="html">&lt;p&gt;Lucash: /* Building your Discord Bot for HelioHost */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Preface ==&lt;br /&gt;
Rust is a compiled, strongly and statically typed general purpose programming language. Compared to Python, Rust applications must be compiled for each operating system and architecture combination, and all variables defined should have a single type.&lt;br /&gt;
&lt;br /&gt;
To learn more about Rust, read [https://doc.rust-lang.org/book/ &amp;quot;The Book&amp;quot;], or follow a more [https://doc.rust-lang.org/rust-by-example/ interactive learning guide] with example code and output.&lt;br /&gt;
&lt;br /&gt;
== Getting Started ==&lt;br /&gt;
What to expect in this section:&lt;br /&gt;
# Installing Rust and Cargo&lt;br /&gt;
# Setting up a Rust project&lt;br /&gt;
# Installing needed dependencies (also known as &amp;quot;crates&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
To get started, install Rust and Cargo (the package manager for Rust) using [https://rustup.rs/ rustup].&lt;br /&gt;
&lt;br /&gt;
Once installed, create a new project by using &amp;lt;code&amp;gt;cargo init ping-pong-rs&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Running &amp;lt;code&amp;gt;cargo init ping-pong-rs&amp;lt;/code&amp;gt; will create a folder named &amp;lt;code&amp;gt;ping-pong-rs&amp;lt;/code&amp;gt; with the basic structure of a Rust project.&lt;br /&gt;
&lt;br /&gt;
[[File:Rust_discord_init_folder.png]]&lt;br /&gt;
&lt;br /&gt;
Next, we need to install some dependencies (crates). For this tutorial, we&#039;ll be using [https://crates.io/crates/serenity serenity] to interact with Discord, [https://crates.io/crates/tokio tokio] with the &amp;quot;full&amp;quot; feature to manage asynchronous behavior, and [https://crates.io/crates/dotenvy dotenvy] to read your Discord bot token from a file.&lt;br /&gt;
&lt;br /&gt;
To install these crates, use &amp;lt;code&amp;gt;cargo add dotenvy tokio serenity -F tokio/full&amp;lt;/code&amp;gt;. Once you have the crates installed, you are now ready to code!&lt;br /&gt;
&lt;br /&gt;
== Writing the Discord Bot ==&lt;br /&gt;
What to expect in this section:&lt;br /&gt;
# Creating an example ping-pong bot&lt;br /&gt;
# Building and testing your Discord bot on your machine&lt;br /&gt;
&lt;br /&gt;
We&#039;ll be using a modified version of serenity&#039;s sample ping-pong bot. Open the &amp;lt;code&amp;gt;main.rs&amp;lt;/code&amp;gt; file located in the &amp;lt;code&amp;gt;src&amp;lt;/code&amp;gt; folder and paste the following code inside of it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
use std::env;&lt;br /&gt;
&lt;br /&gt;
use dotenvy::dotenv;&lt;br /&gt;
use serenity::async_trait;&lt;br /&gt;
use serenity::model::channel::Message;&lt;br /&gt;
use serenity::prelude::*;&lt;br /&gt;
&lt;br /&gt;
struct Handler;&lt;br /&gt;
&lt;br /&gt;
#[async_trait]&lt;br /&gt;
impl EventHandler for Handler {&lt;br /&gt;
    async fn message(&amp;amp;self, ctx: Context, msg: Message) {&lt;br /&gt;
        if msg.content == &amp;quot;!ping&amp;quot; {&lt;br /&gt;
            if let Err(why) = msg.channel_id.say(&amp;amp;ctx.http, &amp;quot;Pong!&amp;quot;).await {&lt;br /&gt;
                println!(&amp;quot;Error sending message: {why:?}&amp;quot;);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#[tokio::main]&lt;br /&gt;
async fn main() {&lt;br /&gt;
    // Load all variables from a local environment variable file&lt;br /&gt;
    dotenv().expect(&amp;quot;Expected a .env file to be created&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    // Login with a bot token from the environment&lt;br /&gt;
    let token = env::var(&amp;quot;DISCORD_TOKEN&amp;quot;).expect(&amp;quot;Expected a token in the environment&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    // Set gateway intents, which decides what events the bot will be notified about&lt;br /&gt;
    let intents = GatewayIntents::GUILD_MESSAGES&lt;br /&gt;
        | GatewayIntents::DIRECT_MESSAGES&lt;br /&gt;
        | GatewayIntents::MESSAGE_CONTENT;&lt;br /&gt;
&lt;br /&gt;
    // Create a new instance of the Client, logging in as a bot.&lt;br /&gt;
    let mut client = Client::builder(&amp;amp;token, intents)&lt;br /&gt;
        .event_handler(Handler)&lt;br /&gt;
        .await&lt;br /&gt;
        .expect(&amp;quot;Err creating client&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    println!(&amp;quot;Starting bot&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    // Start listening for events by starting a single shard&lt;br /&gt;
    if let Err(why) = client.start().await {&lt;br /&gt;
        println!(&amp;quot;Client error: {why:?}&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, you&#039;ll need to copy your Discord bot token into a file named &amp;lt;code&amp;gt;.env&amp;lt;/code&amp;gt;. &#039;&#039;&#039;This file should be located in the same place as the &amp;lt;code&amp;gt;src&amp;lt;/code&amp;gt; folder, NOT inside of it&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
[[File:Rust_env_folder_structure.png]]&lt;br /&gt;
&lt;br /&gt;
The environment file should contain your token:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DISCORD_TOKEN=your_discord_bot_token&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, you are now ready to run your bot locally to test it out! To run your bot, run &amp;lt;code&amp;gt;cargo run&amp;lt;/code&amp;gt;. The run command will build and run your bot locally. Remember, Rust is a compiled language. This means that your bot must be compiled before it can be run, this can take around a minute.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
lucas@fozziebear:~/heliohost/ping-pong-rs$ cargo run&lt;br /&gt;
   Compiling proc-macro2 v1.0.106&lt;br /&gt;
   Compiling quote v1.0.44&lt;br /&gt;
   .&lt;br /&gt;
   .&lt;br /&gt;
   .&lt;br /&gt;
   Compiling hyper-rustls v0.27.7&lt;br /&gt;
   Compiling reqwest v0.12.28&lt;br /&gt;
   Compiling ping-pong-rs v0.1.0 (/home/lucas/heliohost/ping-pong-rs)&lt;br /&gt;
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 41.00s&lt;br /&gt;
     Running `target/debug/ping-pong-rs`&lt;br /&gt;
Starting bot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see the message &amp;lt;code&amp;gt;Starting bot&amp;lt;/code&amp;gt; at the end if everything compiled successfully.&lt;br /&gt;
&lt;br /&gt;
Once your project is up and running, return to Discord and type &amp;lt;code&amp;gt;!ping&amp;lt;/code&amp;gt; in the channel your bot is located in and see it return your message!&lt;br /&gt;
&lt;br /&gt;
[[File:Rust_discord_pong.png]]&lt;br /&gt;
&lt;br /&gt;
== Building your Discord Bot for HelioHost ==&lt;br /&gt;
What to expect in this section:&lt;br /&gt;
# How to build the correct file to work in HelioHost&lt;br /&gt;
&lt;br /&gt;
Rust applications must be built to run on the machine that you want to run your application on. In simple terms, this means that to run a Rust Discord bot on HelioHost, you should build a Linux x86_64 application.&lt;br /&gt;
&lt;br /&gt;
For users that are writing code on a Windows machine (this does not include WSL2), or a MacOS machine, you will need to cross compile to the correct architecture.&lt;br /&gt;
&lt;br /&gt;
=== Building a release binary on the same architecture and host ===&lt;br /&gt;
If you are on a system that &#039;&#039;&#039;matches&#039;&#039;&#039; the HelioHost machines (Linux x86_64), then you do not need to cross compile. Simply running a normal release build is enough.&lt;br /&gt;
&amp;lt;pre&amp;gt;cargo build --release&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will build the final file under &amp;lt;code&amp;gt;target/release/ping-pong-rs&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:Rust_discord_build_cargo.png]]&lt;br /&gt;
&lt;br /&gt;
=== Building a release binary on a different host ===&lt;br /&gt;
If you are on a system that &#039;&#039;&#039;does not match&#039;&#039;&#039; the HelioHost machines (Linux x86_64), then you do not need to cross compile. This includes Windows, MacOS, or Linux ARM machines.&lt;br /&gt;
&lt;br /&gt;
The most straightforward way to do this is by using [https://github.com/cross-rs/cross cross]] to build your application inside of a Docker container.&lt;br /&gt;
&lt;br /&gt;
To get started, install [https://www.docker.com/ Docker]. This is most commonly done by installing Docker Desktop for those using Windows or MacOS.&lt;br /&gt;
&lt;br /&gt;
Once you have Docker installed and running, install cross by using Cargo.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cargo install cross --git https://github.com/cross-rs/cross&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After cross has completed building and installing, create a release build for the Linux x86_64 architecture using the tool.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cross build --target x86_64-unknown-linux-gnu --release&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will build the final file under &amp;lt;code&amp;gt;target/x86_64-unknown-linux-gnu/release/ping-pong-rs&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:Rust_discord_build_cross.png]]&lt;/div&gt;</summary>
		<author><name>Lucash</name></author>
	</entry>
	<entry>
		<id>https://wiki.helionet.org/index.php?title=File:Rust_discord_build_cross.png&amp;diff=2198</id>
		<title>File:Rust discord build cross.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.helionet.org/index.php?title=File:Rust_discord_build_cross.png&amp;diff=2198"/>
		<updated>2026-02-14T08:01:23Z</updated>

		<summary type="html">&lt;p&gt;Lucash: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Lucash</name></author>
	</entry>
	<entry>
		<id>https://wiki.helionet.org/index.php?title=File:Rust_discord_build_cargo.png&amp;diff=2197</id>
		<title>File:Rust discord build cargo.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.helionet.org/index.php?title=File:Rust_discord_build_cargo.png&amp;diff=2197"/>
		<updated>2026-02-14T07:52:34Z</updated>

		<summary type="html">&lt;p&gt;Lucash: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Lucash</name></author>
	</entry>
	<entry>
		<id>https://wiki.helionet.org/index.php?title=Discord_Bot_-_Rust&amp;diff=2196</id>
		<title>Discord Bot - Rust</title>
		<link rel="alternate" type="text/html" href="https://wiki.helionet.org/index.php?title=Discord_Bot_-_Rust&amp;diff=2196"/>
		<updated>2026-02-14T07:24:36Z</updated>

		<summary type="html">&lt;p&gt;Lucash: Created page with &amp;quot;== Preface == Rust is a compiled, strongly and statically typed general purpose programming language. Compared to Python, Rust applications must be compiled for each operating system and architecture combination, and all variables defined should have a single type.  To learn more about Rust, read [https://doc.rust-lang.org/book/ &amp;quot;The Book&amp;quot;], or follow a more [https://doc.rust-lang.org/rust-by-example/ interactive learning guide] with example code and output.  == Getting...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Preface ==&lt;br /&gt;
Rust is a compiled, strongly and statically typed general purpose programming language. Compared to Python, Rust applications must be compiled for each operating system and architecture combination, and all variables defined should have a single type.&lt;br /&gt;
&lt;br /&gt;
To learn more about Rust, read [https://doc.rust-lang.org/book/ &amp;quot;The Book&amp;quot;], or follow a more [https://doc.rust-lang.org/rust-by-example/ interactive learning guide] with example code and output.&lt;br /&gt;
&lt;br /&gt;
== Getting Started ==&lt;br /&gt;
What to expect in this section:&lt;br /&gt;
# Installing Rust and Cargo&lt;br /&gt;
# Setting up a Rust project&lt;br /&gt;
# Installing needed dependencies (also known as &amp;quot;crates&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
To get started, install Rust and Cargo (the package manager for Rust) using [https://rustup.rs/ rustup].&lt;br /&gt;
&lt;br /&gt;
Once installed, create a new project by using &amp;lt;code&amp;gt;cargo init ping-pong-rs&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Running &amp;lt;code&amp;gt;cargo init ping-pong-rs&amp;lt;/code&amp;gt; will create a folder named &amp;lt;code&amp;gt;ping-pong-rs&amp;lt;/code&amp;gt; with the basic structure of a Rust project.&lt;br /&gt;
&lt;br /&gt;
[[File:Rust_discord_init_folder.png]]&lt;br /&gt;
&lt;br /&gt;
Next, we need to install some dependencies (crates). For this tutorial, we&#039;ll be using [https://crates.io/crates/serenity serenity] to interact with Discord, [https://crates.io/crates/tokio tokio] with the &amp;quot;full&amp;quot; feature to manage asynchronous behavior, and [https://crates.io/crates/dotenvy dotenvy] to read your Discord bot token from a file.&lt;br /&gt;
&lt;br /&gt;
To install these crates, use &amp;lt;code&amp;gt;cargo add dotenvy tokio serenity -F tokio/full&amp;lt;/code&amp;gt;. Once you have the crates installed, you are now ready to code!&lt;br /&gt;
&lt;br /&gt;
== Writing the Discord Bot ==&lt;br /&gt;
What to expect in this section:&lt;br /&gt;
# Creating an example ping-pong bot&lt;br /&gt;
# Building and testing your Discord bot on your machine&lt;br /&gt;
&lt;br /&gt;
We&#039;ll be using a modified version of serenity&#039;s sample ping-pong bot. Open the &amp;lt;code&amp;gt;main.rs&amp;lt;/code&amp;gt; file located in the &amp;lt;code&amp;gt;src&amp;lt;/code&amp;gt; folder and paste the following code inside of it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
use std::env;&lt;br /&gt;
&lt;br /&gt;
use dotenvy::dotenv;&lt;br /&gt;
use serenity::async_trait;&lt;br /&gt;
use serenity::model::channel::Message;&lt;br /&gt;
use serenity::prelude::*;&lt;br /&gt;
&lt;br /&gt;
struct Handler;&lt;br /&gt;
&lt;br /&gt;
#[async_trait]&lt;br /&gt;
impl EventHandler for Handler {&lt;br /&gt;
    async fn message(&amp;amp;self, ctx: Context, msg: Message) {&lt;br /&gt;
        if msg.content == &amp;quot;!ping&amp;quot; {&lt;br /&gt;
            if let Err(why) = msg.channel_id.say(&amp;amp;ctx.http, &amp;quot;Pong!&amp;quot;).await {&lt;br /&gt;
                println!(&amp;quot;Error sending message: {why:?}&amp;quot;);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#[tokio::main]&lt;br /&gt;
async fn main() {&lt;br /&gt;
    // Load all variables from a local environment variable file&lt;br /&gt;
    dotenv().expect(&amp;quot;Expected a .env file to be created&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    // Login with a bot token from the environment&lt;br /&gt;
    let token = env::var(&amp;quot;DISCORD_TOKEN&amp;quot;).expect(&amp;quot;Expected a token in the environment&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    // Set gateway intents, which decides what events the bot will be notified about&lt;br /&gt;
    let intents = GatewayIntents::GUILD_MESSAGES&lt;br /&gt;
        | GatewayIntents::DIRECT_MESSAGES&lt;br /&gt;
        | GatewayIntents::MESSAGE_CONTENT;&lt;br /&gt;
&lt;br /&gt;
    // Create a new instance of the Client, logging in as a bot.&lt;br /&gt;
    let mut client = Client::builder(&amp;amp;token, intents)&lt;br /&gt;
        .event_handler(Handler)&lt;br /&gt;
        .await&lt;br /&gt;
        .expect(&amp;quot;Err creating client&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    println!(&amp;quot;Starting bot&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    // Start listening for events by starting a single shard&lt;br /&gt;
    if let Err(why) = client.start().await {&lt;br /&gt;
        println!(&amp;quot;Client error: {why:?}&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, you&#039;ll need to copy your Discord bot token into a file named &amp;lt;code&amp;gt;.env&amp;lt;/code&amp;gt;. &#039;&#039;&#039;This file should be located in the same place as the &amp;lt;code&amp;gt;src&amp;lt;/code&amp;gt; folder, NOT inside of it&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
[[File:Rust_env_folder_structure.png]]&lt;br /&gt;
&lt;br /&gt;
The environment file should contain your token:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DISCORD_TOKEN=your_discord_bot_token&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, you are now ready to run your bot locally to test it out! To run your bot, run &amp;lt;code&amp;gt;cargo run&amp;lt;/code&amp;gt;. The run command will build and run your bot locally. Remember, Rust is a compiled language. This means that your bot must be compiled before it can be run, this can take around a minute.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
lucas@fozziebear:~/heliohost/ping-pong-rs$ cargo run&lt;br /&gt;
   Compiling proc-macro2 v1.0.106&lt;br /&gt;
   Compiling quote v1.0.44&lt;br /&gt;
   .&lt;br /&gt;
   .&lt;br /&gt;
   .&lt;br /&gt;
   Compiling hyper-rustls v0.27.7&lt;br /&gt;
   Compiling reqwest v0.12.28&lt;br /&gt;
   Compiling ping-pong-rs v0.1.0 (/home/lucas/heliohost/ping-pong-rs)&lt;br /&gt;
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 41.00s&lt;br /&gt;
     Running `target/debug/ping-pong-rs`&lt;br /&gt;
Starting bot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see the message &amp;lt;code&amp;gt;Starting bot&amp;lt;/code&amp;gt; at the end if everything compiled successfully.&lt;br /&gt;
&lt;br /&gt;
Once your project is up and running, return to Discord and type &amp;lt;code&amp;gt;!ping&amp;lt;/code&amp;gt; in the channel your bot is located in and see it return your message!&lt;br /&gt;
&lt;br /&gt;
[[File:Rust_discord_pong.png]]&lt;br /&gt;
&lt;br /&gt;
== Building your Discord Bot for HelioHost ==&lt;br /&gt;
What to expect in this section:&lt;br /&gt;
# How to build the correct file to work in HelioHost&lt;br /&gt;
&lt;br /&gt;
Rust applications must be built to run on the machine that you want to run your application on. In simple terms, this means that to run a Rust Discord bot on HelioHost, you should build a Linux x86_64 application.&lt;/div&gt;</summary>
		<author><name>Lucash</name></author>
	</entry>
	<entry>
		<id>https://wiki.helionet.org/index.php?title=File:Rust_discord_pong.png&amp;diff=2195</id>
		<title>File:Rust discord pong.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.helionet.org/index.php?title=File:Rust_discord_pong.png&amp;diff=2195"/>
		<updated>2026-02-14T07:07:11Z</updated>

		<summary type="html">&lt;p&gt;Lucash: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Lucash</name></author>
	</entry>
	<entry>
		<id>https://wiki.helionet.org/index.php?title=File:Rust_discord_init_folder.png&amp;diff=2194</id>
		<title>File:Rust discord init folder.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.helionet.org/index.php?title=File:Rust_discord_init_folder.png&amp;diff=2194"/>
		<updated>2026-02-14T06:57:55Z</updated>

		<summary type="html">&lt;p&gt;Lucash: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Lucash</name></author>
	</entry>
	<entry>
		<id>https://wiki.helionet.org/index.php?title=File:Rust_env_folder_structure.png&amp;diff=2193</id>
		<title>File:Rust env folder structure.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.helionet.org/index.php?title=File:Rust_env_folder_structure.png&amp;diff=2193"/>
		<updated>2026-02-14T06:54:22Z</updated>

		<summary type="html">&lt;p&gt;Lucash: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Lucash</name></author>
	</entry>
</feed>