Compare commits

..

No commits in common. "8f9d261507752f2adeadf9ef0f00e413dbedf4d8" and "8f5510993c0c8e1b9fdceb4bf65a7ad44f66cfab" have entirely different histories.

3 changed files with 9 additions and 20 deletions

View File

@ -1,11 +0,0 @@
const phrases = [
'Did you know? Zhachev is a twat.',
'Zhachev is a poor lonely baby who has been stalking this IRC for over a year. anti-civ 4 lyfe!',
]
const handleSpam = event => {
const phrase = phrases[Math.floor(Math.random() * phrases.length)]
return event.reply(phrase)
}
module.exports = handleSpam

View File

@ -45,9 +45,9 @@ const clearAllPlaylists = event => {
}
const addAllPlaylists = async event => {
try {
const files = fs.readdirSync('./playlists')
const tracks = readPlaylists(files)
try {
await Promise.all(
tracks.map(t => insertTrackAsync(t.split(' # ')[0]))
).then(() => {
@ -61,8 +61,13 @@ const addAllPlaylists = async event => {
const readPlaylists = files =>
files
.map(f => fs.readFileSync('./playlists/' + f, 'utf-8').split('\n'))
.reduce((a, b) => a.concat(b))
.map(f =>
fs
.readFileSync('./playlists/' + f)
.toString()
.split('\n')
)
.flat()
const handleError = (err, event) => {
console.log(err)

View File

@ -3,9 +3,6 @@ const chalk = require('chalk')
require('dotenv').config()
const { insertTrack } = require('./mpc-commands')
let request = ''
const handleSpam = require('./handleSpam')
const CLIENT_ID = process.env.CLIENT_ID
const CLIENT_SECRET = process.env.CLIENT_SECRET
@ -50,8 +47,6 @@ const searchTrack = event => {
}
const requestTrack = event => {
if (event.message === request) return handleSpam(event)
request = event.message
let pattern = /^!request "(.+?)"( artist "(.+?)")?/
let match = event.message.match(pattern)
if (!match)