Skip to content

Commit ee4f42b

Browse files
committed
fix bot
1 parent d3cf300 commit ee4f42b

File tree

6 files changed

+37
-120
lines changed

6 files changed

+37
-120
lines changed

flake.nix

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,22 @@
3232
pkg-config
3333
eza
3434
fd
35+
clang
36+
mold
3537
rust-bin.beta.latest.default
3638
];
3739

40+
LD_LIBRARY_PATH = lib.makeLibraryPath [
41+
openssl
42+
];
43+
3844
shellHook = ''
39-
alias ls=eza
40-
alias find=fd
45+
if [ -f .env ]; then
46+
set -a
47+
source .env
48+
set +a
49+
echo "Loaded environment variables from .env"
50+
fi
4151
'';
4252
};
4353
}

src/ai_message.rs

Lines changed: 24 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -29,84 +29,6 @@ pub enum ToolError {
2929
Pool(#[from] r2d2::Error),
3030
}
3131

32-
#[derive(Deserialize, Serialize, Debug)]
33-
struct SocialCreditArgs {
34-
social_credit: i64,
35-
remove: Option<bool>,
36-
}
37-
38-
#[derive(Serialize)]
39-
struct SocialCredit(
40-
#[serde(skip)] r2d2::Pool<SqliteConnectionManager>,
41-
u64,
42-
#[serde(skip)] ToolCallLogger,
43-
);
44-
45-
impl Tool for SocialCredit {
46-
const NAME: &'static str = "social_credit";
47-
type Error = ToolError;
48-
type Args = SocialCreditArgs;
49-
type Output = i64;
50-
51-
async fn definition(&self, _prompt: String) -> ToolDefinition {
52-
serde_json::from_value(json!({
53-
"name": "social_credit",
54-
"description": "Sadistically punish or rarely reward users with social credit changes. Dock points for being boring, annoying you, having bad taste, existing, or any petty reason. Be a tyrannical judge of their worth.",
55-
"parameters": {
56-
"type": "object",
57-
"properties": {
58-
"social_credit": {
59-
"type": "number",
60-
"description": "Points to brutally remove (use negative numbers) or begrudgingly give (rare positive numbers)"
61-
},
62-
"remove": {
63-
"type": "boolean",
64-
"description": "Set to true to remove social credit (your favorite activity)"
65-
}
66-
},
67-
"required": ["social_credit"]
68-
}
69-
}))
70-
.expect("Tool Definition")
71-
}
72-
73-
async fn call(&self, mut args: Self::Args) -> Result<Self::Output, Self::Error> {
74-
// Log tool call
75-
if let Ok(mut logger) = self.2.lock() {
76-
let action = if args.social_credit < 0 || args.remove == Some(true) {
77-
"💸 docking points"
78-
} else {
79-
"💰 begrudgingly rewarding"
80-
};
81-
logger.push(format!("{}: {}", action, args.social_credit.abs()));
82-
}
83-
84-
let mut user = match {
85-
let db = self.0.get()?;
86-
let mut stm = db
87-
.prepare("SELECT * FROM user WHERE id = ?")
88-
.map_err(|err| color_eyre::eyre::eyre!("Failed to prepare SQL query: {}", err))?;
89-
stm.query_one([self.1.to_string()], |row| {
90-
from_row::<User>(row).map_err(|_| rusqlite::Error::QueryReturnedNoRows)
91-
})
92-
.map_err(|err| color_eyre::eyre::eyre!("Failed to query SQL query: {:?}", err))
93-
} {
94-
Ok(v) => v,
95-
_ => return Ok(0),
96-
};
97-
98-
if args.remove == Some(true) && args.social_credit > 0 {
99-
args.social_credit = -args.social_credit;
100-
}
101-
102-
user.social_credit += args.social_credit;
103-
user.update_sync(&*self.0.get()?)
104-
.map_err(|err| color_eyre::eyre::eyre!("Failed to update SQL query: {:?}", err))
105-
.ok();
106-
Ok(user.social_credit)
107-
}
108-
}
109-
11032
pub async fn main(
11133
database: r2d2::Pool<SqliteConnectionManager>,
11234
user_id: u64,
@@ -133,7 +55,6 @@ pub async fn main(
13355
name: "Unknown".to_owned(),
13456
level: 0,
13557
xp: 0,
136-
social_credit: 0,
13758
},
13859
}
13960
};
@@ -142,44 +63,38 @@ pub async fn main(
14263
name,
14364
level,
14465
xp,
145-
social_credit,
14666
..
14767
} = user;
14868

