Skip to content

Commit

Permalink
fix: Send a text if people get repeated data.
Browse files Browse the repository at this point in the history
  • Loading branch information
KararTY committed Aug 11, 2021
1 parent 1ed5d27 commit 92f5ca9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Handlers/MoreHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ export default class MoreHandler extends DefaultHandler {
return
}

foundUserRoll.nextType()

if (foundUserRoll.global) {
responseMessage.global = true
}

foundUserRoll.nextType()

responseMessage.more = foundUserRoll.type
this.ws.sendMessage(MessageType.ROLLMATCH, JSON.stringify(responseMessage))
Expand Down
9 changes: 8 additions & 1 deletion src/Handlers/RollMatchHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,14 @@ export default class RollMatchHandler extends DefaultHandler {

const foundUserRoll = this.twitch.getUserInstance({ senderUserID: userTwitch.id, channelID: channelTwitch.id } as PrivmsgMessage) as RollInstance

foundUserRoll.type = more
if (foundUserRoll.lastType === more) {
this.twitch.sendMessage(channelTwitch, userTwitch, messagesText.ood)
return
}

if (more) {
foundUserRoll.type = more
}

this.twitch.sendMessage(channelTwitch, userTwitch, String(result.value))
}
Expand Down
3 changes: 3 additions & 0 deletions src/Twitch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class WhMessage {
}

export class RollInstance {
public lastType: More
public type: More
public global: boolean

Expand All @@ -65,6 +66,8 @@ export class RollInstance {
}

public nextType () {
this.lastType = this.type

switch (this.type) {
case More.NONE:
this.type = More.BIO
Expand Down
1 change: 1 addition & 0 deletions src/messagesText.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const messagesText = {
+ ' YOU MUST LOGIN VIA THE WEBSITE TO ENABLE YOUR GLOBAL PROFILE. Read more on website or on my Twitch profile page.',
alreadyRegistered: 'You\'re already registered! You can now peruse the bot and website.',
whispersOnly: 'this command can only be used via whispers!',
ood: 'that\'s all that\'s written.',
helpText: {
help: 'rubber ducky 🦆 Never lucky.',
emotes: 'sets your favorite emotes for your profile. Add "global" in the beginning to change your global profile\'s bio. Only Twitch emotes work for now.',
Expand Down

0 comments on commit 92f5ca9

Please sign in to comment.