move renderers to subfolder

This commit is contained in:
MapleLeaf
2021-12-28 13:53:23 -06:00
parent c64ba9eaaa
commit d89db1ceeb
7 changed files with 15 additions and 15 deletions

View File

@@ -0,0 +1,22 @@
import type { CommandInteraction } from "../interaction"
import type { Message, MessageOptions } from "../message"
import { Renderer } from "./renderer"
// keep track of interaction ids which have replies,
// so we know whether to call reply() or followUp()
const repliedInteractionIds = new Set<string>()
export class CommandReplyRenderer extends Renderer {
constructor(private interaction: CommandInteraction) {
super()
}
protected createMessage(options: MessageOptions): Promise<Message> {
if (repliedInteractionIds.has(this.interaction.id)) {
return this.interaction.followUp(options)
}
repliedInteractionIds.add(this.interaction.id)
return this.interaction.reply(options)
}
}