even better pk handling

master
Skye 2 years ago
parent 1199521e40
commit 8acf38fd5a
Signed by: me
GPG Key ID: 0104BC05F41B77B8

@ -55,13 +55,26 @@ impl EventHandler for Handler {
let mut msgs = channel
.messages(&ctx, |messages| messages.after(after))
.await
.unwrap();
.unwrap()
.into_iter()
.filter(|message| message.id <= msg.id)
.rev()
.collect::<Vec<_>>();
tokio::time::sleep(Duration::from_millis(250)).await;
let current_id = ctx.http.get_current_user().await.unwrap().id;
msgs.append(
&mut channel
.messages(&ctx, |messages| messages.after(msg.id))
.await
.unwrap()
.into_iter()
.filter(|message| message.webhook_id.is_some())
.rev()
.collect::<Vec<_>>(),
);
msgs.reverse();
let current_id = ctx.http.get_current_user().await.unwrap().id;
for pk_msg in msgs
.clone()
@ -220,27 +233,4 @@ async fn main() {
if let Err(why) = client.start().await {
println!("Client error: {:?}", why);
}
// let messages = vec![openai::Message {
// role: openai::Role::User,
// content: String::from("Say this is a test!"),
// }];
// let chat_completion = openai::ChatCompletion {
// model: String::from("gpt-3.5-turbo"),
// messages,
// ..Default::default()
// };
// match client.create_chat_completion(chat_completion).await {
// Ok(response) => {
// println!(
// "Chat completion response: {:?}",
// response.choices.first().unwrap().message.content
// );
// }
// Err(error) => {
// eprintln!("Error: {}", error);
// }
// }
}

Loading…
Cancel
Save