Skip to content

Commit

Permalink
feat: Allow help command on Whispers
Browse files Browse the repository at this point in the history
  • Loading branch information
KararTY committed Aug 10, 2021
1 parent 00fbee1 commit 51f1a9d
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions src/Handlers/HelpHandler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PrivmsgMessage } from 'dank-twitch-irc'
import { PrivmsgMessage, WhisperMessage } from 'dank-twitch-irc'
import messagesText from '../messagesText'
import DefaultHandler from './DefaultHandler'

Expand All @@ -11,6 +11,26 @@ export default class HelpHandler extends DefaultHandler {
public async onCommand (msg: PrivmsgMessage, words: string[]) {
const responseMessage = this.getNameAndIds(msg)

const message = this.makeMessage(words)

if (message.length > 0) {
this.twitch.sendMessage(responseMessage.channelTwitch, responseMessage.userTwitch, message)
}
}

public async onWhisperCommand (whMsg: WhisperMessage, words: string[]) {
const responseMessage = this.getNameAndIds(whMsg)

const message = this.makeMessage(words)

if (message.length > 0) {
await this.twitch.sendWhisper(responseMessage.userTwitch, message)
}
}

// public async onServerResponse (res) {}

private makeMessage (words: string[]) {
const commands = this.twitch.handlers.filter(command => !command.adminOnly && command.prefix.length !== 0)

let message: string = ''
Expand All @@ -26,10 +46,6 @@ export default class HelpHandler extends DefaultHandler {
// TODO: Make it paginate.
}

if (message.length > 0) {
this.twitch.sendMessage(responseMessage.channelTwitch, responseMessage.userTwitch, message)
}
return message
}

// public async onServerResponse (res) {}
}

0 comments on commit 51f1a9d

Please sign in to comment.