Skip to content

Commit

Permalink
fix: "Self-made" 30s message cooldown bypasser.
Browse files Browse the repository at this point in the history
  • Loading branch information
KararTY committed Aug 12, 2020
1 parent 71d2309 commit 352b9d6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"@adonisjs/env": "^1.0.18",
"@adonisjs/logger": "^2.1.0",
"@adonisjs/validator": "^7.4.0",
"befriendlier-shared": "github:kararty/BeFriendlier-Shared#semver:6.0.1",
"befriendlier-shared": "github:kararty/BeFriendlier-Shared#dev",
"dank-twitch-irc": "github:kararty/dank-twitch-irc",
"p-queue": "^6.6.0",
"ws": "^7.3.1"
Expand Down
22 changes: 11 additions & 11 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions src/Twitch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import { Logger } from '@adonisjs/logger/build/standalone'
import { BASE, MessageType, More, NameAndId, TwitchAuth } from 'befriendlier-shared'
import {
AlternateMessageModifier,
ChatClient,
ClearchatMessage,
ClearmsgMessage,
Expand Down Expand Up @@ -86,6 +85,9 @@ export default class Client {

private readonly generalQueue = new PQueue({ concurrency: 1 })

private readonly invisibleSuffix = '\u{000e0000}'
private addInvisibleSuffix = true

public readonly api: TwitchAuth
public readonly packageJSON: any
public token: Token
Expand Down Expand Up @@ -130,7 +132,9 @@ export default class Client {
}

public sendMessage (channelName: string, username: string, message: string) {
this.ircClient.say(channelName, `@${username}, ${message}`)
this.addInvisibleSuffix = !this.addInvisibleSuffix // Flip

this.ircClient.say(channelName, `@${username}, ${message}${this.addInvisibleSuffix ? this.invisibleSuffix : ''}`)
.catch(error => this.logger.error({ err: error }, 'Twitch.sendMessage()'))
}

Expand Down Expand Up @@ -197,7 +201,6 @@ export default class Client {
},
})

this.ircClient.use(new AlternateMessageModifier(this.ircClient))
this.ircClient.use(new SlowModeRateLimiter(this.ircClient))
this.ircClient.use(new PrivmsgMessageRateLimiter(this.ircClient))

Expand Down

0 comments on commit 352b9d6

Please sign in to comment.