summary refs log tree commit diff
path: root/src/listener.rs
diff options
context:
space:
mode:
authorashelyn ghost <git@ashen.earth>2024-07-08 21:30:34 -0600
committerAshelyn Rose <git@ashen.earth>2024-07-08 21:30:34 -0600
commitd22f2b74d8931a32da0ed970bedcb4e49f4934f7 (patch)
tree45a595ba1ef413a6719458a3a7aed2bd33cea791 /src/listener.rs
parent2bacf887c0f3aff01d60dd1255b2d0e673f550ea (diff)
Basic proxying
Diffstat (limited to 'src/listener.rs')
-rw-r--r--src/listener.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/listener.rs b/src/listener.rs
index 1db480f..9d0e062 100644
--- a/src/listener.rs
+++ b/src/listener.rs
@@ -1,5 +1,5 @@
 use tokio::sync::mpsc::Sender;
-use twilight_model::{id::{Id, marker::{MessageMarker, UserMarker}}, user::User};
+use twilight_model::{channel::ChannelMention, id::{Id, marker::{ChannelMarker, MessageMarker, UserMarker}}, user::User};
 use twilight_gateway::{error::ReceiveMessageError, Intents, Shard, ShardId};
 use twilight_model::util::Timestamp;
 
@@ -17,8 +17,6 @@ impl Listener {
     }
 
     pub async fn start_listening(&mut self, channel : Sender<ClientEvent>) {
-        println!("Starting client with token: {}", self.config.discord_token);
-
         let intents = Intents::GUILD_MEMBERS | Intents::GUILD_PRESENCES | Intents::GUILD_MESSAGES | Intents::MESSAGE_CONTENT;
 
         let mut shard = Shard::new(ShardId::ONE, self.config.discord_token.clone(), intents);
@@ -39,6 +37,7 @@ impl Listener {
                             if let Err(_) = channel.send(ClientEvent::Message {
                                 event_time: message.timestamp,
                                 message_id: message.id,
+                                channel_id: message.channel_id,
                                 author: message.author.clone(),
                                 content: message.content.clone()
                             }).await {
@@ -61,6 +60,7 @@ impl Listener {
                             if let Err(_) = channel.send(ClientEvent::Message {
                                 event_time: message.edited_timestamp.unwrap(),
                                 message_id: message.id,
+                                channel_id: message.channel_id,
                                 author: message.author.unwrap(),
                                 content: message.content.unwrap()
                             }).await {
@@ -92,6 +92,7 @@ pub enum ClientEvent {
     Message {
         event_time: Timestamp,
         message_id: Id<MessageMarker>,
+        channel_id: Id<ChannelMarker>,
         author: User,
         content: String,
     },