Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Fuechschen committed Jul 9, 2016
2 parents cb10632 + 7bdfb5e commit 4644baa
Show file tree
Hide file tree
Showing 60 changed files with 1,615 additions and 804 deletions.
62 changes: 26 additions & 36 deletions bot.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
var config = require('./lib/load_config.js');
var moment = require('moment');
var storyboard = require('storyboard');
var fs = require('fs');

var config = require('./lib/load_config.js');
var langfile = require('./langfile.js');
var moment = require('moment');
var story = storyboard.mainStory;

storyboard.config({filter: '*:' + config.options.loglevel});
storyboard.mainStory.info('Starting plugbot version ' + require('./package.json').version);
Expand All @@ -18,39 +21,26 @@ redis.exists('meta:data:staff:active').then(function (ex) {
if (ex === 0) redis.set('meta:data:staff:active', 1);
});

plugged.on(plugged.LOGIN_SUCCESS, require('./lib/eventhandlers/login_success'));
plugged.on(plugged.LOGIN_ERROR, require('./lib/eventhandlers/login_error'));

plugged.on(plugged.CONN_SUCCESS, require('./lib/eventhandlers/conn_success'));
plugged.on(plugged.CONN_PART, require('./lib/eventhandlers/conn_part'));
plugged.on(plugged.CONN_ERROR, require('./lib/eventhandlers/conn_error'));
plugged.on(plugged.CONN_WARNING, require('./lib/eventhandlers/conn_warning'));

plugged.on(plugged.PLUG_MESSAGE, require('./lib/eventhandlers/plug_message'));
plugged.on(plugged.PLUG_ERROR, require('./lib/eventhandlers/plug_error'));
plugged.on(plugged.KILL_SESSION, require('./lib/eventhandlers/kill_session'));
plugged.on(plugged.PLUG_UPDATE, require('./lib/eventhandlers/plug_update'));
plugged.on(plugged.MAINTENANCE_MODE, require('./lib/eventhandlers/maintenance_mode'));

plugged.on(plugged.JOINED_ROOM, require('./lib/eventhandlers/joined_room'));

plugged.on(plugged.ADVANCE, require('./lib/eventhandlers/advance'));
plugged.on(plugged.WAITLIST_UPDATE, require('./lib/eventhandlers/waitlist_update'));

plugged.on(plugged.FRIEND_JOIN, require('./lib/eventhandlers/user_join'));
plugged.on(plugged.USER_JOIN, require('./lib/eventhandlers/user_join'));

plugged.on(plugged.USER_LEAVE, require('./lib/eventhandlers/user_leave'));

plugged.on(plugged.CHAT, require('./lib/eventhandlers/chat'));
plugged.on(plugged.CHAT_MENTION, require('./lib/eventhandlers/chat'));
plugged.on(plugged.CHAT_COMMAND, require('./lib/eventhandlers/chat_command'));

plugged.on(plugged.VOTE, require('./lib/eventhandlers/vote'));

plugged.on(plugged.MOD_STAFF, require('./lib/eventhandlers/mod_staff'));
plugged.on(plugged.MOD_BAN, require('./lib/eventhandlers/mod_ban'));
plugged.on(plugged.MOD_SKIP, require('./lib/eventhandlers/mod_skip'));
plugged.on(plugged.MOD_ADD_DJ, require('./lib/eventhandlers/mod_add_dj'));
fs.readdir('./lib/eventhandlers', function (err, files) {
if (err) {
story.fatal('Cannot load eventhandlers.', {attach: err});
process.exit(1);
} else {
files.forEach(function (file) {
try {
var h = require('./lib/eventhandlers/' + file);
if (Array.isArray(h.event)) {
h.event.forEach(function (event) {
plugged.on(event, h.handler);
});
} else plugged.on(h.event, h.handler);
story.debug('EventHandlers', 'Loaded Handler for Event ' + (Array.isArray(h.event) ? h.event.join() : h.event));
} catch (e) {
story.error('Failed to load eventhandler ' + file, {attach: e});
process.exit(1);
}
});
}
});

