mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-22 06:45:37 +01:00
And again!
This commit is contained in:
parent
9f2aa741f7
commit
e3a032abff
1 changed files with 4 additions and 5 deletions
|
@ -99,11 +99,11 @@ async fn mute_user(ctx: &Ctx, args: Vec<&str>) -> Result<(), RequestError> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Kick a user with replied message.
|
// Kick a user with a replied message.
|
||||||
async fn kick_user(ctx: &Ctx) -> Result<(), RequestError> {
|
async fn kick_user(ctx: &Ctx) -> Result<(), RequestError> {
|
||||||
match ctx.update.reply_to_message() {
|
match ctx.update.reply_to_message() {
|
||||||
Some(mes) => {
|
Some(mes) => {
|
||||||
// `unban_chat_member` will also kick user from group chat
|
// bot.unban_chat_member can also kicks a user from a group chat.
|
||||||
ctx.bot
|
ctx.bot
|
||||||
.unban_chat_member(ctx.update.chat_id(), mes.from().unwrap().id)
|
.unban_chat_member(ctx.update.chat_id(), mes.from().unwrap().id)
|
||||||
.send()
|
.send()
|
||||||
|
@ -155,10 +155,9 @@ async fn ban_user(ctx: &Ctx, args: Vec<&str>) -> Result<(), RequestError> {
|
||||||
|
|
||||||
// Handle all messages.
|
// Handle all messages.
|
||||||
async fn handle_command(ctx: Ctx) -> Result<(), RequestError> {
|
async fn handle_command(ctx: Ctx) -> Result<(), RequestError> {
|
||||||
// If a message isn't from a group, stop handling.
|
|
||||||
if ctx.update.chat.is_group() {
|
if ctx.update.chat.is_group() {
|
||||||
// Note: this is the same as DispatcherHandlerResult::exit(Ok(())). If
|
// The same as DispatcherHandlerResult::exit(Ok(())). If you have more
|
||||||
// you have more handlers, use DispatcherHandlerResult::next(...)
|
// handlers, use DispatcherHandlerResult::next(...)
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue