Compare commits

...

2 Commits

Author SHA1 Message Date
Vicky d49f818637 Added barebones reactions proof of concept. 2025-01-15 17:06:54 +01:00
Dandaedre cafc860b6f Examples mostly 2024-11-30 00:43:26 +01:00
2 changed files with 49 additions and 4 deletions

View File

@ -3,6 +3,9 @@ name = "idlefox"
version = "0.1.0"
edition = "2021"
[features]
custom_emojis = []
[dependencies]
poise = "0.6.1"
poise_macros = "0.6.1"

View File

@ -15,7 +15,9 @@
use crate::votes::EventHolder;
use chrono::{DateTime, Local, NaiveDate};
use poise::serenity_prelude::{self, CacheHttp, ChannelId};
use poise::serenity_prelude::{
self, CacheHttp, ChannelId, CreateMessage, EmojiId, Mention, ReactionType, RoleId,
};
/// The main scheduler waiting and dispatch loop.
///
@ -42,14 +44,54 @@ async fn fk_around(ev_ctx: &EventHolder) {
Local::now() // &ev_ctx
);
if let Some(discord_ctx) = ev_ctx.discord_ctx.lock().await.as_mut() {
println!("Fking around : {:#?}", discord_ctx);
let mut m = serenity_prelude::Message::default();
m.content = "Bob".into();
println!("Full discord ctx : {:#?}", discord_ctx);
let m = CreateMessage::new().content(format!(
"Hello {}",
Mention::from(RoleId::new(1222612097091768371))
));
// let mut m = serenity_prelude::Message::default();
// discord_ctx.http.get_scheduled_event_users(, , , , )
// discord_ctx.http.get_user(UserId::new(1));
// let m = m
// m.content = format!("Hello {}", Mention::from(UserId::new(1)));
// m.mentions = vec![User::];
// m.mention_roles = vec![];
let r = discord_ctx
.http()
.send_message(ChannelId::new(1300786300143800351), Vec::new(), &m)
.await;
println!("{:?}", r);
if let Ok(msg) = r {
#[cfg(not(feature = "custom_emojis"))]
let msg_result = discord_ctx
.http()
.create_reaction(
msg.channel_id,
msg.id,
&ReactionType::Unicode("1️⃣".to_string()),
)
.await;
#[cfg(feature = "custom_emojis")]
let msg_result = discord_ctx
.http()
.create_reaction(
msg.channel_id,
msg.id,
&ReactionType::Custom {
animated: false,
id: (EmojiId::new(1329095596396642375)),
name: (Some("Foxo".to_string())),
},
)
.await;
println!("{:?}", msg_result);
}
}
}