Touch-up on couple variables
Some checks failed
Build and push container image / build (push) Has been cancelled

This commit is contained in:
toast 2024-01-08 02:40:54 +11:00
parent 0add286511
commit b2ac0db156
4 changed files with 9 additions and 8 deletions

2
Cargo.lock generated
View File

@ -822,7 +822,7 @@ dependencies = [
[[package]] [[package]]
name = "kon" name = "kon"
version = "0.1.7" version = "0.1.8"
dependencies = [ dependencies = [
"cargo_toml", "cargo_toml",
"gamedig", "gamedig",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "kon" name = "kon"
version = "0.1.7" version = "0.1.8"
rust-version = "1.74" rust-version = "1.74"
edition = "2021" edition = "2021"

View File

@ -1,4 +1,4 @@
use crate::{Error, COLOR}; use crate::{Error, EMBED_COLOR};
use gamedig::protocols::{ use gamedig::protocols::{
valve::{ valve::{
@ -82,7 +82,7 @@ pub async fn ats(ctx: poise::Context<'_, (), Error>) -> Result<(), Error> {
match query_server() { match query_server() {
Ok(response) => { Ok(response) => {
ctx.send(|m| m.embed(|e| ctx.send(|m| m.embed(|e|
e.color(COLOR) e.color(EMBED_COLOR)
.title("American Truck Simulator Server Status") .title("American Truck Simulator Server Status")
.fields(vec![ .fields(vec![
("Name", format!("{}", response.info.name), true), ("Name", format!("{}", response.info.name), true),
@ -126,7 +126,7 @@ pub async fn wg(ctx: poise::Context<'_, (), Error>) -> Result<(), Error> {
} }
ctx.send(|m| m.embed(|e| ctx.send(|m| m.embed(|e|
e.color(COLOR) e.color(EMBED_COLOR)
.title("World of Tanks Server Status") .title("World of Tanks Server Status")
.fields(embed_fields) .fields(embed_fields)
)).await?; )).await?;

View File

@ -5,7 +5,8 @@ use std::env::var;
type Error = Box<dyn std::error::Error + Send + Sync>; type Error = Box<dyn std::error::Error + Send + Sync>;
pub static COLOR: i32 = 0x5a99c7; pub static EMBED_COLOR: i32 = 0x5a99c7;
static BOT_READY_NOTIFY: u64 = 865673694184996888;
async fn on_ready( async fn on_ready(
ctx: &serenity::Context, ctx: &serenity::Context,
@ -14,8 +15,8 @@ async fn on_ready(
) -> Result<(), Error> { ) -> Result<(), Error> {
println!("Connected to API as {}", ready.user.name); println!("Connected to API as {}", ready.user.name);
serenity::ChannelId(865673694184996888).send_message(&ctx.http, |m| m.embed(|e| serenity::ChannelId(BOT_READY_NOTIFY).send_message(&ctx.http, |m| m.embed(|e|
e.color(COLOR) e.color(EMBED_COLOR)
.thumbnail(ready.user.avatar_url().unwrap_or_default()) .thumbnail(ready.user.avatar_url().unwrap_or_default())
.author(|a| .author(|a|
a.name(format!("{} is ready!", ready.user.name)) a.name(format!("{} is ready!", ready.user.name))