Skip to content

Commit 4cac1b7

Browse files
committed
not only bf1 for messages
1 parent a6f663b commit 4cac1b7

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/message.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use std::collections::HashMap;
2+
13
use serenity::{client::Context, model::id::ChannelId};
24
use anyhow::Result;
35
use super::server_info;
@@ -89,9 +91,14 @@ pub async fn check(ctx: Context, status: server_info::ServerInfo, mut globals: G
8991
pub async fn send(ctx: Context, statics: Static, image_url: &str, status: server_info::ServerInfo, title: &str,
9092
description: &str) -> Result<serenity::model::channel::Message, serenity::Error> {
9193
let paths = vec![image_url];
94+
let games = HashMap::from([
95+
("tunguska", "bf1"),
96+
("casablanca", "bfv"),
97+
("kingston", "bf2042"),
98+
]);
9299
ChannelId(statics.message_channel).send_files(&ctx.http, paths, |m| {
93100
m.embed(|e| {
94-
e.url(format!("https://gametools.network/servers/bf1/gameid/{}/pc", status.game_id.unwrap_or_default()));
101+
e.url(format!("https://gametools.network/servers/{}/gameid/{}/pc", games.get(&statics.game[..]).unwrap_or(&&statics.game[..]), status.game_id.unwrap_or_default()));
95102
e.title(title);
96103
e.description(description);
97104
e.footer(|f| {

0 commit comments

Comments
 (0)