create deop command
This commit is contained in:
parent
e2e42c8676
commit
87601f172a
@ -40,6 +40,8 @@ enum AdminCommands {
|
|||||||
MyId,
|
MyId,
|
||||||
/// Pin replied message
|
/// Pin replied message
|
||||||
Pin,
|
Pin,
|
||||||
|
/// Removes your admin privileges
|
||||||
|
Deop,
|
||||||
}
|
}
|
||||||
|
|
||||||
trait LogMsg {
|
trait LogMsg {
|
||||||
@ -152,7 +154,6 @@ async fn admin_command_handler(
|
|||||||
cmd: AdminCommands,
|
cmd: AdminCommands,
|
||||||
) -> Result<(), teloxide::RequestError> {
|
) -> Result<(), teloxide::RequestError> {
|
||||||
let tguser = msg.from.clone().unwrap();
|
let tguser = msg.from.clone().unwrap();
|
||||||
let user = db.get_or_init_user(tguser.id.0 as i64);
|
|
||||||
println!("MSG: {}", msg.html_text().unwrap());
|
println!("MSG: {}", msg.html_text().unwrap());
|
||||||
match cmd {
|
match cmd {
|
||||||
AdminCommands::MyId => {
|
AdminCommands::MyId => {
|
||||||
@ -167,8 +168,9 @@ async fn admin_command_handler(
|
|||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
},
|
},
|
||||||
_ => {
|
AdminCommands::Deop => {
|
||||||
bot.send_message(msg.chat.id, "Not yet implemented").await?;
|
db.set_admin(tguser.id.0 as i64, false).await;
|
||||||
|
bot.send_message(msg.chat.id, "You are not an admin anymore").await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user