harmony/src/managers/reactionUsers.ts

25 lines
822 B
TypeScript
Raw Normal View History

2021-04-04 09:29:56 +00:00
import type { Client } from '../client/mod.ts'
import type { MessageReaction } from '../structures/messageReaction.ts'
import type { User } from '../structures/user.ts'
2020-12-03 04:06:41 +00:00
import { UsersManager } from './users.ts'
2020-12-02 12:29:52 +00:00
2020-12-03 04:06:41 +00:00
export class ReactionUsersManager extends UsersManager {
2020-12-02 12:29:52 +00:00
reaction: MessageReaction
constructor(client: Client, reaction: MessageReaction) {
super(client)
this.cacheName = `reaction_users:${reaction.message.id}`
this.reaction = reaction
}
2021-01-01 05:55:23 +00:00
/** Remove all Users from this Reaction */
async removeAll(): Promise<void> {
await this.reaction.message.reactions.removeEmoji(this.reaction.emoji)
}
/** Remove a specific User from this Reaction */
async remove(user: User | string): Promise<void> {
await this.reaction.message.reactions.removeUser(this.reaction.emoji, user)
}
2020-12-02 12:29:52 +00:00
}