Skip to content

Commit

Permalink
✨ [Feature] Send active message guide to channel (Not tested: No perm…
Browse files Browse the repository at this point in the history
…ission)
  • Loading branch information
foxwhite25 committed May 3, 2022
1 parent 1622d81 commit 8bcb662
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
20 changes: 19 additions & 1 deletion qq/channel.py
Expand Up @@ -383,14 +383,32 @@ async def unpin(self, reason: Optional[str] = None):
Raises
-------
Forbidden
你没有足够权限删除公告。.
你没有足够权限删除公告。
NotFound
消息或频道无法被找到,可能被删除了.
HTTPException
删除公告失败。
"""
await self._state.http.channel_unpin_message(self.id, 'all', reason=reason)

async def send_guide(self, content: str):
"""
发送主动消息引导信息。
Parameters
-----------
content: :class:`str`
要发送的内容。
Raises
-------
Forbidden
你没有足够权限发送。
HTTPException
发送失败。
"""
await self._state.http.send_guide(self.id, content)


class VoiceChannel(abc.GuildChannel, Hashable):
"""表示 QQ 语音子频道。
Expand Down
13 changes: 13 additions & 0 deletions qq/http.py
Expand Up @@ -774,3 +774,16 @@ def remove_reaction(
id=id
)
return self.request(r)

def send_guide(
self,
channel_id: int,
content: str,
):
r = Route(
'POST',
'/channels/{channel_id}/settingguide',
channel_id=channel_id
)
payload = {'content': content}
return self.request(r, json=payload)

0 comments on commit 8bcb662

Please sign in to comment.