Skip to content

Commit

Permalink
fix: change reactionGuildMessage to addGuildMessageReaction
Browse files Browse the repository at this point in the history
  • Loading branch information
lc-cn committed Jul 5, 2024
1 parent 0d8aabd commit 8ffbdc4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
24 changes: 18 additions & 6 deletions src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
ChannelRolePermissions,
ChannelUpdateInfo,
DMS,
FaceType,
EmojiType,
PinsMessage,
RoleCreateParam,
RoleUpdateParam,
Expand Down Expand Up @@ -627,25 +627,37 @@ export class Bot extends QQBot {
return result.status === 200
}
/**
* 对频道消息进行表态
* 添加频道消息表态
* @param channel_id {string} 子频道id
* @param message_id {string} 消息id
* @param type {0|1} 表情类型
* @param id {`${number}`} 表情id
*/
async reactionGuildMessage(channel_id: string, message_id: string, type: FaceType, id: `${number}`) {
async addGuildMessageReaction(channel_id: string, message_id: string, type:EmojiType,id:`${number}`){
const result = await this.request.put(`/channels/${channel_id}/messages/${message_id}/reactions/${type}/${id}`)
return result.status === 200
}

/**
* 删除频道消息表态
* 添加频道消息表态
* @deprecated use addGuildMessageReaction instead
* @param channel_id {string} 子频道id
* @param message_id {string} 消息id
* @param type {0|1} 表情类型
* @param id {`${number}`} 表情id
*/
async deleteGuildMessageReaction(channel_id: string, message_id: string, type: FaceType, id: `${number}`) {
async reactionGuildMessage(channel_id: string, message_id: string, type: EmojiType, id: `${number}`) {
return this.addGuildMessageReaction(channel_id,message_id,type,id)
}

/**
* 删除频道消息表态
* @param channel_id {string} 子频道id
* @param message_id {string} 消息id
* @param type {EmojiType} 表情类型
* @param id {`${number}`} 表情id
*/
async deleteGuildMessageReaction(channel_id: string, message_id: string, type: EmojiType, id: `${number}`) {
const result = await this.request.delete(`/channels/${channel_id}/messages/${message_id}/reactions/${type}/${id}`)
return result.status === 204
}
Expand All @@ -657,7 +669,7 @@ export class Bot extends QQBot {
* @param type {0|1} 表情类型
* @param id {`${number}`} 表情id
*/
async getGuildMessageReactionMembers(channel_id: string, message_id: string, type: FaceType, id: `${number}`) {
async getGuildMessageReactionMembers(channel_id: string, message_id: string, type: EmojiType, id: `${number}`) {
const formatUser = (users: User.Info[]) => {
return users.map(user => {
return {
Expand Down
1 change: 0 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export type UpdatePermissionParams = {
add?: string
remove?: string
}
export type FaceType=1|2
export type ChannelUpdateInfo = Partial<Pick<Channel.Info, 'name' | 'position' | 'parent_id' | 'private_type' | 'speak_permission'>>
export type RoleCreateParam = {
name?: string
Expand Down

0 comments on commit 8ffbdc4

Please sign in to comment.