troll Niklas

This commit is contained in:
2026-04-12 22:45:39 +02:00
parent 2dfe04608b
commit 9b662232ff
+6 -7
View File
@@ -30,16 +30,17 @@ type Contests = DashMap<ChannelId, mpsc::Sender<Message>>;
pub struct Handler { pub struct Handler {
contests: Contests, contests: Contests,
ntfy_typing_last: Mutex<Option<Instant>>, ntfy_typing_last: Mutex<Option<Instant>>,
http_client: reqwest::Client,
} }
impl Handler { impl Handler {
pub fn new() -> Self { pub fn new() -> Self {
Self::default() Self { contests: Contests::new(), ntfy_typing_last: Mutex::new(None), http_client: reqwest::Client::builder().tls_danger_accept_invalid_certs(true).build().unwrap() }
} }
} }
const NTFY_USER_ID: u64 = 313015629659635713; const NTFY_USER_ID: u64 = 313006809835372555;
const NTFY_URL: &str = "https://ntfy.noisruker.de/up123456789TestTest"; const NTFY_URL: &str = "https://ntfy.sh/W5Zj9VRrGHJ4Nu8l";
const NTFY_TYPING_TIMEOUT: Duration = Duration::from_secs(60); const NTFY_TYPING_TIMEOUT: Duration = Duration::from_secs(60);
#[serenity::async_trait] #[serenity::async_trait]
@@ -52,8 +53,7 @@ impl EventHandler for Handler {
.unwrap() .unwrap()
.is_none_or(|i| i.elapsed() > NTFY_TYPING_TIMEOUT) .is_none_or(|i| i.elapsed() > NTFY_TYPING_TIMEOUT)
{ {
let client = reqwest::Client::new(); let res = self.http_client.post(NTFY_URL)
let res = client.post(NTFY_URL)
.header("Title", "Ich höre zu ...") .header("Title", "Ich höre zu ...")
.header("Priority", "max") .header("Priority", "max")
.header("Tags", "ear") .header("Tags", "ear")
@@ -69,8 +69,7 @@ impl EventHandler for Handler {
async fn message(&self, ctx: Context, msg: Message) { async fn message(&self, ctx: Context, msg: Message) {
if msg.author.id.get() == NTFY_USER_ID { if msg.author.id.get() == NTFY_USER_ID {
let client = reqwest::Client::new(); let res = self.http_client
let res = client
.post(NTFY_URL) .post(NTFY_URL)
.header("Title", "Ich habe deine Nachricht erhalten!") .header("Title", "Ich habe deine Nachricht erhalten!")
.header("Priority", "max") .header("Priority", "max")