Описание и причина:
В этот чат нельзя писать.
Решение проблемы:
Если Вы делаете инвайт в группу, то Вам необходимо дать права администратора аккаунту с которого делается инвайт в группе Телеграм.
Если же Вы пытаетесь делать рассылку, то Вы не сможете отправить сообщения в этот чат!
Выше предоставлено описание и возможное решение ошибки Телеграм «CHAT_WRITE_FORBIDDEN».
Вам, как пользователю программы стоит понимать, что данная ошибка может возникнуть как внезапно (например, если Ваш аккаунт уткнется в лимит Телеграм) так и прогнозируемо (например, если Вы не добавите аккаунт в Телеграм, или если Вы забыли добавить текст сообщения).
Однако, Вам стоить помнить что предложенный способ решения проблемы может не всегда быть подходящим для Вас. Но вы всегда можете найти эту ошибку в интернете. Возможно, там вы найдете более точный способ решения Вашей проблемы.
Так же, Вам нужно понимать что автор программы Telegram-Spam-Master может не знать, как решить вашу ошибку. Так что если в процессе поисков Вы найдете решение самостоятельно, было бы очень хорошо, если бы Вы поделились с ним этим решением!
to ban/kick someone you can use:
new Api.channels.EditBanned({
channel: new Api.InputChannel({
channelId: <channel_id>,
accessHash: BigInt(<hash>),
}),
participant: <user_id>,
bannedRights: new Api.ChatBannedRights({
untilDate: 43,
viewMessages: true,
sendMessages: true,
sendMedia: true,
sendStickers: true,
sendGifs: true,
sendGames: true,
sendInline: true,
sendPolls: true,
changeInfo: true,
inviteUsers: true,
pinMessages: true,
}),
})
to get the channel accessHash and id, you must store the result when you call the createChannel:
const result = await client.invoke(
new Api.channels.CreateChannel({
title: "grupo-legal-2",
about: "about test",
broadcast: true,
// megagroup: true,
// forImport: true,
geoPoint: new Api.InputGeoPoint({
lat: -26.30444,
long: -48.84556,
accuracyRadius: 100,
}),
address: "address test",
})
);
console.log(result);
console.log(result.chats[0].id);
console.log(result.chats[0].accessHash);
Basically I have a group(of which I am admin) in which I want to be able to add and kick-out user programmatically. I created a telegram app using my telegram account. I wanted to access the method channels.EditBanned
. The group was created using same account that was used to create app. This one:
new Api.channels.EditBanned({
channel: "Test_Channel",
participant: "vishalkale151071",
bannedRights: new Api.ChatBannedRights({
untilDate: 43,
viewMessages: 0,
sendMessages: 1,
sendMedia: true,
sendStickers: true,
sendGifs: false,
sendGames: true,
sendInline: true,
sendPolls: true,
changeInfo: true,
inviteUsers: true,
pinMessages: true,
}),
})
);
But got error :
RPCError: 403: CHAT_WRITE_FORBIDDEN (caused by channels.EditBanned)
Reference : https://gram.js.org/tl/channels/EditBanned
BROADCAST_FORBIDDEN
The request can’t be used in channels
CHANNEL_PUBLIC_GROUP_NA
The channel/supergroup is not available
CHAT_ADMIN_INVITE_REQUIRED
You don’t have rights to invite other users
CHAT_ADMIN_REQUIRED
The method requires chat admin privileges
CHAT_FORBIDDEN
You cannot write in this chat
CHAT_SEND_GIFS_FORBIDDEN
You can’t send animations in this chat
CHAT_SEND_INLINE_FORBIDDEN
You cannot use inline bots to send messages in this chat
CHAT_SEND_MEDIA_FORBIDDEN
You can’t send media messages in this chat
CHAT_SEND_POLL_FORBIDDEN
You can’t send polls in this chat
CHAT_SEND_STICKERS_FORBIDDEN
You can’t send stickers in this chat
CHAT_WRITE_FORBIDDEN
You don’t have rights to send messages in this chat
EDIT_BOT_INVITE_FORBIDDEN
Bots’ chat invite links can’t be edited
INLINE_BOT_REQUIRED
The action must be performed through an inline bot callback
MESSAGE_AUTHOR_REQUIRED
You are not the author of this message
MESSAGE_DELETE_FORBIDDEN
You don’t have rights to delete messages in this chat, most likely because you are not the author of them
POLL_VOTE_REQUIRED
Cast a vote in the poll before calling this method
PREMIUM_ACCOUNT_REQUIRED
This action requires a premium account
RIGHT_FORBIDDEN
You don’t have enough rights for this action, or you tried to set one or more admin rights that can’t be applied to this kind of chat (channel or supergroup)
SENSITIVE_CHANGE_FORBIDDEN
Your sensitive content settings can’t be changed at this time
TAKEOUT_REQUIRED
The method must be invoked inside a takeout session
USER_BOT_INVALID
This method can only be called by a bot
USER_CHANNELS_TOO_MUCH
One of the users you tried to add is already in too many channels/supergroups
USER_INVALID
The provided user is invalid
USER_IS_BLOCKED
The user is blocked
USER_NOT_MUTUAL_CONTACT
The provided user is not a mutual contact
USER_PRIVACY_RESTRICTED
The user’s privacy settings is preventing you to perform this action
USER_RESTRICTED
You are limited/restricted. You can’t perform this action
По сути, у меня есть группа (в которой я являюсь администратором), в которой я хочу иметь возможность программно добавлять и исключать пользователя. Я создал приложение телеграммы, используя свою учетную запись телеграммы. Я хотел получить доступ к методу channels.EditBanned
. Группа была создана с использованием той же учетной записи, которая использовалась для создания приложения. Вот этот:
new Api.channels.EditBanned({
channel: "Test_Channel",
participant: "vishalkale151071",
bannedRights: new Api.ChatBannedRights({
untilDate: 43,
viewMessages: 0,
sendMessages: 1,
sendMedia: true,
sendStickers: true,
sendGifs: false,
sendGames: true,
sendInline: true,
sendPolls: true,
changeInfo: true,
inviteUsers: true,
pinMessages: true,
}),
})
);
Но есть ошибка:
RPCError: 403: CHAT_WRITE_FORBIDDEN (вызвано каналами.EditBanned)
Ссылка: https://gram.js.org/tl/channels/EditBanned
2 ответа
Чтобы забанить/кикнуть кого-то, вы можете использовать:
new Api.channels.EditBanned({
channel: new Api.InputChannel({
channelId: <channel_id>,
accessHash: BigInt(<hash>),
}),
participant: <user_id>,
bannedRights: new Api.ChatBannedRights({
untilDate: 43,
viewMessages: true,
sendMessages: true,
sendMedia: true,
sendStickers: true,
sendGifs: true,
sendGames: true,
sendInline: true,
sendPolls: true,
changeInfo: true,
inviteUsers: true,
pinMessages: true,
}),
})
Чтобы получить accessHash и id канала, вы должны сохранить результат при вызове createChannel:
const result = await client.invoke(
new Api.channels.CreateChannel({
title: "grupo-legal-2",
about: "about test",
broadcast: true,
// megagroup: true,
// forImport: true,
geoPoint: new Api.InputGeoPoint({
lat: -26.30444,
long: -48.84556,
accuracyRadius: 100,
}),
address: "address test",
})
);
console.log(result);
console.log(result.chats[0].id);
console.log(result.chats[0].accessHash);
0
Murillo de Miranda Pereira
22 Сен 2021 в 15:47
Ok . Поскольку у меня был крайний срок для проекта, я в конечном итоге реализовал функцию удаления, создав бота и вызвав метод bot.banMember. Для этого нужно добавить бота в группу телеграмм с правами администратора. также я чувствую, что так намного проще. Помимо непосредственного обмена сообщениями с пользователями в Telegram, вы можете делать практически все. –
0
Rakesh saini
3 Сен 2022 в 05:00