feat(client): support setBot*DefaultAdminRights methods
This commit is contained in:
parent
a10221533c
commit
d41bec9c73
2 changed files with 35 additions and 0 deletions
|
@ -88,6 +88,7 @@ import { getMyCommands } from './methods/bots/get-my-commands'
|
||||||
import { _normalizeCommandScope } from './methods/bots/normalize-command-scope'
|
import { _normalizeCommandScope } from './methods/bots/normalize-command-scope'
|
||||||
import { setGameScore, setInlineGameScore } from './methods/bots/set-game-score'
|
import { setGameScore, setInlineGameScore } from './methods/bots/set-game-score'
|
||||||
import { setMyCommands } from './methods/bots/set-my-commands'
|
import { setMyCommands } from './methods/bots/set-my-commands'
|
||||||
|
import { setMyDefaultRights } from './methods/bots/set-my-default-rights'
|
||||||
import { addChatMembers } from './methods/chats/add-chat-members'
|
import { addChatMembers } from './methods/chats/add-chat-members'
|
||||||
import { archiveChats } from './methods/chats/archive-chats'
|
import { archiveChats } from './methods/chats/archive-chats'
|
||||||
import { banChatMember } from './methods/chats/ban-chat-member'
|
import { banChatMember } from './methods/chats/ban-chat-member'
|
||||||
|
@ -968,6 +969,16 @@ export interface TelegramClient extends BaseTelegramClient {
|
||||||
*/
|
*/
|
||||||
langCode?: string
|
langCode?: string
|
||||||
}): Promise<void>
|
}): Promise<void>
|
||||||
|
/**
|
||||||
|
* Sets the default chat permissions for the bot in the supergroup or channel.
|
||||||
|
*
|
||||||
|
* @param target Whether to target groups or channels.
|
||||||
|
* @param rights The default chat permissions.
|
||||||
|
*/
|
||||||
|
setMyDefaultRights(
|
||||||
|
target: 'channel' | 'group',
|
||||||
|
rights: Omit<tl.RawChatAdminRights, '_'>
|
||||||
|
): Promise<void>
|
||||||
/**
|
/**
|
||||||
* Add new members to a group, supergroup or channel.
|
* Add new members to a group, supergroup or channel.
|
||||||
*
|
*
|
||||||
|
@ -3695,6 +3706,7 @@ export class TelegramClient extends BaseTelegramClient {
|
||||||
setGameScore = setGameScore
|
setGameScore = setGameScore
|
||||||
setInlineGameScore = setInlineGameScore
|
setInlineGameScore = setInlineGameScore
|
||||||
setMyCommands = setMyCommands
|
setMyCommands = setMyCommands
|
||||||
|
setMyDefaultRights = setMyDefaultRights
|
||||||
addChatMembers = addChatMembers
|
addChatMembers = addChatMembers
|
||||||
archiveChats = archiveChats
|
archiveChats = archiveChats
|
||||||
banChatMember = banChatMember
|
banChatMember = banChatMember
|
||||||
|
|
23
packages/client/src/methods/bots/set-my-default-rights.ts
Normal file
23
packages/client/src/methods/bots/set-my-default-rights.ts
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
import { TelegramClient } from '../../client'
|
||||||
|
import { tl } from '@mtcute/tl'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the default chat permissions for the bot in the supergroup or channel.
|
||||||
|
*
|
||||||
|
* @param target Whether to target groups or channels.
|
||||||
|
* @param rights The default chat permissions.
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export async function setMyDefaultRights(
|
||||||
|
this: TelegramClient,
|
||||||
|
target: 'channel' | 'group',
|
||||||
|
rights: Omit<tl.RawChatAdminRights, '_'>
|
||||||
|
): Promise<void> {
|
||||||
|
await this.call({
|
||||||
|
_: target === 'group' ? 'bots.setBotGroupDefaultAdminRights' : 'bots.setBotBroadcastDefaultAdminRights',
|
||||||
|
adminRights: {
|
||||||
|
_: 'chatAdminRights',
|
||||||
|
...rights
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
Loading…
Reference in a new issue