-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.js
68 lines (43 loc) · 1.22 KB
/
bot.js
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
57
58
59
60
61
62
63
64
65
66
67
68
var Discord = require('discord.io');
var logger = require('winston');
var auth = require('./auth.json');
const request = require('request');
logger.remove(logger.transports.Console);
logger.add(new logger.transports.Console, {
colorize: true
});
logger.level = 'debug';
var bot = new Discord.Client({
token: auth.token,
autorun: true
});
bot.on('ready', function (evt) {
logger.info('Connected');
logger.info('Logged in as: ');
logger.info(bot.username + ' - (' + bot.id + ')');
});
bot.on('message', function (user, userID, channelID, message, evt) {
var ServerID = bot.channels[channelID].guild_id;
var voiceChannelID=bot.servers[ServerID].members[userID].voice_channel_id;
var _stream;
if(message=="!feno")
{
if(!bot.channels[channelID].self_mute)
bot.unmuteSelf(ServerID);
bot.joinVoiceChannel(voiceChannelID, function (b) {
bot.getAudioContext(voiceChannelID, function (error, stream) {
var t=request('https://listen.radyofenomen.com/fenomen/96/icecast.audio');
t.pipe(stream,{
end: false
});
stream.on('done', function () {
});
});
});
}
if(message=="!fenoff" )
{
bot.muteSelf(ServerID);
bot.leaveVoiceChannel(voiceChannelID);
}
});