-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
56 lines (44 loc) · 1.21 KB
/
index.js
File metadata and controls
56 lines (44 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env node
console.log('Started!')
const Client = require('discord.js').Client
const bot = new Client()
const spawn = require('child_process').spawn
let q = []
let busy = false
// let acros = {
// 'lol': 'licking old lips',
// 'lmao': 'laughing my ass off',
// 'lmfao': 'laughing my fucking ass off',
// 'imo': 'in my opinion',
// 'rip': 'rest in peace'
// }
// for (var acro in acros) {
// message = name + ' says ' + content.replace(new RegExp('\s*' + acro + '\s*'), acros[acro])
// }
var name_previous = ''
bot.on('message', msg => {
var name = msg.member.displayName
var content = msg.cleanContent
var message
if (content === '') {
message = name + ' uploaded media'
} else if (content.indexOf('https://') === 0 || content.indexOf('http://') === 0) {
message = name + ' posted a link'
} else if (name === name_previous) {
message = content
} else {
message = name + ' says ' + content
}
name_previous = name
if (q.length < 10) q.push(message)
if (!busy) say(q.shift())
})
function say(message) {
busy = true
var proc = spawn('say', [message])
proc.on('exit', () => {
busy = false
if (q.length) say(q.shift())
})
}
bot.login(require('./token'))