-
Notifications
You must be signed in to change notification settings - Fork 137
Closed
Labels
questionFurther information is requestedFurther information is requested
Description
I am trying to make a bot to manage telegram channel, in which there is mute and unmute command to limit member, mute member can be done very easily with just command
ctx.api.restrictChatMember(ctx.chat.id, target.id, { permissions: { can_send_messages: false }});But when i try to unmute member then the following command does not work
ctx.api.restrictChatMember(ctx.chat.id, target.id, { permissions: { can_send_messages: true }});I have tried many variations of the command to try to unmute the member but none of them work
// With full permision, until_date = 0 but still not work
ctx.api.restrictChatMember(ctx.chat.id, target.id, { until_date: 0, permissions: {
can_send_messages: true,
can_send_media_messages: true,
can_send_polls: true,
can_send_other_messages: true,
can_add_web_page_previews: true,
can_change_info: false,
can_invite_users: true,
can_pin_messages: false,
can_manage_topics: false
}});I made sure that all chat.id and target.id fields are valid, as they still mute the member
My current temporary solution for this is to call telegram api directly to unmute member,
const unmute_member_http = async (chat_id, user_id) => {
const params = new URLSearchParams({
chat_id, user_id,
permissions: JSON.stringify({
can_send_messages: true
}),
}).toString();
return fetch(`https://api.telegram.org/bot${config.bot_token}/restrictChatMember?${params}`, {
method: "GET"
}).then(r => r.json());
}but I still want a clean, neat solution that works in grammy
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested