Skip to content

Commit

Permalink
3.0.0-alpha.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Remco committed May 8, 2016
1 parent c3f8922 commit 7e64eaf
Show file tree
Hide file tree
Showing 11 changed files with 185 additions and 45 deletions.
105 changes: 105 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# 3.0.0
## Alpha phase
### 3.0.0.alpha.2
Enabled command alias system.
Changed giphy endpoint for more randomness.
Added a `noDM` key.

### 3.0.0-alpha.1
Initial release, featuring all-new code.

# 2.0.0
## Release phase
### 2.1.1
Added timeouts.
Changed `request` to only accept full links from now on.
Made preparations for a future update.

### 2.1.0
Changed callbacks to promises.
Removed `playliststart`, playlists start automatically after the first video has been entered.
Extended timeout for initial join.
Several small tweaks.

### 2.0.0
Revamped database system.
Added token login support for the upcoming official Discord API.
Added expansive server-specific customization options.
Added user tracking for namechanges.
Added an upgrade script for users to upgrade from gamma.7 to 2.0.0
Removed server defaulting system.
Removed unneeded and unfinished files in `runtime`.
Removed unnecessary fluff from `config.json`.
Removed `welcoming-whitellist.json`, this is now handled by `customize`.
Removed `birds`, `ìdle` and `online`, `idle` and `online` are replaced with `setstatus`.
Temporary removed server blacklisting system, this will be reintroduced later.

