access_token is defined in env variable

This commit is contained in:
ModulatingForce 2023-11-28 01:49:51 -05:00
parent a28574dd77
commit 2e07297600
5 changed files with 24 additions and 17 deletions

18
Cargo.lock generated
View file

@ -107,15 +107,6 @@ version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa"
[[package]]
name = "daphbot"
version = "0.1.0"
dependencies = [
"dotenv",
"tokio",
"twitch-irc",
]
[[package]]
name = "dotenv"
version = "0.15.0"
@ -156,6 +147,15 @@ version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5"
[[package]]
name = "forcebot_rs"
version = "0.1.0"
dependencies = [
"dotenv",
"tokio",
"twitch-irc",
]
[[package]]
name = "foreign-types"
version = "0.3.2"

View file

@ -1,5 +1,5 @@
[package]
name = "daphbot"
name = "forcebot_rs"
version = "0.1.0"
edition = "2021"

View file

@ -1,4 +1,10 @@
# Forcebot
test ModulatingForceBot
test ModulatingForceBot
## Usage
Set the following environment variables
`access_token = <oath token>`

View file

@ -1,5 +1,5 @@
{
description = "daphbot flake";
description = "forcebot_rs flake";
inputs = {
nixpkgs = {
@ -13,7 +13,7 @@
};
in {
devShells.${system}.default = pkgs.mkShell {
name = "daphbot-devenv";
name = "forcebot_rs-devenv";
buildInputs = with pkgs; [
openssl
pkg-config

View file

@ -2,11 +2,12 @@ use twitch_irc::login::StaticLoginCredentials;
use twitch_irc::ClientConfig;
use twitch_irc::SecureTCPTransport;
use twitch_irc::TwitchIRCClient;
use std::env;
#[tokio::main]
pub async fn main() {
let login_name = "daphbot".to_owned();
let oauth_token = "".to_owned();
let login_name = "modulatingforcebot".to_owned();
let oauth_token = env::var("access_token").unwrap().to_owned();
let config = ClientConfig::new_simple(
StaticLoginCredentials::new(login_name, Some(oauth_token))
@ -20,8 +21,8 @@ pub async fn main() {
}
});
client.join("daph".to_owned()).unwrap();
client.say("daph".to_owned(), "Connected!".to_owned()).await.unwrap();
client.join("modulatingforcebot".to_owned()).unwrap();
client.say("modulatingforcebot".to_owned(), "Connected!".to_owned()).await.unwrap();
join_handle.await.unwrap();
}