module.exports = {plugged: plugged, app: (config.web.enabled ? require('./web/index').app : null)};
29 changes: 23 additions & 6 deletions config.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module.exports = {
room: '',
bouncer_plus: true,
loglevel: 'INFO',
sql_debug: true,
dcmoveback: true,
command_prefix: '!',
disable_emote: true,
Expand All @@ -21,6 +22,7 @@ module.exports = {
},
redis: {
host: '',
password: undefined,
db: 2
},
sequelize: {
Expand Down Expand Up @@ -68,7 +70,8 @@ module.exports = {
lockskip: false
},
blacklist: {
lockskip: true
lockskip: true,
channelblacklist: true
},
chatfilter: {
enabled: true,
Expand All @@ -79,7 +82,15 @@ module.exports = {
mute_duration: 4000
},
links: {
plugdj: true
enabled: true,
regex: /(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,}))\.?)(?::\d{2,5})?(?:[/?#]\S*)?/g,
mode: 'blacklist',
filter: [],
plugdj: {
enabled: true,
hosts: ['plug.dj', 'support.plug.dj', 'cdn.plug.dj', 'stg.plug.dj', 'blog.plug.dj'],
allowed_paths: ['/subscribe', '/', '/support', '/about', '/ba', '/press', '/terms', '/privacy']
}
},
words: {
blacklist: []
Expand All @@ -91,13 +102,15 @@ module.exports = {
},
youtubeGuard: {
enabled: true,
block: false,
countryblocks: {
countries: ['DE']
countries: []
},
lockskip: true
},
soundcloudGuard: {
enabled: true,
block: false,
lockskip: true
},
titleguard: {
Expand Down Expand Up @@ -132,7 +145,7 @@ module.exports = {
enabled: false,
port: 3000,
cors: '*',
websocket: false,
websocket: false,
useUWS: true,
path: ''
},
Expand All @@ -149,14 +162,18 @@ module.exports = {
msg: 'My software is licensed under the MIT License: https://git.io/vawDl',
sender: true
},
tskip:{
tskip: {
msg: 'TSKIP automatically skips songs after a certain amount of time to avoid playing outros, etc.',
sender:true
sender: true
}
},
dcmoveback: {
enabled: true,
auto: true,
timeout: 3600
},
userfilter: {
enabled: false,
username_disallowed: []
}
};
1 change: 1 addition & 0 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ These commands are only available for bouncers when bouncer+ is enabled.
|!roulette| |(moves)[time]|Starts a roulette|
|!everyone| |[msg]|Mentions everyone|
|!toggleafk| | |Toggles AFKRemoval|
|!channelblacklist|!cbl|add (cid)/rem (cid)/toggle|Adds/Removes a whole youtube channel from the blacklist/toggles the channelblacklist|

## Manager Commands
Manager commands include bouncer and bouncer+ commands
Expand Down
6 changes: 5 additions & 1 deletion docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@
|chatfilter.ignorerole|number|Minimum role to ignore chatfilters. Defaults to 1 (resident-dj)|
|chatfilter.spam|object|Settings for the aggresivity of the chatfilter, ONLY EDIT IF YOU KNOW WHAT YOU ARE DOING|
|chatfilter.links|object|Settings for blocking links|
|chatfilter.links.plugdj|boolean|Sets the blocker for plugdj-links|
|chatfilter.links.enabled|boolean|Default value for the link filter|
|chatfilter.links.mode|ENUM('blacklist','whitelist')|Sets the mode for the linkfilter|
|chatfilter.links.filter|array[string]|Sets the filter for links. Put whitelisted/blacklisted hosts here (without http:///https://)|
|chatfilter.links.plugdj|object|Config for the plug.dj-link blocker|
|chatfilter.links.plugdj.enabled|string|Sets the plug.dj-link blocker|
|chatfilter.words.blacklist|array[string]|Sets blacklisted words|
|youtubeGuard|object|Settings for youtubeGuard|
|youtubeGuard.enabled|boolean|The default value for youtubeGuard|
Expand Down
7 changes: 7 additions & 0 deletions docs/peoples.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Peoples

This program doesn't solely use code of mine, some passages were taken from other programs

#### URL Regex

The URL Regex in the default config was taken from [Diego Perini](https://github.com/dperini), licensed under MIT, published on [Github Gist](https://gist.github.com/dperini/729294)
35 changes: 32 additions & 3 deletions langfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ module.exports = {
},
idbl: {
default: '/me [&{username}: Blacklist] Added "&{song}" to the blacklist.'
},
channelblacklist: {
enabled: '[&{username}: ChannelBlacklist enabled]',
disabled: '[&{username}: ChannelBlacklist disabled]',
skip: '@&{username}, your song "&{song}" was skipped because the uploaders channel is blacklisted in this room.',
skip_reason: '@&{username}, your song "&{song}" was skipped because the uploaders channel is blacklisted in this room: &{reason}',
add: '[&{username}: ChannelBlacklist] Added "&{cid}" to the channelblacklist.',
remove: '[&{username}: ChannelBlacklist] Removed "&{cid}" from the channelblacklist.'
}
},
skip: {
Expand Down Expand Up @@ -127,6 +135,10 @@ module.exports = {
},
language: {
warn: '@&{username}, please have look at our rules. You are speaking the wrong language!'
},
link:{
warn: '@&{username}, please stop sending these links.',
mute: '@&{username} didn\'t stop to send links, now he can\'t...'
}
},
unmute: {
Expand Down Expand Up @@ -178,6 +190,9 @@ module.exports = {
youtubeGuard: {
skip: '/me [YouTubeGuard]',
api_unreachable: '@staff, I couldn\'t reach YouTube to check the avability of the current song. Please check.',
block:'@&{username}, YouTube is currently blocked in this room.',
block_enabled:'[&{username}: YouTubeBlock enabled]',
block_disabled:'[&{username}: YouTubeBlock disabled]',
blocked: {
default: '@&{username}, your song "&{song}" was automatically added to the blacklist because it\'s blocked in the following countries: "&{countries}"',
bl_reason: 'Blocked in the following countries: &{countries}'
Expand Down Expand Up @@ -209,12 +224,18 @@ module.exports = {
default: '@&{username}, your song "&{song}" was automatically added to the blacklist because it\'s set as not embeddable on plug.dj.',
bl_reason: 'Video not embeddable'
},
ytUnavalable:{
default:'@&{username}, YouTube seems to be unavailable. Your song "&{song}" has therefore be skipped.'
},
enabled: '[&{username}: YouTubeGuard enabled]',
disabled: '[&{username}: YouTubeGuard disabled]'
},
soundcloudGuard: {
skip: '/me [SoundCloudGuard]',
api_unreachable: '@staff, I couldn\'t reach SoundCloud to check the avability of the current song. Please check.',
block:'@&{username}, SoundCloud is currently blocked in this room.',
block_enabled:'[&{username}: SoundCloudBlock enabled]',
block_disabled:'[&{username}: SoundCloudBlock disabled]',
deleted: {
default: '@&{username}, your song "&{song}" was automatically added to the blacklist because it has been deleted.',
bl_reason: 'Song was deleted.'
Expand Down Expand Up @@ -252,7 +273,7 @@ module.exports = {
warn_2: '&{usernames} You are still inactive. This is your last warning. Chat or you will be removed from the waitlist.',
remove: '&{usernames} You will now be removed from the waitlist for being afk.',
kick: '[Kicking @&{username} for autojoining the waitlist]',
usernames: '@&{username}',
usernames: '@&{username} ',
afk_msg: {
default: '@&{username}, &{user} is AFK [&{msg}]',
no_msg: '@&{username}, &{user} is AFK.'
Expand Down Expand Up @@ -363,10 +384,10 @@ module.exports = {
commands: {
reload_commands: '[&{username}: Reloaded Commands]'
},
joinmode:{
joinmode: {
addqueue: '[&{username}: Play] You are now in the queue and will be added when a spot is free.',
wlban: '[&{username}: Play] You are not allowed to join the waitlist.',
enabled:'[&{username}: Joinmode enabled]',
enabled: '[&{username}: Joinmode enabled]',
disabled: '[&{username}: Joinmode disabled]'
},
tskip: {
Expand All @@ -380,5 +401,13 @@ module.exports = {
},
clearghosts: {
default: '[&{username}: ClearGhosts] We will now be kicking all possible ghost-users out of the room to increase performance for the others. Be sure to have at least used the chat within the 50 hours @everyone'
},
userfilter:{
enabled: '[&{username}: UserFilter enabled]',
disabled: '[&{username}: UserFilter disabled]',
username: {
warn: '@&{username}, you name doesn\'t fit the room rules. Please change it or you will be banned within 60 seconds.',
ban: '@&{username} was banned for using a name against the room rules.'
}
}
};
Loading

0 comments on commit 4644baa

Please sign in to comment.