Skip to content

Commit

Permalink
fix: Properly parse %prefix% & %s%.
Browse files Browse the repository at this point in the history
  • Loading branch information
KararTY committed Aug 11, 2020
1 parent 55a2274 commit a0d6c66
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
11 changes: 9 additions & 2 deletions src/Handlers/RollMatchHandler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MessageType, ROLLMATCH } from 'befriendlier-shared'
import { MessageType, ROLLMATCH, More } from 'befriendlier-shared'
import { PrivmsgMessage } from 'dank-twitch-irc'
import DefaultHandler from './DefaultHandler'

Expand Down Expand Up @@ -29,7 +29,14 @@ export default class RollMatchHandler extends DefaultHandler {
this.ws.sendMessage(MessageType.ROLLMATCH, JSON.stringify(responseMessage))
}

public async onServerResponse ({ channelTwitch, userTwitch, result }: ROLLMATCH) {
public async onServerResponse ({ channelTwitch, userTwitch, result, more }: ROLLMATCH) {
if (more === More.NONE) {
result.value = result.value
.replace('%prefix%', '@@')
.replace('%prefix%', '@@')
.replace('%prefix%', '@@')
}

this.twitch.sendMessage(channelTwitch.name, userTwitch.name, String(result.value))
}
}
4 changes: 2 additions & 2 deletions src/Handlers/SuccessHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ export default class SuccessHandler extends DefaultHandler {
this.twitch./* TODO: whisper */sendMessage(
/** TODO. REMOVE */channelTwitch.name,
userTwitch.name,
String(result.value).replace('%s', `@${String(result.matchUsername)}`),
String(result.value).replace('%s%', `@${String(result.matchUsername)}`),
)

// // Send to matched user.
// this.twitch./* TODO: whisper */sendMessage(
// /** TODO. REMOVE */channelTwitch.name,
// result.matchUsername,
// String(result.value).replace('%s', `@${String(userTwitch.name)}`),
// String(result.value).replace('%s%', `@${String(userTwitch.name)}`),
// )

this.twitch.removeUserInstance({ channelTwitch, userTwitch })
Expand Down

0 comments on commit a0d6c66

Please sign in to comment.