From bb9af971ba4255e2e05c00d8b73b4e2d4bb3848f Mon Sep 17 00:00:00 2001 From: Mitchdev Date: Sun, 19 May 2024 09:52:21 +1200 Subject: [PATCH] Remove twitch --- Dockerfile | 2 +- README.md | 6 +- docker-compose.yml | 18 +- index.js | 32 +- lib/commands/implementations/banphrase.js | 67 +-- lib/commands/implementations/unbanphrase.js | 23 +- lib/configuration/configure-commands.js | 75 ++-- lib/configuration/sample.config.json | 14 +- lib/message-routing/chat-service-router.js | 37 +- lib/message-routing/message-router.js | 33 +- lib/services/fake-command-scheduler.js | 33 +- lib/services/over-rustle-logs.js | 5 +- lib/services/service-index.js | 18 +- lib/services/twitch-chat.js | 138 ------ package-lock.json | 461 +------------------- package.json | 1 - 16 files changed, 82 insertions(+), 881 deletions(-) delete mode 100644 lib/services/twitch-chat.js diff --git a/Dockerfile b/Dockerfile index 65a8895..b46f217 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,5 +26,5 @@ COPY index.js index.js ENV NODE_ENV=production -ENTRYPOINT ["node", "/usr/src/app/index.js", "--chat=dgg"] +ENTRYPOINT ["node", "/usr/src/app/index.js"] CMD ["node", "/usr/src/app/index.js"] diff --git a/README.md b/README.md index bb70b94..df07276 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ You'll need a configuration file, there's a sample configuration under ./configuration, rename this to prod.config.json and enter in your own keys to hit the APIs. Documentation on configuration coming eventually. -You shouldn't need api keys for most commands, but you will definitely need them to run the bot against twitch. +You shouldn't need api keys for most commands. See below for local development of the bot. @@ -54,11 +54,11 @@ Durations are in the format of the number, followed by h,m,s or d. 500d -(Note on adding commands/scheduled commands for admins, when you add the commands to twitch/dgg, you need to !restart the bot in the other chat to pick these changes up. This will change with a future update.) +(Note on adding commands/scheduled commands for admins, when you add the commands to dgg, you need to !restart the bot in the other chat to pick these changes up. This will change with a future update.) | Command | Input | What it does | Requires Admin | Example | |------------------------------------------------|------------------------------|---------------------------------------------------------------------------------------------------|----------------|-----------------------------------------------------------| -| !restart | None | Restarts the dgg or Twitch.tv bot. Don't overuse the command, it resets caches. | Yes | !restart | +| !restart | None | Restarts the dgg bot. Don't overuse the command, it resets caches. | Yes | !restart | | !stalk | {user} (postnumber) | Overrustle logs posts | Yes | !stalk Destiny 5 | | !time | None | Current Steven Time | No | !time | | !schedule !sch | None | Show next upcoming scheduled event, and a link to the schedule calendar. | No | !schedule | diff --git a/docker-compose.yml b/docker-compose.yml index 5988684..bc7043b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,22 +9,8 @@ services: volumes: - ./prod.config.json:/usr/src/app/lib/configuration/prod.config.json:ro - ./database:/usr/src/app/database - command: ["node", "/usr/src/app/index.js", "--chat=dgg"] + command: ["node", "/usr/src/app/index.js"] restart: unless-stopped network_mode: "host" environment: - - NODE_ENV=production - bot-ttv: - build: - context: . - dockerfile: Dockerfile - container_name: bot-ttv - user: 1004:1004 - volumes: - - ./prod.config.json:/usr/src/app/lib/configuration/prod.config.json:ro - - ./database:/usr/src/app/database - command: ["node", "/usr/src/app/index.js", "--chat=twitch"] - restart: unless-stopped - network_mode: "host" - environment: - - NODE_ENV=production + - NODE_ENV=production \ No newline at end of file diff --git a/index.js b/index.js index 1000875..ee6c69a 100644 --- a/index.js +++ b/index.js @@ -2,7 +2,6 @@ const { argv } = require('yargs'); const DestinyChat = require('./lib/services/destinychat'); -const TwitchChat = require('./lib/services/twitch-chat'); const CommandRouter = require('./lib/message-routing/command-router'); const Services = require('./lib/services/service-index'); const loadConfig = require('./lib/configuration/config-loader'); @@ -15,22 +14,20 @@ const { const { configureReporter } = require('./lib/services/metrics/metrics-reporter'); const config = loadConfig(argv.config); -const chatToConnectTo = argv.chat || config.chatToConnectTo; -config.chatToConnectTo = chatToConnectTo; - if (config === null) { // eslint-disable-next-line no-console console.log('WARNING: Config file not found, no config loaded. Shutting down.'); process.exit(0); } -const services = new Services(config, chatToConnectTo); -configureReporter(config.influx, new Map([['chat', config.chatToConnectTo]])); + +const services = new Services(config); +configureReporter(config.influx, new Map([['chat', 'dgg']])); const { logger } = services; services .prepareAsyncServices() .then(() => { - registerCommandsFromFiles(services.commandRegistry, chatToConnectTo, config); + registerCommandsFromFiles(services.commandRegistry, config); logger.info('Config loaded! Starting bot!'); return setupCommandsAndCachesFromDb( services.sql, @@ -43,25 +40,18 @@ services }); }) .then(() => { - logger.info(`Configuring for ${chatToConnectTo} chat`); + logger.info(`Configuring for dgg chat`); const commandRouter = new CommandRouter(services); - const messageRouter = new MessageRouter({ chatConnectedTo: chatToConnectTo }, services); - let bot = null; + const messageRouter = new MessageRouter(services); + const bot = new DestinyChat(config.dggChat, services); - if (chatToConnectTo === 'twitch') { - bot = new TwitchChat(config.twitch, services); - } else if (chatToConnectTo === 'dgg') { - bot = new DestinyChat(config.dggChat, services); - } else { - logger.error('Config property: "chatToConnectTo" not set to one of "dgg" or "twitch"'); - process.exit(1); - } - if(config.hasOwnProperty('scheduledCommands')){ - config.scheduledCommands.forEach(commandToSchedule => services.fakeScheduler.createMessage(commandToSchedule)); + if (config.hasOwnProperty('scheduledCommands')) { + config.scheduledCommands.forEach((commandToSchedule) => + services.fakeScheduler.createMessage(commandToSchedule), + ); } const chatServiceRouter = new ChatServiceRouter( - config.chatToConnectTo, bot, messageRouter, commandRouter, diff --git a/lib/commands/implementations/banphrase.js b/lib/commands/implementations/banphrase.js index 0e48f54..132606c 100644 --- a/lib/commands/implementations/banphrase.js +++ b/lib/commands/implementations/banphrase.js @@ -1,54 +1,5 @@ -const _ = require('lodash'); const Command = require('../command-interface'); const CommandOutput = require('../command-output'); -const parseDurationToSeconds = require('../../chat-utils/duration-parser'); - -function banPhraseTwitch(defaultPunishmentDuration, punishmentType) { - return (input, services) => { - const matched = /(\d+[HMDSWwhmds])?\s?(.*)/.exec(input); - const duration = _.get(matched, 1, ''); - const bannedPhrase = _.get(matched, 2, '').toLowerCase(); - let parsedDuration = defaultPunishmentDuration; - - if (duration !== '') { - parsedDuration = parseDurationToSeconds(duration); - if (parsedDuration === null) { - return Promise.resolve( - new CommandOutput( - null, - 'Could not parse the duration. Usage: "!AddX {amount}{m,h,d,w} {some banned phrase} " !AddMute 1d YOU BEEN GNOMED', - ), - ); - } - } - - if (/^\/.*\/$/.test(bannedPhrase)) { - try { - // eslint-disable-next-line no-new - new RegExp(bannedPhrase); - } catch (e) { - return Promise.resolve(new CommandOutput(null, 'Could not add phrase. Invalid Regex.')); - } - } - - return services.sql - .addBannedPhrase(bannedPhrase, parsedDuration, punishmentType) - .then(() => { - services.spamDetection.addBannedPhrase({ - text: bannedPhrase, - duration: parsedDuration, - type: punishmentType, - }); - return new CommandOutput(null, 'Phrase banned!'); - }) - .catch((err) => { - if (err.errno === 19) { - return new CommandOutput(null, 'Phrase already banned!'); - } - return new CommandOutput(err, 'Oops. Something did not work. Check the logs.'); - }); - }; -} function banPhraseDGG() { return () => { @@ -56,20 +7,4 @@ function banPhraseDGG() { }; } -module.exports = { - addbanTwitch: new Command( - banPhraseTwitch(1800, 'ban'), - true, - true, - /(\d+[HMDSWwhmds])?\s?(.*)/, - false, - ), - addmuteTwitch: new Command( - banPhraseTwitch(600, 'mute'), - true, - true, - /(\d+[HMDSWwhmds])?\s?(.*)/, - false, - ), - addbanDGG: new Command(banPhraseDGG(), false, true, /(\d+[HMDSWwhmds])?\s?(.*)/, false), -}; +module.exports = new Command(banPhraseDGG(), false, true, /(\d+[HMDSWwhmds])?\s?(.*)/, false); diff --git a/lib/commands/implementations/unbanphrase.js b/lib/commands/implementations/unbanphrase.js index a629d24..ac97ae2 100644 --- a/lib/commands/implementations/unbanphrase.js +++ b/lib/commands/implementations/unbanphrase.js @@ -1,31 +1,10 @@ -const _ = require('lodash'); const Command = require('../command-interface'); const CommandOutput = require('../command-output'); -function unbanPhraseTwitch() { - return (input, services) => { - const matched = /(.*)/.exec(input); - const phraseToUnban = _.get(matched, 1, '').toLowerCase(); - if (services.spamDetection.hasBannedPhrase(phraseToUnban) === false) { - return Promise.resolve(new CommandOutput(null, 'Phrase is not registered! Did nothing.')); - } - return services.sql - .deleteBannedPhrase(phraseToUnban) - .then(() => { - services.spamDetection.removeBannedPhrase(phraseToUnban); - return new CommandOutput(null, 'Phrase unbanned! AngelThump'); - }) - .catch((err) => new CommandOutput(err, 'Oops. Something did not work. Check the logs.')); - }; -} - function unbanPhraseDGG() { return () => { return new CommandOutput(null, 'This command has been removed, use native /removeban instead.'); }; } -module.exports = { - unbanphraseTwitch: new Command(unbanPhraseTwitch(), true, true, /(.*)/, false), - unbanphraseDGG: new Command(unbanPhraseDGG(), false, true), -}; +module.exports = new Command(unbanPhraseDGG(), false, true); diff --git a/lib/configuration/configure-commands.js b/lib/configuration/configure-commands.js index 9c5f74e..d1c5bdc 100644 --- a/lib/configuration/configure-commands.js +++ b/lib/configuration/configure-commands.js @@ -16,8 +16,8 @@ const song = require('../commands/implementations/song'); const earlierSong = require('../commands/implementations/earliersong'); const youtube = require('../commands/implementations/youtube'); const schedule = require('../commands/implementations/schedule'); -const { addbanDGG, addbanTwitch, addmuteTwitch } = require('../commands/implementations/banphrase'); -const { unbanphraseDGG, unbanphraseTwitch } = require('../commands/implementations/unbanphrase'); +const addbanDGG = require('../commands/implementations/banphrase'); +const unbanphraseDGG = require('../commands/implementations/unbanphrase'); const live = require('../commands/implementations/live'); const restart = require('../commands/implementations/restart'); const love = require('../commands/implementations/love'); @@ -33,7 +33,7 @@ const { gulag } = require('../commands/implementations/gulag'); const { mutelinks } = require('../commands/implementations/mutelinks'); const { breakingNews } = require('../commands/implementations/breaking-news'); -function registerCommandsFromFiles(commandRegistry, chatConnectedTo, config) { +function registerCommandsFromFiles(commandRegistry, config) { commandRegistry.registerCommand('!stalk', stalk); commandRegistry.registerCommand('!time', time(config.timezone, config.timezoneString)); commandRegistry.registerCommand('!addcommand', addCommand, ['!ac']); @@ -80,48 +80,33 @@ function registerCommandsFromFiles(commandRegistry, chatConnectedTo, config) { '!linksmute', ]); commandRegistry.registerCommand('!breakingnews', breakingNews, ['!breaking', '!bn']); - - if (chatConnectedTo === 'dgg') { - commandRegistry.registerCommand('!addban', addbanDGG, ['!addmute']); - commandRegistry.registerCommand('!deleteban', unbanphraseDGG, [ - '!deletemute', - '!removeban', - '!removemute', - '!dmute', - '!dban', - ]); - commandRegistry.registerCommand('!voteban', voteBan); - commandRegistry.registerCommand('!voteipban', voteIpban); - commandRegistry.registerCommand('!svoteban', svoteBan); - commandRegistry.registerCommand('!svoteipban', svoteIpban); - commandRegistry.registerCommand('!questions', getThreadInfo, [ - '!podcastquestions', - '!dtquestions', - '!dtsubmissions', - '!!dtq', - ]); - commandRegistry.registerCommand('!newsubquestions', startNewThread, [ - '!nsq', - '!newredditquestions', - ]); - commandRegistry.registerCommand('!stopsubquestions', stopQuestionSubmissions, [ - '!ssq', - '!stopredditquestions', - ]); - commandRegistry.registerCommand('!gulag', gulag); - } - - if (chatConnectedTo === 'twitch') { - commandRegistry.registerCommand('!addban', addbanTwitch); - commandRegistry.registerCommand('!addmute', addmuteTwitch); - commandRegistry.registerCommand('!deleteban', unbanphraseTwitch, [ - '!deletemute', - '!removeban', - '!removemute', - '!dmute', - '!dban', - ]); - } + commandRegistry.registerCommand('!addban', addbanDGG, ['!addmute']); + commandRegistry.registerCommand('!deleteban', unbanphraseDGG, [ + '!deletemute', + '!removeban', + '!removemute', + '!dmute', + '!dban', + ]); + commandRegistry.registerCommand('!voteban', voteBan); + commandRegistry.registerCommand('!voteipban', voteIpban); + commandRegistry.registerCommand('!svoteban', svoteBan); + commandRegistry.registerCommand('!svoteipban', svoteIpban); + commandRegistry.registerCommand('!questions', getThreadInfo, [ + '!podcastquestions', + '!dtquestions', + '!dtsubmissions', + '!!dtq', + ]); + commandRegistry.registerCommand('!newsubquestions', startNewThread, [ + '!nsq', + '!newredditquestions', + ]); + commandRegistry.registerCommand('!stopsubquestions', stopQuestionSubmissions, [ + '!ssq', + '!stopredditquestions', + ]); + commandRegistry.registerCommand('!gulag', gulag); } async function setupCommandsAndCachesFromDb( diff --git a/lib/configuration/sample.config.json b/lib/configuration/sample.config.json index dbb7029..39586a6 100644 --- a/lib/configuration/sample.config.json +++ b/lib/configuration/sample.config.json @@ -1,5 +1,4 @@ { - "chatToConnectTo": "dgg", "timezone": "America/Tijuana", "timezoneString": "svensk", "dggChat": { @@ -8,7 +7,10 @@ "cookieToken": "yourCookieToken", "botNick": "yourBotNick" }, - "scheduledCommands": ["!youtube", "!schedule"], + "scheduledCommands": [ + "!youtube", + "!schedule" + ], "logger": { "level": "debug" }, @@ -86,12 +88,6 @@ "schedule": { "messageIntervalMillis": 900000 }, - "twitch": { - "clientId": "yourClientId", - "clientSecret": "yourClientSecret", - "accessToken": "yourAccesstoken", - "channelId": "yourChannel" - }, "twitter": { "consumerKey": "", "consumerSecret": "", @@ -134,4 +130,4 @@ "threadFilePath": "", "stateStoreFilePath": "" } -} +} \ No newline at end of file diff --git a/lib/message-routing/chat-service-router.js b/lib/message-routing/chat-service-router.js index 70905ca..f57ce79 100644 --- a/lib/message-routing/chat-service-router.js +++ b/lib/message-routing/chat-service-router.js @@ -2,7 +2,6 @@ const _ = require('lodash'); class ChatServiceRouter { constructor( - chatToConnectTo, bot, messageRouter, commandRouter, @@ -14,7 +13,6 @@ class ChatServiceRouter { ) { this.messageRouter = messageRouter; this.commandRouter = commandRouter; - this.chatToConnectTo = chatToConnectTo; this.logger = logger; this.bot = bot; this.punishmentStream = punishmentStream; @@ -32,11 +30,9 @@ class ChatServiceRouter { this.bot.on('closed', () => { this.logger.info('Chat socket closed. Attempting to reconnect....'); - if (this.chatToConnectTo === 'dgg') { - setTimeout(() => { - this.bot.connect(); - }, 5000); - } + setTimeout(() => { + this.bot.connect(); + }, 5000); }); this.bot.on('open', () => { @@ -71,19 +67,8 @@ class ChatServiceRouter { return; } - if ( - this.chatToConnectTo === 'dgg' && - outputObject.isMultiLine && - outputObject.isWhisper === false - ) { + if (outputObject.isMultiLine && outputObject.isWhisper === false) { this.bot.sendMultiLine(outputObject.output); - } else if ( - this.chatToConnectTo === 'twitch' && - outputObject.isMultiLine && - outputObject.isWhisper === false - ) { - // There's no good way to do multilines in twitch atm? :C - this.bot.sendMessage(outputObject.output.join(' ')); } else if (outputObject.isWhisper === true) { this.bot.sendWhisper(outputObject.user, outputObject.output); } else { @@ -112,15 +97,11 @@ class ChatServiceRouter { }); this.fakeScheduler.on('command', (message) => { - if (message.forStream === this.chatToConnectTo || message.forStream === 'both') { - this.bot.emit('command', message.command); - } + this.bot.emit('command', message.command); }); this.fakeScheduler.on('output', (message) => { - if (message.forStream === this.chatToConnectTo || message.forStream === 'both') { - this.bot.sendMessage(message.output); - } + this.bot.sendMessage(message.output); }); this.messageRelay.on('output', (message) => { @@ -129,9 +110,7 @@ class ChatServiceRouter { this.messageRelay.on('poll', (message) => { const poll = JSON.parse(message); - if (this.chatToConnectTo === 'dgg') { - this.bot.sendPoll(poll.weighted, poll.time, poll.question, poll.options); - } + this.bot.sendPoll(poll.weighted, poll.time, poll.question, poll.options); }); this.punishmentStream.on('data', (punishmentObject) => { @@ -152,7 +131,7 @@ class ChatServiceRouter { return; } - if (!_.isEmpty(punishmentObject.reason) && this.chatToConnectTo === 'dgg') { + if (!_.isEmpty(punishmentObject.reason)) { // If it's a MEGAnuke dont output the reason messages to chat if (punishmentObject.type === 'ban' && punishmentObject.isNuke === true) { return; diff --git a/lib/message-routing/message-router.js b/lib/message-routing/message-router.js index 9e7aaed..3c98f0a 100644 --- a/lib/message-routing/message-router.js +++ b/lib/message-routing/message-router.js @@ -12,7 +12,7 @@ const { getReporter } = require('../services/metrics/metrics-reporter'); const formatDuration = require('../chat-utils/format-duration'); class MessageRouter { - constructor(config, services) { + constructor(services) { this.logger = services.logger; this.chatCache = services.chatCache; this.punishmentCache = services.punishmentCache; @@ -20,7 +20,6 @@ class MessageRouter { this.spamDetection = services.spamDetection; this.roleCache = services.roleCache; this.messageRelay = services.messageRelay; - this.chatConnectedTo = config.chatConnectedTo; } routeIncomingMessages(newMessage) { @@ -37,36 +36,6 @@ class MessageRouter { return; } - if (this.chatConnectedTo === 'twitch') { - const bannedPhrase = this.spamDetection.checkAgainstBannedPhrases(messageContent); - - if (bannedPhrase !== false) { - if (bannedPhrase.type === 'mute') { - this.punishmentStream.write( - makeMute( - user, - bannedPhrase.duration, - `${user} muted for using banned phrase(${bannedPhrase.text}).`, - true, - ), - ); - } else if (bannedPhrase.type === 'ban') { - this.punishmentStream.write( - makeBan( - user, - bannedPhrase.duration, - null, - null, - `${user} banned for using banned phrase(${bannedPhrase.text}).`, - true, - ), - ); - } - this.chatCache.addMessageToRunningList(user, messageContent); - return; - } - } - const nukedPhrases = this.punishmentCache.getNukedPhrases(); const nukeResult = isMessageNuked(nukedPhrases, messageContent); diff --git a/lib/services/fake-command-scheduler.js b/lib/services/fake-command-scheduler.js index c035a84..8d51c3f 100644 --- a/lib/services/fake-command-scheduler.js +++ b/lib/services/fake-command-scheduler.js @@ -7,11 +7,6 @@ class FakeCommandScheduler extends MessageScheduler { super(config); this.startScheduledMessages(); this.user = '__TheBot__'; - this.STREAM_ENUM = { - twitch: true, - dgg: true, - both: true, - }; } startScheduledMessages() { @@ -21,27 +16,17 @@ class FakeCommandScheduler extends MessageScheduler { const type = _.get(this.scheduledMessages, `${this.messageCursor}.type`, null); if (type === 'command') { const command = _.get(this.scheduledMessages, `${this.messageCursor}.parsed`, null); - const forStream = _.get( - this.scheduledMessages, - `${this.messageCursor}.forStream`, - null, - ); this.incrementMessageCursor(); if (command !== null) { - this.emit('command', { forStream, command }); + this.emit('command', { command }); } } if (type === 'output') { const output = _.get(this.scheduledMessages, `${this.messageCursor}.output`, null); - const forStream = _.get( - this.scheduledMessages, - `${this.messageCursor}.forStream`, - null, - ); this.incrementMessageCursor(); if (output !== null) { - this.emit('output', { forStream, output }); + this.emit('output', { output }); } } } @@ -49,18 +34,13 @@ class FakeCommandScheduler extends MessageScheduler { }, Math.floor(this.messageInterval / 2)); } - createMessage(input, forStream = 'both') { - if (this.STREAM_ENUM[forStream] !== true) { - return false; - } - + createMessage(input) { if (_.isEmpty(input)) { return false; } this.scheduledMessages.push({ type: 'command', - forStream, parsed: { parsedCommand: parseCommand(input), parsedMessage: { @@ -73,18 +53,13 @@ class FakeCommandScheduler extends MessageScheduler { return true; } - createHardcodedOutput(output, forStream = 'both') { - if (this.STREAM_ENUM[forStream] !== true) { - return false; - } - + createHardcodedOutput(output) { if (_.isEmpty(output)) { return false; } this.scheduledMessages.push({ type: 'output', - forStream, output, }); return true; diff --git a/lib/services/over-rustle-logs.js b/lib/services/over-rustle-logs.js index 01d55d1..b27641b 100644 --- a/lib/services/over-rustle-logs.js +++ b/lib/services/over-rustle-logs.js @@ -3,14 +3,13 @@ const moment = require('moment'); const formatDuration = require('../chat-utils/format-duration'); // no tears.. class OverrustleLogs { - constructor(configuration, configuredChat) { - this.chat = configuredChat === 'dgg' ? 'Destinygg' : 'Destiny'; + constructor(configuration) { this.url = configuration.url; } getMostRecentLogsForUsers(user, amount) { return axios - .get(`${this.url}/api/v1/stalk/${this.chat}/${user}.json?limit=${amount}`) + .get(`${this.url}/api/v1/stalk/Destinygg/${user}.json?limit=${amount}`) .then((response) => response.data.lines.map((message) => { const now = moment.tz('UTC'); diff --git a/lib/services/service-index.js b/lib/services/service-index.js index 4721582..726c2c8 100644 --- a/lib/services/service-index.js +++ b/lib/services/service-index.js @@ -9,9 +9,9 @@ const SpamDetection = require('./spam-detection'); const ScheduledCommands = require('./message-scheduler'); const gulagService = require('./gulag'); const LastFm = require('./lastfm'); -const YouTube = require('./youtube.js'); -const GoogleCal = require('./schedule.js'); -const RoleCache = require('./role-cache.js'); +const YouTube = require('./youtube'); +const GoogleCal = require('./schedule'); +const RoleCache = require('./role-cache'); const DggApi = require('./dgg-api'); const TwitterApi = require('./twitter-api'); const FakeScheduler = require('./fake-command-scheduler'); @@ -21,11 +21,8 @@ const messageMatchingService = require('./message-matching'); const HTMLMetadata = require('./html-metadata'); class Services { - constructor(serviceConfigurations, chatConnectedTo) { - this.overRustle = new OverRustleLogs( - serviceConfigurations.overRustle, - serviceConfigurations.chatToConnectTo, - ); + constructor(serviceConfigurations) { + this.overRustle = new OverRustleLogs(serviceConfigurations.overRustle); this.logger = logger(serviceConfigurations.logger); this.sql = new Sql(serviceConfigurations.sql); this.commandRegistry = new CommandRegistry(); @@ -45,10 +42,7 @@ class Services { this.twitterApi = new TwitterApi(serviceConfigurations.twitter, this.logger); this.messageRelay = new MessageRelay(); this.htmlMetadata = new HTMLMetadata(); - // Since reddit relies on managing a single instance of a script, it only runs on the DGG bot. - if (chatConnectedTo === 'dgg') { - this.redditVote = new RedditVote(serviceConfigurations.redditVote, this.logger); - } + this.redditVote = new RedditVote(serviceConfigurations.redditVote, this.logger); } prepareAsyncServices() { diff --git a/lib/services/twitch-chat.js b/lib/services/twitch-chat.js deleted file mode 100644 index 3b8db92..0000000 --- a/lib/services/twitch-chat.js +++ /dev/null @@ -1,138 +0,0 @@ -const { client: TwitchJsClient } = require('twitch-js'); -const _ = require('lodash'); -const EventEmitter = require('events'); -const { parseCommand } = require('../chat-utils/parse-commands-from-chat'); - -class TwitchChatListener extends EventEmitter { - constructor(config, services) { - super(); - this.channel = config.channelId; - const token = config.accessToken; - const { clientId } = config; - - this.logger = services.logger; - - this.options = { - options: { - clientId, - }, - connection: { - reconnect: true, - }, - identity: { - username: this.channel, - password: `oauth:${token}`, - }, - channels: [this.channel], - }; - } - - connect() { - this.client = new TwitchJsClient(this.options); - this.client.on('message', this.parseMessages.bind(this)); - this.client.on('connected', (e) => { - this.emit('open', e); - }); - this.client.connect().catch((err) => { - this.logger.error('Problem logging into twitch:', err); - - // eslint-disable-next-line no-process-exit - process.exit(0); - }); - } - - sendMessage(message) { - this.client.say(this.channel, message).catch((err) => { - // This happens? Just crash and restart. - this.logger.error(`Error in twitch message say: ${err}`); - if (_.includes(err.message, 'not opened')) { - // eslint-disable-next-line no-process-exit - process.exit(0); - } - }); - } - - sendWhisper(user, message) { - this.client - .whisper(user, message) - .then() - .catch((err) => { - this.logger.error(err); - }); - } - - sendMute(punished) { - this.client - .timeout(this.channel, punished.user, Math.ceil(punished.duration), punished.reason) - .then(() => { - this.sendMessage(punished.reason); - }) - .catch((err) => { - this.logger.error(err); - }); - } - - sendBan(punished) { - if (!punished.isPermanent) { - this.sendMute(punished); - return; - } - this.client - .ban(this.channel, punished.user, punished.reason) - .then(() => { - this.sendMessage(punished.reason); - }) - .catch((err) => { - this.logger.error('Error while banning on twitch.', err); - }); - } - - sendUnban(punished) { - this.client - .unban(this.channel, punished.user) - .then(() => this.sendUnmute(punished)) - .catch((err) => { - this.logger.error('Error while unbanning on twitch.', err); - }); - } - - // No unmute, you have to overwrite the last mute with a 1 second timeout. - sendUnmute(punished) { - this.client.timeout(this.channel, punished.user, 1, '').catch((err) => { - this.logger.error(err); - }); - } - - parseMessages(channel, userState, message, self) { - if (self) { - return; - } - - // Handle different message types.. - if ( - userState['message-type'] === 'chat' || - userState['message-type'] === 'whisper' || - userState['message-type'] === 'action' - ) { - const isWhisper = userState['message-type'] === 'whisper'; - const parsedMessage = { - user: userState.username, - userId: userState['user-id'], - roles: _.keys(userState.badges).map((badge) => (badge === 'broadcaster' ? 'admin' : badge)), - message, - }; - - if (isWhisper === false) this.emit('message', parsedMessage); - - if (_.startsWith(message, '!')) { - this.emit('command', { - parsedMessage, - isWhisper, - parsedCommand: parseCommand(message), - }); - } - } - } -} - -module.exports = TwitchChatListener; diff --git a/package-lock.json b/package-lock.json index f9e9ff1..fd1b2fa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,7 +23,6 @@ "moment-timezone": "^0.5.31", "protobufjs": "^6.10.1", "sqlite3": "^5.0.0", - "twitch-js": "^2.0.0-beta.45", "twitter": "^1.1.0", "ws": "^7.3.1", "yargs": "^16.0.3" @@ -197,11 +196,6 @@ "integrity": "sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw==", "optional": true }, - "node_modules/@hapi/bourne": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@hapi/bourne/-/bourne-2.1.0.tgz", - "integrity": "sha512-i1BpaNDVLJdRBEKeJWkVO6tYX6DMFBuwMhSuWqLsY4ufeTKGVuV5rBsUhxPayXqnnWHgXUAmWK16H/ykO5Wj4Q==" - }, "node_modules/@humanwhocodes/config-array": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.5.0.tgz", @@ -806,92 +800,6 @@ "sprintf-js": "~1.0.2" } }, - "node_modules/args": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/args/-/args-5.0.3.tgz", - "integrity": "sha512-h6k/zfFgusnv3i5TU08KQkVKuCPBtL/PWQbWkHUxvJrZ2nAyeaUupneemcrgn1xmqxPQsPIzwkUhOpoqPDRZuA==", - "dependencies": { - "camelcase": "5.0.0", - "chalk": "2.4.2", - "leven": "2.1.0", - "mri": "1.1.4" - }, - "engines": { - "node": ">= 6.0.0" - } - }, - "node_modules/args/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/args/node_modules/camelcase": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.0.0.tgz", - "integrity": "sha512-faqwZqnWxbxn+F1d399ygeamQNy3lPp/H9H6rNrqYh4FSVCtcY+3cub1MxA8o9mDd55mM8Aghuu/kuyYA6VTsA==", - "engines": { - "node": ">=6" - } - }, - "node_modules/args/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/args/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/args/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" - }, - "node_modules/args/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/args/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "engines": { - "node": ">=4" - } - }, - "node_modules/args/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/array-buffer-byte-length": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.0.tgz", @@ -1038,14 +946,6 @@ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, - "node_modules/atomic-sleep": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/atomic-sleep/-/atomic-sleep-1.0.0.tgz", - "integrity": "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==", - "engines": { - "node": ">=8.0.0" - } - }, "node_modules/audio-extensions": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/audio-extensions/-/audio-extensions-0.0.0.tgz", @@ -1379,6 +1279,7 @@ "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -1394,6 +1295,7 @@ "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, "dependencies": { "has-flag": "^4.0.0" }, @@ -1633,14 +1535,6 @@ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==" }, - "node_modules/cross-fetch": { - "version": "3.1.8", - "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.8.tgz", - "integrity": "sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg==", - "dependencies": { - "node-fetch": "^2.6.12" - } - }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -1758,14 +1652,6 @@ "url": "https://opencollective.com/date-fns" } }, - "node_modules/dateformat": { - "version": "4.6.3", - "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-4.6.3.tgz", - "integrity": "sha512-2P0p0pFGzHS5EMnhdxQi7aJN+iMheud0UhG4dlE1DLAlvL8JHjJJTX/CSm4JXwV0Ka5nGk3zC5mcb5bUQUxxMA==", - "engines": { - "node": "*" - } - }, "node_modules/dayjs": { "version": "1.11.10", "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.10.tgz", @@ -1929,17 +1815,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/delay": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/delay/-/delay-4.4.1.tgz", - "integrity": "sha512-aL3AhqtfhOlT/3ai6sWXeqwnw63ATNpnUiN4HL7x9q+My5QtHlO3OIkasmug9LKzpheLdmUKGRKnYXYAS7FQkQ==", - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -2094,14 +1969,6 @@ "iconv-lite": "^0.6.2" } }, - "node_modules/end-of-stream": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", - "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "dependencies": { - "once": "^1.4.0" - } - }, "node_modules/enquirer": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.4.1.tgz", @@ -2685,11 +2552,6 @@ "node": ">=6" } }, - "node_modules/eventemitter3": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", - "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==" - }, "node_modules/execa": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/execa/-/execa-7.2.0.tgz", @@ -2767,19 +2629,6 @@ "fastest-levenshtein": "^1.0.7" } }, - "node_modules/fast-redact": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/fast-redact/-/fast-redact-3.3.0.tgz", - "integrity": "sha512-6T5V1QK1u4oF+ATxs1lWUmlEk6P2T9HqJG3e2DnHOdVgZy2rFJBoEnrIedcTXlkAHU/zKC+7KETJ+KGGKwxgMQ==", - "engines": { - "node": ">=6" - } - }, - "node_modules/fast-safe-stringify": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", - "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==" - }, "node_modules/fast-text-encoding": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/fast-text-encoding/-/fast-text-encoding-1.0.6.tgz", @@ -2894,11 +2743,6 @@ "node": "^10.12.0 || >=12.0.0" } }, - "node_modules/flatstr": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/flatstr/-/flatstr-1.0.12.tgz", - "integrity": "sha512-4zPxDyhCyiN2wIAtSLI6gc82/EjqZc1onI4Mz/l0pWrAlsSfYH/2ZIcU+e3oA2wDwbzIWNKwa23F8rh6+DRWkw==" - }, "node_modules/flatted": { "version": "3.2.9", "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.9.tgz", @@ -3358,6 +3202,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, "engines": { "node": ">=8" } @@ -3724,14 +3569,6 @@ "node": ">= 0.4" } }, - "node_modules/invariant": { - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", - "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", - "dependencies": { - "loose-envify": "^1.0.0" - } - }, "node_modules/ip": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz", @@ -4188,26 +4025,11 @@ "@pkgjs/parseargs": "^0.11.0" } }, - "node_modules/jmespath": { - "version": "0.15.0", - "resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.15.0.tgz", - "integrity": "sha512-+kHj8HXArPfpPEKGLZ+kB5ONRTCiGQXo8RQYL0hH8t6pWXUBBK5KkkQmTNOwKK4LEsd0yTsgtjJVm4UBSZea4w==", - "engines": { - "node": ">= 0.6.0" - } - }, - "node_modules/joycon": { - "version": "2.2.5", - "resolved": "https://registry.npmjs.org/joycon/-/joycon-2.2.5.tgz", - "integrity": "sha512-YqvUxoOcVPnCp0VU1/56f+iKSdvIRJYPznH22BdXV3xMk75SFXhWeJkZ8C9XxUWt1b5x2X1SxuFygW1U0FmkEQ==", - "engines": { - "node": ">=6" - } - }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true }, "node_modules/js-yaml": { "version": "3.14.1", @@ -4397,14 +4219,6 @@ "node": ">=0.10.0" } }, - "node_modules/leven": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/leven/-/leven-2.1.0.tgz", - "integrity": "sha512-nvVPLpIHUxCUoRLrFqTgSxXJ614d8AgQoWl7zPe/2VadE8+1dpU3LBhowRuBAcuwruWtOdD8oYC9jDNJjXDPyA==", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/levn": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", @@ -4483,17 +4297,6 @@ "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" }, - "node_modules/loose-envify": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", - "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "dependencies": { - "js-tokens": "^3.0.0 || ^4.0.0" - }, - "bin": { - "loose-envify": "cli.js" - } - }, "node_modules/lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -4552,6 +4355,7 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz", "integrity": "sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==", + "dev": true, "engines": { "node": ">=8" }, @@ -5008,14 +4812,6 @@ "node": "*" } }, - "node_modules/mri": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/mri/-/mri-1.1.4.tgz", - "integrity": "sha512-6y7IjGPm8AzlvoUrwAaw1tLnUBudaS3752vcd8JtrpGGQn+rXIe63LFVHm/YMwtqAuh+LJPCFdlLYPWM1nYn6w==", - "engines": { - "node": ">=4" - } - }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -5596,47 +5392,6 @@ "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", "dev": true }, - "node_modules/p-cancelable": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-2.1.1.tgz", - "integrity": "sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg==", - "engines": { - "node": ">=8" - } - }, - "node_modules/p-event": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/p-event/-/p-event-4.2.0.tgz", - "integrity": "sha512-KXatOjCRXXkSePPb1Nbi0p0m+gQAwdlbhi4wQKJPI1HsMQS9g+Sqp2o+QHziPr7eYJyOZet836KoHEVM1mwOrQ==", - "dependencies": { - "p-timeout": "^3.1.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-event/node_modules/p-timeout": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-3.2.0.tgz", - "integrity": "sha512-rhIwUycgwwKcP9yTOOFK/AKsAopjjCakVqLHePO3CC6Mir1Z99xT+R63jZxAT5lFZLa2inS5h+ZS2GvR99/FBg==", - "dependencies": { - "p-finally": "^1.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/p-finally": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", - "integrity": "sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow==", - "engines": { - "node": ">=4" - } - }, "node_modules/p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", @@ -5681,40 +5436,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/p-queue": { - "version": "6.6.2", - "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-6.6.2.tgz", - "integrity": "sha512-RwFpb72c/BhQLEXIZ5K2e+AhgNVmIejGlTgiB9MzZ0e93GRvqZ7uSi0dvRF7/XIXDeNkra2fNHBxTyPDGySpjQ==", - "dependencies": { - "eventemitter3": "^4.0.4", - "p-timeout": "^3.2.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-queue/node_modules/p-timeout": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-3.2.0.tgz", - "integrity": "sha512-rhIwUycgwwKcP9yTOOFK/AKsAopjjCakVqLHePO3CC6Mir1Z99xT+R63jZxAT5lFZLa2inS5h+ZS2GvR99/FBg==", - "dependencies": { - "p-finally": "^1.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/p-timeout": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-4.1.0.tgz", - "integrity": "sha512-+/wmHtzJuWii1sXn3HCuH/FTwGhrp4tmJTxSKJbfS+vkipci6osxXM5mY0jUiRzWKMTgUT8l7HFbeSwZAynqHw==", - "engines": { - "node": ">=10" - } - }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -5875,61 +5596,6 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, - "node_modules/pify": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-5.0.0.tgz", - "integrity": "sha512-eW/gHNMlxdSP6dmG6uJip6FXN0EQBwm2clYYd8Wul42Cwu/DK8HEftzsapcNdYe2MfLiIwZqsDk2RDEsTE79hA==", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/pino": { - "version": "6.14.0", - "resolved": "https://registry.npmjs.org/pino/-/pino-6.14.0.tgz", - "integrity": "sha512-iuhEDel3Z3hF9Jfe44DPXR8l07bhjuFY3GMHIXbjnY9XcafbyDDwl2sN2vw2GjMPf5Nkoe+OFao7ffn9SXaKDg==", - "dependencies": { - "fast-redact": "^3.0.0", - "fast-safe-stringify": "^2.0.8", - "flatstr": "^1.0.12", - "pino-std-serializers": "^3.1.0", - "process-warning": "^1.0.0", - "quick-format-unescaped": "^4.0.3", - "sonic-boom": "^1.0.2" - }, - "bin": { - "pino": "bin.js" - } - }, - "node_modules/pino-pretty": { - "version": "4.8.0", - "resolved": "https://registry.npmjs.org/pino-pretty/-/pino-pretty-4.8.0.tgz", - "integrity": "sha512-mhQfHG4rw5ZFpWL44m0Utjo4GC2+HMfdNvxyA8lLw0sIqn6fCf7uQe6dPckUcW/obly+OQHD7B/MTso6LNizYw==", - "dependencies": { - "@hapi/bourne": "^2.0.0", - "args": "^5.0.1", - "chalk": "^4.0.0", - "dateformat": "^4.5.1", - "fast-safe-stringify": "^2.0.7", - "jmespath": "^0.15.0", - "joycon": "^2.2.5", - "pump": "^3.0.0", - "readable-stream": "^3.6.0", - "rfdc": "^1.3.0", - "split2": "^3.1.1", - "strip-json-comments": "^3.1.1" - }, - "bin": { - "pino-pretty": "bin.js" - } - }, - "node_modules/pino-std-serializers": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-3.2.0.tgz", - "integrity": "sha512-EqX4pwDPrt3MuOAAUBMU0Tk5kR/YcCM5fNPEzgCO2zJ5HfX0vbiH9HbJglnyeQsN96Kznae6MWD47pZB5avTrg==" - }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -5974,11 +5640,6 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/process-warning": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/process-warning/-/process-warning-1.0.0.tgz", - "integrity": "sha512-du4wfLyj4yCZq1VupnVSZmRsPJsNuxoDQFdCFHLaYiEbFBD7QE0a+I4D7hOxrVnh78QE/YipFAj9lXHiXocV+Q==" - }, "node_modules/progress": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", @@ -6052,15 +5713,6 @@ "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==" }, - "node_modules/pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "dependencies": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, "node_modules/punycode": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", @@ -6096,11 +5748,6 @@ "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" }, - "node_modules/quick-format-unescaped": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/quick-format-unescaped/-/quick-format-unescaped-4.0.4.tgz", - "integrity": "sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg==" - }, "node_modules/quick-lru": { "version": "6.1.2", "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-6.1.2.tgz", @@ -6534,11 +6181,6 @@ "node": ">= 4" } }, - "node_modules/rfdc": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz", - "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==" - }, "node_modules/rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", @@ -6945,15 +6587,6 @@ "node": ">= 14" } }, - "node_modules/sonic-boom": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-1.4.1.tgz", - "integrity": "sha512-LRHh/A8tpW7ru89lrlkU4AszXt1dbwSjVWguGrmlxE7tawVmDBlI1PILMkXAxJTwqhgsEeTHzj36D5CmHgQmNg==", - "dependencies": { - "atomic-sleep": "^1.0.0", - "flatstr": "^1.0.12" - } - }, "node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -7009,14 +6642,6 @@ "integrity": "sha512-eWN+LnM3GR6gPu35WxNgbGl8rmY1AEmoMDvL/QD6zYmPWgywxWqJWNdLGT+ke8dKNWrcYgYjPpG5gbTfghP8rw==", "dev": true }, - "node_modules/split2": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/split2/-/split2-3.2.2.tgz", - "integrity": "sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg==", - "dependencies": { - "readable-stream": "^3.0.0" - } - }, "node_modules/sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -7517,6 +7142,7 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, "engines": { "node": ">=8" }, @@ -7668,11 +7294,6 @@ "node": ">=10" } }, - "node_modules/tekko": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/tekko/-/tekko-2.4.0.tgz", - "integrity": "sha512-ZJizFTaZizo9Ah2+QU0DXYlN3u78MjbGRmOTt63Lt7eLnlVBRTu4YL1yjlGsvT5Lb8sZNA0maY1lgKvRomb+1Q==" - }, "node_modules/temp-dir": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-3.0.0.tgz", @@ -7841,14 +7462,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/ts-custom-error": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/ts-custom-error/-/ts-custom-error-3.3.1.tgz", - "integrity": "sha512-5OX1tzOjxWEgsr/YEUWSuPrQ00deKLh6D7OTWcvNHm12/7QPyRh8SYpyWvA4IZv8H/+GQWQEh/kwo95Q9OVW1A==", - "engines": { - "node": ">=14.0.0" - } - }, "node_modules/tsconfig-paths": { "version": "3.15.0", "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", @@ -7883,66 +7496,6 @@ "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==" }, - "node_modules/twitch-js": { - "version": "2.0.0-beta.45", - "resolved": "https://registry.npmjs.org/twitch-js/-/twitch-js-2.0.0-beta.45.tgz", - "integrity": "sha512-+lWPF4N3YmmUBl3du9wChyC4qzYWNzquFInXyXD12Jo6C+fkm7sA6SBA5LmgX/6auQzE66QUGpOl7QUTpHgkxg==", - "dependencies": { - "camelcase-keys": "^6.2.2", - "cross-fetch": "^3.1.5", - "delay": "^4.4.0", - "eventemitter3": "^4.0.7", - "invariant": "^2.2.4", - "lodash": "^4.17.20", - "p-cancelable": "^2.0.0", - "p-event": "^4.2.0", - "p-queue": "^6.6.1", - "p-timeout": "^4.1.0", - "pify": "^5.0.0", - "pino": "^6.6.1", - "pino-pretty": "^4.2.1", - "qs": "^6.9.4", - "tekko": "2.4.0", - "ts-custom-error": "^3.2.0", - "ws": "^7.3.1" - }, - "engines": { - "node": ">=10", - "yarn": "^1.9.2" - } - }, - "node_modules/twitch-js/node_modules/camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "engines": { - "node": ">=6" - } - }, - "node_modules/twitch-js/node_modules/camelcase-keys": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-6.2.2.tgz", - "integrity": "sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg==", - "dependencies": { - "camelcase": "^5.3.1", - "map-obj": "^4.0.0", - "quick-lru": "^4.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/twitch-js/node_modules/quick-lru": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz", - "integrity": "sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==", - "engines": { - "node": ">=8" - } - }, "node_modules/twitter": { "version": "1.7.1", "resolved": "https://registry.npmjs.org/twitter/-/twitter-1.7.1.tgz", diff --git a/package.json b/package.json index f528c04..02c665e 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,6 @@ "moment-timezone": "^0.5.31", "protobufjs": "^6.10.1", "sqlite3": "^5.0.0", - "twitch-js": "^2.0.0-beta.45", "twitter": "^1.1.0", "ws": "^7.3.1", "yargs": "^16.0.3"