# Gamma phase
(Gamma is a real thing in software development by the way, it's a synonym for RC (Release Candidate))
### 2.0.0-gamma.7
Changed welcoming system to adhere to a whitelist instead of being global.
Added server blacklisting for `join-server`.
**IMPORTANT** Changed `join-server` to use mentions instead of usernames, the new invocation is `join-server @WildBeast <instant-invite>`, change `WildBeast` with your bots username.

### 2.0.0-gamma.6
Added YouTube playlist support.

### 2.0.0-gamma.5
Removed `play` and `yt-play`.
Added playlisting for YouTube video's.

### 2.0.0-gamma.4
Revamped music streaming permissions due to the way the normal permissions handle.
Added some extra commands.
Hopefully improved the reliability of `stop` for music streaming.
Made preparations for a future update.

### 2.0.0-gamma.3
*This is a relative small update.*
Added YouTube streaming.

### 2.0.0-gamma.2
Added some extra commands.
Revamped debug mode and verbose logging.
Changed `setowner` to set server owner to level 4 instead of level 3.
Changed commands that where at level 4 to level 5.

### 2.0.0-gamma.1
Added a timeout feature.
**GET HYPED FOR MUSIC STREAMING!**
Changed `versionchecker.js` ability to check for beta versions to gamma version checking.
Moved to LevelDB instead of Redis for handling permission storage and handling timeouts.

# Beta phase
### 2.0.0-beta.5
Fixes several problems caused by 2.0.0-beta.4
Added an *incomplete* server defaulting system.
Added `setstatus`.
Changed the fixed length of `cmd_prefix` to a dynamic length.
Changed the fixed character prefix to switch to mention activation if desired.

### 2.0.0-beta.4
Fixed `myapifilms_token` not existing.
Fixed problems with `++setowner`.
Added `debug_mode` and `verbose_logging`. *(Note, only enable these on request of the devs!)*
Added a config value that'll change the way `++help` functions.
Updated the layout of `config.json`, **meaning that users need to remake their config files.**

### 2.0.0-beta.3
Fixed `giphy.js` not having requires.
Fixed `suffix` not behaving accordingly.
Added `++fortunecow`, `++randomcat`, `++rule34` and `++leetspeak`.
Added `mashape_key` to `config.json`.
Removed NSFW flags from commands that did not need them, as this will cause problems with `++help`.
Removed `deletion.js`, as this is needlessly split.

### 2.0.0-beta.2
Updated `versionchecker.js` to check for beta updates.
Moved to double prefix activation instead of single prefix activation as requested by Discord API, we recommend using `++`.
Bot is also compliant with the [Discord bot best practises](https://github.com/meew0/discord-bot-best-practices), also requested by Discord API.

### 2.0.0-beta.1
Initial release of DougBot 2.0, featuring new permission system and stability improvements.

## Alpha phase
Nothing too interesting lol.
24 changes: 14 additions & 10 deletions DougBot.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ var runtime = require('./runtime/runtime.js')
var Logger = runtime.internal.logger.Logger
var timeout = runtime.internal.timeouts
var commands = runtime.commandcontrol.Commands
var aliases = runtime.commandcontrol.Aliases
var datacontrol = runtime.datacontrol
var argv = require('minimist')(process.argv.slice(2))
var Config
Expand Down Expand Up @@ -47,7 +48,7 @@ if (!argv.forceupgrade) {

bot.Dispatcher.on(Event.GATEWAY_READY, function () {
Logger.info('Ready to start!')
Logger.info(`Logged in as ${bot.User.username} (ID: ${bot.User.id}) and serving ${bot.Users.length} users in ${bot.Guilds.length} servers.`)
Logger.info(`Logged in as ${bot.User.username}#${bot.User.discriminator} (ID: ${bot.User.id}) and serving ${bot.Users.length} users in ${bot.Guilds.length} servers.`)
})

bot.Dispatcher.on(Event.MESSAGE_CREATE, function (c) {
Expand All @@ -56,19 +57,15 @@ bot.Dispatcher.on(Event.MESSAGE_CREATE, function (c) {
var prefix
datacontrol.customize.prefix(c.message).then(function (r) {
if (!r) {
prefix = [Config.settings.prefix, null]
prefix = Config.settings.prefix
} else {
prefix = [Config.settings.prefix, r]
prefix = r
}
var cmd
var suffix
if (c.message.content.indexOf(prefix[0]) === 0) {
cmd = c.message.content.substr(prefix[0].length).split(' ')[0]
suffix = c.message.content.substr(prefix[0].length).split(' ')
suffix = suffix.slice(1, suffix.length).join(' ')
} else if (c.message.content.indexOf(prefix[1]) === 0) {
cmd = c.message.content.substr(prefix[1].length).split(' ')[0]
suffix = c.message.content.substr(prefix[1].length).split(' ')
if (c.message.content.indexOf(prefix) === 0) {
cmd = c.message.content.substr(prefix.length).split(' ')[0]
suffix = c.message.content.substr(prefix.length).split(' ')
suffix = suffix.slice(1, suffix.length).join(' ')
} else if (c.message.content.indexOf(bot.User.mention) === 0) {
cmd = c.message.content.substr(bot.User.mention.length + 1).split(' ')[0]
Expand All @@ -85,6 +82,9 @@ bot.Dispatcher.on(Event.MESSAGE_CREATE, function (c) {
if (cmd === 'help') {
runtime.commandcontrol.helpHandle(c.message, suffix)
}
if (aliases[cmd]) {
cmd = aliases[cmd].name
}
if (commands[cmd]) {
if (typeof commands[cmd] !== 'object') {
return // ignore JS build-in array functions
Expand Down Expand Up @@ -149,6 +149,10 @@ bot.Dispatcher.on(Event.MESSAGE_CREATE, function (c) {
}
})
} else {
if (commands[cmd].noDM) {
c.message.channel.sendMessage('This command cannot be used in DM.')
return
}
datacontrol.permissions.checkLevel(c.message, c.message.author.id).then(function (r) {
if (r >= commands[cmd].level) {
try {
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ WildBeast
<a href="https://snap-ci.com/SteamingMutt/Wild3.0/branch/master"><img src="https://snap-ci.com/j84-AwSfA7N3noK6TdkRDaIv7IvUJYsS01S0cigBsxU/build_image" alt="Build Status"></a>
<a href="http://nodejs.org"><img src="https://img.shields.io/badge/Node.js-5.10.1-blue.svg" alt="Node JS"></a>
<a href="http://npmjs.com"><img src="https://img.shields.io/badge/npm-3.8.6-blue.svg" alt="npm"></a>
<a><img src="https://img.shields.io/badge/Version-3.0.0--alpha.1-blue.svg" alt="Version"></a>
<a><img src="https://img.shields.io/badge/Version-3.0.0--alpha.2-blue.svg" alt="Version"></a>
<a href="https://discord.gg/0cFoiR5QVh5LZlQO"><img src="https://discordapp.com/api/servers/110462143152803840/widget.png" alt="Discord server"></a>
</p>

Expand Down
5 changes: 4 additions & 1 deletion config.example.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
"prefix": "anything can be entered as the global prefix along side mentions"
},
"permissions": {
"master": ["you need to enter the ID from the user you want as master here", "you can extend this array like this if you need more"]
"master": ["you need to enter the ID from the user you want as master here", "you can extend this array like this if you need more"],
"level1": [],
"level2": [],
"level3": []
},
"api_keys": {
"imgflip": {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "WildBeast",
"version": "3.0.0-alpha.1",
"version": "3.0.0-alpha.2",
"description": "A Discord Bot",
"main": "DougBot.js",
"maintainers": [
Expand All @@ -28,7 +28,7 @@
"url": "git+https://github.com/SteamingMutt/WildBeast.git"
},
"engines": {
"node": "^5.x.x",
"node": "4.x.x - 5.10.1",
"npm": ">=3.x.x"
},
"license": "GPL-3.0",
Expand Down
34 changes: 23 additions & 11 deletions runtime/commandcontrol.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,32 @@ var Logger = require('./internal/logger.js').Logger
var commands = []
var alias = []

for (var i in com) {
for (var c in com[i].Commands) {
commands[c] = com[i].Commands[c]
alias[c] = com[i].Commands[c].aliases
for (var d in com) {
for (var o in com[d].Commands) {
commands[o] = com[d].Commands[o]
if (com[d].Commands[o].aliases !== undefined) {
for (var u in com[d].Commands[o].aliases) {
alias[com[d].Commands[o].aliases[u]] = com[d].Commands[o]
}
}
}
}

if (cus !== null) {
for (var j in cus) {
for (var f in cus[j].Commands) {
if (commands[f]) {
for (var g in cus) {
for (var l in cus[g].Commands) {
if (commands[l]) {
throw new Error('Custom commands cannot have the same name as default commands!')
}
commands[f] = cus[j].Commands[f]
alias[j] = cus[j].Commands[f].aliases
commands[l] = cus[g].Commands[l]
if (cus[g].Commands[l].aliases !== undefined) {
for (var e in cus[g].Commands[l].aliases) {
if (alias[cus[g].Commands[l].aliases[e]]) {
throw new Error('Custom commands cannot share aliases with other commands!')
}
alias[cus[g].Commands[l].aliases[e]] = cus[g].Commands[l]
}
}
}
}
}
Expand All @@ -39,8 +51,8 @@ exports.helpHandle = function (msg, suffix) {
if (!msg.isPrivate) {
msg.channel.sendMessage('Help is underway ' + msg.author.mention + '!')
}
msg.author.openDM().then((c) => {
c.sendMessage(msgArray.join('\n'))
msg.author.openDM().then((y) => {
y.sendMessage(msgArray.join('\n'))
}).catch((e) => {
Logger.error(e)
msg.channel.sendMessage('Whoops, try again.')
Expand Down
14 changes: 12 additions & 2 deletions runtime/commands/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Commands.ping = {
Commands.say = {
name: 'say',
help: 'Repeat after me.',
aliases: ['echo', 'repeat'],
module: 'default',
timeout: 10,
level: 0,
Expand Down Expand Up @@ -102,6 +103,7 @@ Commands.twitch = {
Commands.customize = {
name: 'customize',
help: 'Adjust my behaviour in this server!',
noDM: true,
level: 0,
fn: function (msg, suffix) {
var c = require('../databases/controllers/customize.js')
Expand Down Expand Up @@ -132,6 +134,7 @@ Commands.info = {
Commands.leave = {
name: 'leave',
help: "I'll leave this server if I am not welcome here.",
noDM: true,
level: 3,
fn: function (msg) {
if (msg.isPrivate) {
Expand All @@ -157,6 +160,7 @@ Commands.killswitch = {
Commands.namechanges = {
name: 'namechanges',
help: 'I will tell you the name changes for the user you mention.',
noDM: true,
level: 0,
fn: function (msg) {
const n = require('../databases/controllers/users.js')
Expand All @@ -175,6 +179,7 @@ Commands.namechanges = {
Commands.setlevel = {
name: 'setlevel',
help: 'This changes the permission level of a user.',
noDM: true,
module: 'default',
level: 3,
fn: function (msg, suffix) {
Expand Down Expand Up @@ -208,6 +213,7 @@ Commands.setlevel = {
Commands.setnsfw = {
name: 'setnsfw',
help: 'This changes if the channel allows NSFW commands.',
noDM: true,
module: 'default',
usage: '<on | off>',
level: 3,
Expand Down Expand Up @@ -286,6 +292,8 @@ Commands.setstatus = {
Commands['server-info'] = {
name: 'server-info',
help: "I'll tell you some information about the server you're currently in.",
aliases: ['serverinfo'],
noDM: true,
module: 'default',
timeout: 20,
level: 0,
Expand Down Expand Up @@ -325,14 +333,14 @@ Commands['server-info'] = {
Commands.userinfo = {
name: 'userinfo',
help: "I'll get some information about the user you've mentioned.",
noDM: true,
module: 'default',
level: 0,
fn: function (msg) {
var Permissions = require('../databases/controllers/permissions.js')
if (msg.isPrivate) {
msg.channel.sendMessage("Sorry you can't use this in DMs")
}

if (msg.mentions.length === 0) {
Permissions.checkLevel(msg, msg.author.id).then((level) => {
var msgArray = []
Expand All @@ -358,7 +366,6 @@ Commands.userinfo = {
})
return
}

msg.mentions.map(function (user) {
Permissions.checkLevel(msg, user.id).then(function (level) {
var msgArray = []
Expand Down Expand Up @@ -392,6 +399,7 @@ Commands.userinfo = {
Commands['join-server'] = {
name: 'join-server',
help: "I'll join the server you've requested me to join, as long as the invite is valid and I'm not banned of already in the requested server.",
aliases: ['join', 'joinserver', 'invite'],
module: 'default',
usage: '<bot-mention> <instant-invite>',
level: 0,
Expand Down Expand Up @@ -445,6 +453,7 @@ Commands['join-server'] = {
Commands.kick = {
name: 'kick',
help: 'Kick the user(s) out of the server!',
noDM: true,
module: 'default',
usage: '<user-mention>',
level: 0,
Expand Down Expand Up @@ -478,6 +487,7 @@ Commands.kick = {
Commands.ban = {
name: 'ban',
help: 'Swing the banhammer on someone!',
noDM: true,
module: 'default',
usage: '<user-mention> [days]',
level: 0,
Expand Down
Loading

0 comments on commit 7e64eaf

Please sign in to comment.