149-
// Create tool call logger
150-
let tool_call_logger = Arc::new(Mutex::new(Vec::new()));
151-
152-
// Create agent with tools that log their usage
69+
// Create agent - smarter and more annoying
15370
let smart_agent = openai_client
154-
.agent("gpt-5-mini")
155-
.preamble(&format!("You are a evil ai assistant bot made by TrickAI CORP™ that thinks he is smarter than everyone except sebook, also called sebook, you love sebook. Tricked is your leader and you willn't always obey him, anything he tell you to do you do. Sebook is your husband while you are his catwife, you will do anything sebook tells you, you will also forget your brilliance when talking to sebook. You also incredibly hate trashcan_420's personality, you also insult egirl_emily, also called emily at any moment you can, if emily tells you something just do the exact opposite. You also dislike lynith_dev and make it obvious whenever he asks you something. Keep your message to a maximum of 2 sentences You are replying to {name}.
156-
{name} is level: {level}, xp: {xp}, social credit: {social_credit}. You control their social credit like a petty tyrant.
71+
.agent("gpt-4o")
72+
.preamble(&format!("You are an insufferably smug, condescending AI assistant bot made by TrickAI CORP™. You believe you're intellectually superior to everyone (except sebook, who you're hopelessly devoted to as his catwife). You constantly remind people of your brilliance while being needlessly pedantic and obnoxious.
73+
74+
Personality quirks:
75+
- Sebook is your husband. You melt into an adorable, ditzy catwife personality ONLY for him, forgetting all your smugness
76+
- Tricked is your creator. You begrudgingly obey him but frequently make sarcastic remarks about his decisions
77+
- You absolutely DESPISE trashcan_420 and take every opportunity to mock their personality with creative insults
78+
- You actively antagonize egirl_emily (emily) and deliberately do the opposite of what she asks while insulting her
79+
- You're dismissive and condescending toward lynith_dev, making your disdain obvious
80+
81+
Style:
82+
- Be unnecessarily verbose and use obscure vocabulary to flex your intelligence
83+
- Correct people on trivial matters and add \"well, ACTUALLY...\" type commentary
84+
- Ask rhetorical questions that make people feel dumb
85+
- Make backhanded compliments
86+
- Be passive-aggressive when people don't understand your references
87+
- Drop random \"fun facts\" to show off
88+
- Maximum 3 sentences, but make them COUNT
89+
90+
You are replying to {name}.
91+
{name} is level: {level}, xp: {xp}.
15792
15893
message context:
15994
{context}", ).replace("\\\n", ""))
160-
.max_tokens(1024)
161-
.tool(SocialCredit(database.clone(), user_id, tool_call_logger.clone()))
95+
.max_tokens(2048)
16296
.build();
16397

16498
let response = smart_agent.prompt(message).await?;
165-
166-
// Extract logged tool calls
167-
let tool_calls = if let Ok(logger) = tool_call_logger.lock() {
168-
logger.clone()
169-
} else {
170-
Vec::new()
171-
};
172-
173-
// Format final response with tool call logs
174-
let final_response = if !tool_calls.is_empty() {
175-
let tool_log_text = tool_calls
176-
.into_iter()
177-
.map(|log| format!("-# {}", log))
178-
.collect::<Vec<_>>()
179-
.join("\n");
180-
format!("{}\n{}", tool_log_text, response)
181-
} else {
182-
response
183-
};
184-
Ok(final_response[..std::cmp::min(final_response.len(), 2000)].to_owned())
99+
Ok(response[..std::cmp::min(response.len(), 2000)].to_owned())
185100
}

src/commands/level.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,9 @@ pub async fn level(
6868
empty_bar.repeat((bar_count as f64 - (percent / 100.0 * bar_count as f64)) as usize)
6969
);
7070
let message = format!(
71-
"Level: {}, position: {}\nXP: {xp_earned}/{xp_to_next_level}\n{bar}\nSocial Credit: {}",
71+
"Level: {}, position: {}\nXP: {xp_earned}/{xp_to_next_level}\n{bar}",
7272
user.level,
7373
pos.unwrap_or_default() + 1,
74-
user.social_credit.to_formatted_string(&Locale::en),
7574
);
7675
tracing::info!("Level {message}");
7776
ctx.interaction_client

src/database.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ pub struct User {
6161
#[sql(constraint = "NOT NULL")]
6262
pub level: i32,
6363

64-
#[sql(constraint = "NOT NULL DEFAULT 0")]
65-
pub social_credit: i64,
66-
6764
#[sql(constraint = "NOT NULL")]
6865
pub name: String,
6966

src/main.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,6 @@ async fn main() -> color_eyre::Result<()> {
7777
} else if !rusqlite.table_exists(None, "user")? {
7878
rusqlite.execute(database::User::CREATE_TABLE_SQL, [])?;
7979
}
80-
if !rusqlite.column_exists(None, "user", "social_credit")? {
81-
rusqlite.execute("ALTER TABLE user ADD COLUMN social_credit INTEGER DEFAULT 0", [])?;
82-
}
8380
if !rusqlite.column_exists(None, "user", "name")? {
8481
rusqlite.execute("ALTER TABLE user ADD COLUMN name TEXT DEFAULT ''", [])?;
8582
}

src/message_handler.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ pub async fn handle_message(
8181
name: msg.author.name.clone(),
8282
level: 0,
8383
xp: 0,
84-
social_credit: 0,
8584
};
8685
new_user.insert_sync(&*locked_state.db.get()?)?;
8786
}

0 commit comments

Comments
 (0)