hang self

This commit is contained in:
Sense T 2024-01-08 13:02:59 +08:00
parent 92f637c1c8
commit cce1c1f059
2 changed files with 31 additions and 6 deletions

View File

@ -16,8 +16,9 @@ use crate::{
config::Args, config::Args,
db_controller::Controller, db_controller::Controller,
messages::{ messages::{
BOT_ABOUT, BOT_TEXT_HANGED, BOT_TEXT_IS_CHANNEL, BOT_TEXT_NO_TARGET, BOT_TEXT_TOP_GLOBAL, BOT_ABOUT, BOT_TEXT_HANGED, BOT_TEXT_HANGED_SELF, BOT_TEXT_IS_CHANNEL, BOT_TEXT_NO_TARGET,
BOT_TEXT_TOP_GROUP, BOT_TEXT_TOP_NONE, BOT_TEXT_TOP_TEMPLATE, BOT_TEXT_TOP_TITLE, BOT_TEXT_TOP_GLOBAL, BOT_TEXT_TOP_GROUP, BOT_TEXT_TOP_NONE, BOT_TEXT_TOP_TEMPLATE,
BOT_TEXT_TOP_TITLE,
}, },
}; };
@ -106,9 +107,24 @@ impl CommandHandler {
match reply.from() { match reply.from() {
Some(user) => { Some(user) => {
let is_self = match message.from() {
Some(f) => f.first_name == user.first_name,
None => false,
};
let mut vars = HashMap::new(); let mut vars = HashMap::new();
let index = OsRng.gen::<usize>() % BOT_TEXT_HANGED.len();
let text = BOT_TEXT_HANGED[index]; let index = if is_self {
OsRng.gen::<usize>() % BOT_TEXT_HANGED_SELF.len()
} else {
OsRng.gen::<usize>() % BOT_TEXT_HANGED.len()
};
let text = if is_self {
BOT_TEXT_HANGED_SELF[index]
} else {
BOT_TEXT_HANGED[index]
};
vars.insert("name".to_string(), user.first_name.as_str()); vars.insert("name".to_string(), user.first_name.as_str());

View File

@ -14,8 +14,7 @@ const BOT_TEXT_HANGED_2: &'static str = "因为 {name} 太过逆天,我们把
const BOT_TEXT_HANGED_3: &'static str = "{name} 吊在了路灯上TA 兴风作浪的时代结束了……"; const BOT_TEXT_HANGED_3: &'static str = "{name} 吊在了路灯上TA 兴风作浪的时代结束了……";
const BOT_TEXT_HANGED_4: &'static str = "吊在路灯上的 {name} 正在接受大家的鄙视……"; const BOT_TEXT_HANGED_4: &'static str = "吊在路灯上的 {name} 正在接受大家的鄙视……";
const BOT_TEXT_HANGED_5: &'static str = "对 {name} 来说,绳命来得快去得也快,只有路灯是永恒的……"; const BOT_TEXT_HANGED_5: &'static str = "对 {name} 来说,绳命来得快去得也快,只有路灯是永恒的……";
const BOT_TEXT_HANGED_6: &'static str = const BOT_TEXT_HANGED_6: &'static str = "被套上麻袋的 {name} 在经历了一顿胖揍之后,最后还是成了路灯的挂件……";
"被套上麻袋的 {name} 在经历了一顿胖揍之后,最后还是成了路灯的挂件……";
pub const BOT_TEXT_HANGED: [&str; 6] = [ pub const BOT_TEXT_HANGED: [&str; 6] = [
BOT_TEXT_HANGED_1, BOT_TEXT_HANGED_1,
@ -25,3 +24,13 @@ pub const BOT_TEXT_HANGED: [&str; 6] = [
BOT_TEXT_HANGED_5, BOT_TEXT_HANGED_5,
BOT_TEXT_HANGED_6, BOT_TEXT_HANGED_6,
]; ];
const BOT_TEXT_HANGED_SELF_1: &'static str = "{name} 承受不了自己所做的一切,选择了自行了断……";
const BOT_TEXT_HANGED_SELF_2: &'static str = "对于 {name} 来说,把自己吊在路灯上可能是最好的选择了……";
const BOT_TEXT_HANGED_SELF_3: &'static str = "{name} 最终还是选择了逃避……";
pub const BOT_TEXT_HANGED_SELF: [&str; 3] = [
BOT_TEXT_HANGED_SELF_1,
BOT_TEXT_HANGED_SELF_2,
BOT_TEXT_HANGED_SELF_3,
];