mirror of
http://shenjack.top:5100/shenjack/icalingua-python-bot.git
synced 2025-04-12 19:59:55 +08:00
hmmm
This commit is contained in:
parent
9da0b37db2
commit
16fee092ba
|
@ -1,5 +1,5 @@
|
||||||
use crate::data_struct::ica::messages::{DeleteMessage, SendMessage};
|
use crate::data_struct::ica::messages::{DeleteMessage, SendMessage};
|
||||||
use crate::data_struct::ica::{RoomId, RoomIdTrait};
|
use crate::data_struct::ica::{RoomId, RoomIdTrait, UserId};
|
||||||
use crate::error::{ClientResult, IcaError};
|
use crate::error::{ClientResult, IcaError};
|
||||||
use crate::MainStatus;
|
use crate::MainStatus;
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ use colored::Colorize;
|
||||||
use ed25519_dalek::{Signature, Signer, SigningKey};
|
use ed25519_dalek::{Signature, Signer, SigningKey};
|
||||||
use rust_socketio::asynchronous::Client;
|
use rust_socketio::asynchronous::Client;
|
||||||
use rust_socketio::Payload;
|
use rust_socketio::Payload;
|
||||||
use serde_json::Value;
|
use serde_json::{Value, json};
|
||||||
use tracing::{debug, event, span, warn, Level};
|
use tracing::{debug, event, span, warn, Level};
|
||||||
|
|
||||||
/// "安全" 的 发送一条消息
|
/// "安全" 的 发送一条消息
|
||||||
|
@ -114,7 +114,8 @@ pub async fn send_room_sign_in(client: &Client, room_id: RoomId) -> bool {
|
||||||
event!(Level::WARN, "不能向私聊发送签到信息");
|
event!(Level::WARN, "不能向私聊发送签到信息");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
match client.emit("sendGroupSign", room_id).await {
|
let data = json!(room_id.abs());
|
||||||
|
match client.emit("sendGroupSign", data).await {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
event!(Level::INFO, "已向群 {} 发送签到信息", room_id);
|
event!(Level::INFO, "已向群 {} 发送签到信息", room_id);
|
||||||
true
|
true
|
||||||
|
@ -128,17 +129,10 @@ pub async fn send_room_sign_in(client: &Client, room_id: RoomId) -> bool {
|
||||||
|
|
||||||
/// 向某个群/私聊的某个人发送戳一戳
|
/// 向某个群/私聊的某个人发送戳一戳
|
||||||
pub async fn send_poke(client: &Client, room_id: RoomId, target: UserId) -> bool {
|
pub async fn send_poke(client: &Client, room_id: RoomId, target: UserId) -> bool {
|
||||||
|
let data = json!([room_id, target]);
|
||||||
match client.emit(
|
match client.emit(
|
||||||
"sendGroupPoke",
|
"sendGroupPoke", data
|
||||||
(room_id, {
|
).await {
|
||||||
if room_id.is_chat() {
|
|
||||||
room_id
|
|
||||||
// 以防你 target 写错了
|
|
||||||
} else {
|
|
||||||
target
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
) {
|
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
event!(Level::INFO, "已向 {} 的 {} 发送戳一戳", room_id, target);
|
event!(Level::INFO, "已向 {} 的 {} 发送戳一戳", room_id, target);
|
||||||
true
|
true
|
||||||
|
|
|
@ -8,7 +8,7 @@ use tracing::{event, Level};
|
||||||
use crate::data_struct::ica::messages::{
|
use crate::data_struct::ica::messages::{
|
||||||
DeleteMessage, MessageTrait, NewMessage, ReplyMessage, SendMessage,
|
DeleteMessage, MessageTrait, NewMessage, ReplyMessage, SendMessage,
|
||||||
};
|
};
|
||||||
use crate::data_struct::ica::{MessageId, RoomId, RoomIdTrait};
|
use crate::data_struct::ica::{MessageId, RoomId, RoomIdTrait, UserId};
|
||||||
use crate::ica::client::{delete_message, send_message, send_poke, send_room_sign_in};
|
use crate::ica::client::{delete_message, send_message, send_poke, send_room_sign_in};
|
||||||
use crate::MainStatus;
|
use crate::MainStatus;
|
||||||
|
|
||||||
|
|
1
news.md
1
news.md
|
@ -15,6 +15,7 @@
|
||||||
- 用于发送戳一戳
|
- 用于发送戳一戳
|
||||||
- 可以指定群的某个人
|
- 可以指定群的某个人
|
||||||
- 或者指定好友
|
- 或者指定好友
|
||||||
|
- 目前还是有点问题
|
||||||
- socketio event: `sendGroupPoke`
|
- socketio event: `sendGroupPoke`
|
||||||
|
|
||||||
## 0.7.4
|
## 0.7.4
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
nightly
|
|
2
rust-toolchain.toml
Normal file
2
rust-toolchain.toml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[toolchain]
|
||||||
|
channel = "stable"
|
Loading…
Reference in New Issue
Block a user