Even more things!

This commit is contained in:
Wessel T
2019-03-18 16:09:18 +01:00
parent 9ce4c305c7
commit 451d578965
47 changed files with 352 additions and 221 deletions

View File

@@ -1,91 +1,56 @@
#-----------------[ Wump config ]-----------------#
# This is the configuration file of "Wump", all #
# your sensitive information is stored inside of #
# this file. Do **not** give this file or it's #
# contents to **anyone**, they can do a lot of #
# bad things with your tokens. Don't forget to #
# follow the licensing. - Wessel #
#-------------[ Configurable values ]-------------#
# db - <String>: The db URI (Mongo) #
# debug - <Number[0-3]>: The logging level #
# nightly - <Boolean>: Run inside of dev mode #
# discord: #
# enabled - <Boolean>: Enable/disable client #
# op - <Array>: The bot's OwnerIDs #
# token - <String>: The bot's tokens #
# prefix - <String>: The command prefix #
# events - Each<Boolean>: Enable/disable evts #
# playing - Each<any>: The bot's status #
# commands - Each<Boolean>: Enable/disable cmds #
#-------------------------------------------------#
db : 'mongodb://localhost:27017/Wump'
debug : 3
#-----------------[ Yorushika config ]-----------------#
# This is the configuration file of "Wump", all your #
# sensitive information is stored inside of this file. #
# Do **not** give this file or it's contents to #
# **anyone**, they can do a lot of bad things with #
# your tokens. Please be kind and follow the license. #
# - Wessel #
#------------------------------------------------------#
debug: 4
nightly: true
discord :
enabled: true
token : '<--snip-->'
prefix : '!'
locale : 'en_us'
db: 'mongodb://localhost:27017/Wump'
op :
discord:
token: '<--snip-->'
prefix: '!'
locale: 'en_us'
enabled: true
op:
- '107130754189766656'
playing :
url : 'https://twitch.tv/wumpusapp'
name : 'type !help'
type : 1 # 0 - Playing / 1 - Streaming / 2 - Listening / 3 - Watching
playing:
url: 'https://twitch.tv/wumpusapp'
name: 'type $help'
type: 1 # 0 - Playing / 1 - Streaming / 2 - Listening / 3 - Watching
status: 'online' # online / idle / dnd / invisible
webhook:
token : '<--snip-->'
channel: '<--snip-->'
events :
ready : true
shardready : true
shardresume : true
sharddisconnect: true
disconnect : true
messagecreate: true
messagedelete: true
commands :
# Category : CORE
locale : true
prefix : true
# Category : UTILITY
ping : true
math : true
snipe : true
# Category : INFORMATION
user : true
stats : true
guild : true
avatar : true
github : true
commits : true
commands : true
# Category : IMAGE
cat : true
dog : true
fox : true
duck : true
birb : true
lizard : true
penguin : true
# Category : TAGS
tag : true
tags : true
tag-add : true
tag-del : true
tag-info : true
tag-source : true
# Category : GAMES
splatoon : true
# Category : DEVELOPER
eval : true
echo : true
exec : true
token: false
channel: false
api :
events:
- ready
- shardReady
- shardResume
- disconnect
- messageCreate
- messageDelete
- guildMemberAdd
- shardDisconnect
commands:
- yorushika.core.locale
- yorushika.core.prefix
- yorushika.utility.*
- yorushika.information.*
- yorushika.image.*
- yorushika.tags.*
- yorushika.games.*
- yorushika.developer.*
api:
lol: '<--snip-->'
dbl: '<--snip-->'
ksoft: '<--snip-->'

View File

@@ -14,9 +14,9 @@ member:
- 'User is banned from ksoft.si ({e.ban.reason})'
connection:
ready: '`[{date@now}] / {process.hash}]` {emoji} Master client on Wump (`v{global.version}`) connected'
ready: '`[{date@now}] / {process.hash}]` {emoji} Master client on Yorushika (`v{global.version}`) connected'
shard :
ready : '`[{date@now}] / {process.hash}]` {emoji} Shard `#{e.shard.id}` connected to Wump (`v{global.version}`)'
resume : '`[{date@now}] / {process.hash}]` {emoji} Shard `#{e.shard.id}` resumed to Wump (`v{global.version}`)'
disconnect: '`[{date@now}] / {process.hash}]` {emoji} Shard `#{e.shard.id}` disconnected from Wump (`v{global.version}`)'
ready : '`[{date@now}] / {process.hash}]` {emoji} Shard `#{e.shard.id}` connected to Yorushika (`v{global.version}`)'
resume : '`[{date@now}] / {process.hash}]` {emoji} Shard `#{e.shard.id}` resumed to Yorushika (`v{global.version}`)'
disconnect: '`[{date@now}] / {process.hash}]` {emoji} Shard `#{e.shard.id}` disconnected from Yorushika (`v{global.version}`)'

View File

@@ -21,9 +21,9 @@ error :
cancelled: '$[emoji#0] This prompt has been cancelled'
cooldown: '$[emoji#0] $[author:mention] **>** This command is on cooldown for **$[cooldown:left]**'
votelock:
- '$[emoji#0] This command is **votelocked**, upvote [**`Wump`**](https://discordbots.org/bot/318057009188438016/vote) to unlock this command/parameters (It can take up to 10 minutes to register your vote)'
- '$[emoji#0] This command is **votelocked**, upvote [**`Yorushika`**](https://discordbots.org/bot/318057009188438016/vote) to unlock this command/parameters (It can take up to 10 minutes to register your vote)'
- ''
- '$[emoji#1] If you still have issues after that, you can either create an [**`issue`**](https://github.com/PassTheWessel/wump/issues) on [**`GitHub`**](https://github.com/PassTheWessel/wump) or join my [**`Discord`**](https://discord.gg/SV7DAE9) and posting it there'
- '$[emoji#1] If you still have issues after that, you can either create an [**`issue`**](https://github.com/PassTheWessel/yorushika/issues) on [**`GitHub`**](https://github.com/PassTheWessel/yorushika) or join my [**`Discord`**](https://discord.gg/SV7DAE9) and posting it there'
core:
prefix:
@@ -57,7 +57,7 @@ core:
- '$[locale:map]'
- ''
- 'Type `$[locale:changeCmd]` to update your/the guild''s locale'
- 'If you want to help translate wump, you can join my [Discord](https://discord.gg/SV7DAE9) and create a pull request on my [GitHub](https://github.com/PassTheWessel/wump/compare)'
- 'If you want to help translate yorushika, you can join my [Discord](https://discord.gg/SV7DAE9) and create a pull request on my [GitHub](https://github.com/PassTheWessel/yorushika/compare)'
util:
ping:
@@ -93,7 +93,7 @@ info:
avatar: '$[emoji#0] Here''s **$[user:full]** avatar'
commits: '$[emoji#0] **10 most recent commits done on [`PassTheWessel/wump`](https://github.com/PassTheWessel/wump/)**: $[commits:list]'
commits: '$[emoji#0] **10 most recent commits done on [`PassTheWessel/yorushika`](https://github.com/PassTheWessel/yorushika/)**: $[commits:list]'
commands:
single:
@@ -105,7 +105,7 @@ info:
multi:
- '$[emoji#0] The prefix for **$[guild:name]** is `$[guild:prefix]`'
- '$[emoji#1] Type `$[guild:prefix]command <command:str>` for more information'
- '$[emoji#2] **Links**: [`Invite`]($[bot:invite]) **|** [`Support`](https://discord.gg/SV7DAE9) **|** [`GitHub`](https://github.com/PassTheWessel/wump) **|** [`Patreon`](https://patreon.com/wessel)'
- '$[emoji#2] **Links**: [`Invite`]($[bot:invite]) **|** [`Support`](https://discord.gg/SV7DAE9) **|** [`GitHub`](https://github.com/PassTheWessel/yorushika) **|** [`Patreon`](https://patreon.com/wessel)'
fields:
- 'Core'
- 'Information'

View File

@@ -14,8 +14,8 @@ member:
- 'Gebruiker is verbannen van ksoft.si ({e.ban.reason})'
connection:
ready : '`[$[date:now] / $[process:hash]]` $[emoji#0] Meester client op Wump (`v$[wump:version]`) is verbonden'
ready : '`[$[date:now] / $[process:hash]]` $[emoji#0] Meester client op Yorushika (`v$[yorushika:version]`) is verbonden'
shard :
ready : '`[$[date:now] / $[process:hash]]` $[emoji#0] Shard `#$[shard:id]` is verbonden naar Wump (`v$[wump:version]`)'
resume : '`[$[date:now] / $[process:hash]]` $[emoji#0] Shard `#$[shard:id]` is hervat naar Wump (`v$[wump:version]`)'
disconnect: '`[$[date:now] / $[process:hash]]` $[emoji#0] Shard `#$[shard:id]` is losgekoppeld van Wump (`v$[wump:version]`)'
ready : '`[$[date:now] / $[process:hash]]` $[emoji#0] Shard `#$[shard:id]` is verbonden naar Yorushika (`v$[yorushika:version]`)'
resume : '`[$[date:now] / $[process:hash]]` $[emoji#0] Shard `#$[shard:id]` is hervat naar Yorushika (`v$[yorushika:version]`)'
disconnect: '`[$[date:now] / $[process:hash]]` $[emoji#0] Shard `#$[shard:id]` is losgekoppeld van Yorushika (`v$[yorushika:version]`)'

View File

@@ -21,9 +21,9 @@ error :
cancelled: '$[emoji#0] Dit prompt is geannuleerd'
cooldown: '$[emoji#0] $[author:mention] **>** Dit commando is op cooldown voor **$[cooldown:left]**'
votelock:
- '$[emoji#0] Dit commando is **votelocked**, stem voor [**`Wump`**](https://discordbots.org/bot/318057009188438016/vote) om dit commando/parameters te ontgrendelen (Het kan tot 10 minuten duren om uw stem te registreren)'
- '$[emoji#0] Dit commando is **votelocked**, stem voor [**`Yorushika`**](https://discordbots.org/bot/318057009188438016/vote) om dit commando/parameters te ontgrendelen (Het kan tot 10 minuten duren om uw stem te registreren)'
- ''
- '$[emoji#1] Als u nogsteeds problemen hebt ná dat, kunt u een [**`issue`**](https://github.com/PassTheWessel/wump/issues) maken op [**`GitHub`**](https://github.com/PassTheWessel/wump) of mijn [**`Discord`**](https://discord.gg/SV7DAE9) joinen en het daar te plaatsen'
- '$[emoji#1] Als u nogsteeds problemen hebt ná dat, kunt u een [**`issue`**](https://github.com/PassTheWessel/yorushika/issues) maken op [**`GitHub`**](https://github.com/PassTheWessel/yorushika) of mijn [**`Discord`**](https://discord.gg/SV7DAE9) joinen en het daar te plaatsen'
core :
prefix :
@@ -57,7 +57,7 @@ core :
- '$[locale:map]'
- ''
- 'Typ `$[locale:changeCmd]` om de landinstelling van u/de gilde bij te werken'
- 'Als u wilt helpen met het vertalen van Wump, kunt u zij aansluiten bij mijn [Discord](https://discord.gg/SV7DAE9) en een pull request op [GitHub](https://github.com/PassTheWessel/wump/compare) te maken'
- 'Als u wilt helpen met het vertalen van Yorushika, kunt u zij aansluiten bij mijn [Discord](https://discord.gg/SV7DAE9) en een pull request op [GitHub](https://github.com/PassTheWessel/yorushika/compare) te maken'
util :
ping :
@@ -87,13 +87,13 @@ info :
avatar : '$[emoji#0] Hier is **$[user:full]** avatar'
commits : '$[emoji#0] **10 meest recente commits gedaan op [`PassTheWessel/wump`](https://github.com/PassTheWessel/wump/)**: $[commits:list]'
commits : '$[emoji#0] **10 meest recente commits gedaan op [`PassTheWessel/yorushika`](https://github.com/PassTheWessel/yorushika/)**: $[commits:list]'
commands:
multi :
- '$[emoji#0] Het voorvoegsel voor **$[guild:name]** is `$[guild:prefix]`'
- '$[emoji#1] typ `$[guild:prefix]command <command:str>` voor meer informatie'
- '$[emoji#2] **Links**: [`Uitnodiging`]($[bot:invite]) **|** [`Ondersteuning`](https://discord.gg/SV7DAE9) **|** [`GitHub`](https://github.com/PassTheWessel/wump) **|** [`Patreon`](https://patreon.com/wessel)'
- '$[emoji#2] **Links**: [`Uitnodiging`]($[bot:invite]) **|** [`Ondersteuning`](https://discord.gg/SV7DAE9) **|** [`GitHub`](https://github.com/PassTheWessel/yorushika) **|** [`Patreon`](https://patreon.com/wessel)'
single:
- '$[emoji#3] **Naam**: $[command:name]'
- '$[emoji#4] **Syntaxis**: $[command:syntax]'

View File

@@ -4,8 +4,10 @@ const { DiscordCommand } = require('../../../core');
module.exports = class Locale extends DiscordCommand {
constructor(bot) {
super(bot, {
path : undefined,
name : 'locale',
syntax : 'locale <locale:code> <-u|-g>',
bearer : 'yorushika',
aliases : [],
argument : [ '<locale:code>', '-<u|g>' ],
description: 'Change your locale',

View File

@@ -5,6 +5,7 @@ module.exports = class Prefix extends DiscordCommand {
super(bot, {
name : 'prefix',
syntax : 'prefix <...prefix:str> <-u|-g>',
bearer : 'yorushika',
aliases : [],
argument : [ '<...prefix:string>', '-<(u|g)>' ],
description: 'Change your prefix',

View File

@@ -3,8 +3,10 @@ const { DiscordCommand } = require('../../../core');
module.exports = class Echo extends DiscordCommand {
constructor(bot) {
super(bot, {
path : undefined,
name : 'echo',
syntax : 'echo <...message:str>',
bearer : 'yorushika',
aliases : [],
argument : [ '<...message:str>' ],
description: 'Repeat your input',

View File

@@ -5,13 +5,14 @@ const { inspect } = require('util');
module.exports = class Eval extends DiscordCommand {
constructor(bot) {
super(bot, {
// Information
path : undefined,
name : 'eval',
syntax : 'eval <...code:str>',
bearer : 'yorushika',
aliases : [],
argument : [],
description: 'Evaluate a snippet',
// Checks
hidden : false,
enabled : true,
cooldown : 0,

View File

@@ -5,11 +5,14 @@ const { execSync } = require('child_process');
module.exports = class Exec extends DiscordCommand {
constructor(bot) {
super(bot, {
path : undefined,
name : 'exec',
syntax : 'exec <...cmd:str>',
bearer : 'yorushika',
aliases : [],
argument : [ '<...cmd:str>' ],
description: 'Execute a command',
hidden : false,
enabled : true,
cooldown : 0,

View File

@@ -5,8 +5,10 @@ const w = require('wumpfetch');
module.exports = class Splatoon extends DiscordCommand {
constructor(bot) {
super(bot, {
path : undefined,
name : 'splatoon',
syntax : 'splatoon',
bearer : 'yorushika',
aliases : [],
argument : [],
description: 'Get splatoon\'s current maps',

View File

@@ -5,8 +5,10 @@ const w = require('wumpfetch');
module.exports = class Birb extends DiscordCommand {
constructor(bot) {
super(bot, {
path : undefined,
name : 'birb',
syntax : 'birb',
bearer : 'yorushika',
aliases : [ 'bird' ],
argument : [],
description: 'Get a random birb',

View File

@@ -15,8 +15,10 @@ try {
module.exports = class Avatar extends DiscordCommand {
constructor(bot) {
super(bot, {
path : undefined,
name : 'avatar',
syntax : 'avatar [...user:string] [--large] [--(nearest|linear)] [--greyscale] [--jpeg] [--blur]',
bearer : 'yorushika',
aliases : [ 'avt', 'pfp' ],
argument : [ '[...user:string]', '[--large]', '[--(nearest|linear)]', '[--greyscale]', '[--jpeg]', '[--blur]' ],
description: 'Get a user\'s avatar',

View File

@@ -6,8 +6,10 @@ const { readFileSync } = require('fs');
module.exports = class Commands extends DiscordCommand {
constructor(bot) {
super(bot, {
path : undefined,
name : 'commands',
syntax : 'commands [command:str]',
bearer : 'yorushika',
aliases : [ 'command', 'cmds', 'cmd', 'help' ],
argument : [ '[command:str]' ],
description: 'Lists all commands',
@@ -57,34 +59,43 @@ module.exports = class Commands extends DiscordCommand {
description: this._localize(msg.author.locale.info.commands.multi.join('\n'), { msg: msg }),
fields: [
this.bot.cmds.filter((v) => v.extData.category.toLowerCase() === 'core' && !v.extData.hidden).length >= 1 ? {
name: msg.author.locale.info.commands.fields[0],
value: this.bot.cmds.filter((v) => v.extData.category.toLowerCase() === 'core' && !v.extData.hidden).map((v) => `**•** [\`${msg.prefix}${v.extData.name}\`](https://discordapp.com/channels/${msg.channel.guild.id}/${msg.channel.id}/${msg.id}) ${v.extData.description ? `**-** ${v.extData.description}` : ''}`).join('\n'),
name: `${msg.author.locale.info.commands.fields[0]} (${this.bot.cmds.filter((v) => v.extData.category.toLowerCase() === 'core' && !v.extData.hidden).length})`,
value: this.bot.cmds
.filter((v) => v.extData.category.toLowerCase() === 'core' && !v.extData.hidden)
.map((v) => `[\`${msg.prefix}${v.extData.name}\`](https://discordapp.com/channels/${msg.channel.guild.id}/${msg.channel.id}/${msg.id})`).join(', '),
inline: this.static.inline
} : undefined,
this.bot.cmds.filter((v) => v.extData.category.toLowerCase() === 'information' && !v.extData.hidden).length >= 1 ? {
name: msg.author.locale.info.commands.fields[1],
value: this.bot.cmds.filter((v) => v.extData.category.toLowerCase() === 'information' && !v.extData.hidden).map((v) => `**•** [\`${msg.prefix}${v.extData.name}\`](https://discordapp.com/channels/${msg.channel.guild.id}/${msg.channel.id}/${msg.id}) ${v.extData.description ? `**-** ${v.extData.description}` : ''}`).join('\n'),
name: `${msg.author.locale.info.commands.fields[1]} (${this.bot.cmds.filter((v) => v.extData.category.toLowerCase() === 'information' && !v.extData.hidden).length})`,
value: this.bot.cmds
.filter((v) => v.extData.category.toLowerCase() === 'information' && !v.extData.hidden)
.map((v) => `[\`${msg.prefix}${v.extData.name}\`](https://discordapp.com/channels/${msg.channel.guild.id}/${msg.channel.id}/${msg.id})`).join(', '),
inline: this.static.inline
} : undefined,
this.bot.cmds.filter((v) => v.extData.category.toLowerCase() === 'image' && !v.extData.hidden).length >= 1 ? {
name: msg.author.locale.info.commands.fields[2],
value: this.bot.cmds.filter((v) => v.extData.category.toLowerCase() === 'image' && !v.extData.hidden).map((v) => `**•** [\`${msg.prefix}${v.extData.name}\`](https://discordapp.com/channels/${msg.channel.guild.id}/${msg.channel.id}/${msg.id}) ${v.extData.description ? `**-** ${v.extData.description}` : ''}`).join('\n'),
name: `${msg.author.locale.info.commands.fields[2]} (${this.bot.cmds.filter((v) => v.extData.category.toLowerCase() === 'image' && !v.extData.hidden).length})`,
value: this.bot.cmds
.filter((v) => v.extData.category.toLowerCase() === 'image' && !v.extData.hidden)
.map((v) => `[\`${msg.prefix}${v.extData.name}\`](https://discordapp.com/channels/${msg.channel.guild.id}/${msg.channel.id}/${msg.id})`).join(', '),
inline: this.static.inline
} : undefined,
this.bot.cmds.filter((v) => v.extData.category.toLowerCase() === 'utility' && !v.extData.hidden).length >= 1 ? {
name: msg.author.locale.info.commands.fields[3],
value: this.bot.cmds.filter((v) => v.extData.category.toLowerCase() === 'utility' && !v.extData.hidden).map((v) => `**•** [\`${msg.prefix}${v.extData.name}\`](https://discordapp.com/channels/${msg.channel.guild.id}/${msg.channel.id}/${msg.id}) ${v.extData.description ? `**-** ${v.extData.description}` : ''}`).join('\n'),
inline: this.static.inline
name: `${msg.author.locale.info.commands.fields[3]} (${this.bot.cmds.filter((v) => v.extData.category.toLowerCase() === 'utility' && !v.extData.hidden).length})`,
value: this.bot.cmds
.filter((v) => v.extData.category.toLowerCase() === 'utility' && !v.extData.hidden)
.map((v) => `[\`${msg.prefix}${v.extData.name}\`](https://discordapp.com/channels/${msg.channel.guild.id}/${msg.channel.id}/${msg.id})`).join(', '),
} : undefined,
this.bot.cmds.filter((v) => v.extData.category.toLowerCase() === 'developer' && !v.extData.hidden).length >= 1 ? {
name: msg.author.locale.info.commands.fields[4],
value: this.bot.cmds.filter((v) => v.extData.category.toLowerCase() === 'developer' && !v.extData.hidden).map((v) => `**•** [\`${msg.prefix}${v.extData.name}\`](https://discordapp.com/channels/${msg.channel.guild.id}/${msg.channel.id}/${msg.id}) ${v.extData.description ? `**-** ${v.extData.description}` : ''}`).join('\n'),
inline: this.static.inline
name: `${msg.author.locale.info.commands.fields[4]} (${this.bot.cmds.filter((v) => v.extData.category.toLowerCase() === 'developer' && !v.extData.hidden).length})`,
value: this.bot.cmds
.filter((v) => v.extData.category.toLowerCase() === 'developer' && !v.extData.hidden)
.map((v) => `[\`${msg.prefix}${v.extData.name}\`](https://discordapp.com/channels/${msg.channel.guild.id}/${msg.channel.id}/${msg.id})`).join(', '),
} : undefined,
this.bot.cmds.filter((v) => v.extData.category.toLowerCase() === 'tags' && !v.extData.hidden).length >= 1 ? {
name: msg.author.locale.info.commands.fields[5],
value: this.bot.cmds.filter((v) => v.extData.category.toLowerCase() === 'tags' && !v.extData.hidden).map((v) => `**•** [\`${msg.prefix}${v.extData.name}\`](https://discordapp.com/channels/${msg.channel.guild.id}/${msg.channel.id}/${msg.id}) ${v.extData.description ? `**-** ${v.extData.description}` : ''}`).join('\n'),
inline: this.static.inline
name: `${msg.author.locale.info.commands.fields[5]} (${this.bot.cmds.filter((v) => v.extData.category.toLowerCase() === 'tags' && !v.extData.hidden).length})`,
value: this.bot.cmds
.filter((v) => v.extData.category.toLowerCase() === 'tags' && !v.extData.hidden)
.map((v) => `[\`${msg.prefix}${v.extData.name}\`](https://discordapp.com/channels/${msg.channel.guild.id}/${msg.channel.id}/${msg.id})`).join(', '),
} : undefined
]
}

View File

@@ -6,8 +6,10 @@ const { table } = require('table');
module.exports = class Stats extends DiscordCommand {
constructor(bot) {
super(bot, {
path : undefined,
name : 'commits',
syntax : 'commits',
bearer : 'yorushika',
aliases : [],
argument : [],
description: '10 most recent commits',
@@ -61,7 +63,7 @@ module.exports = class Stats extends DiscordCommand {
}
async execute(msg, args) {
let res = await w(`${this.static.BASE_URL}/repos/PassTheWessel/wump/commits`, this.static.REQ_DATA).send();
let res = await w(`${this.static.BASE_URL}/repos/PassTheWessel/yorushika/commits`, this.static.REQ_DATA).send();
res = res.json();
if (larg(args)['raw'] || larg(args)['r']) {

View File

@@ -5,8 +5,10 @@ const moment = require('moment'); require('../../../util/moment/diff.js');
module.exports = class Guild extends DiscordCommand {
constructor(bot) {
super(bot, {
path : undefined,
name : 'guild',
syntax : 'guild <...guild:str>',
bearer : 'yorushika',
aliases : [ '<...guild:str>' ],
argument : [],
description: 'Get a guild\'s information',

View File

@@ -9,8 +9,10 @@ const { readFileSync } = require('fs');
module.exports = class Stats extends DiscordCommand {
constructor(bot) {
super(bot, {
path : undefined,
name : 'stats',
syntax : 'stats [--{no-deps|no-bot|no-sys|no-cpu|no-thumb}]',
bearer : 'yorushika',
aliases : [ 'statistics' ],
argument : [ '[--{no-deps|no-bot|no-sys|no-cpu|no-thumb}]' ],
description: 'Some small statistics',

View File

@@ -5,8 +5,10 @@ const moment = require('moment'); require('../../../util/moment/diff.js');
module.exports = class User extends DiscordCommand {
constructor(bot) {
super(bot, {
path : undefined,
name : 'user',
syntax : 'user <...user:string>',
bearer : 'yorushika',
aliases : [ '<...user:string>' ],
argument : [],
description: 'Get a user\'s information',

View File

@@ -4,8 +4,10 @@ const { DiscordCommand } = require('../../../core');
module.exports = class TagAdd extends DiscordCommand {
constructor(bot) {
super(bot, {
path : undefined,
name : 'tag-add',
syntax : 'tag-add <...name:str> | <..content:string>',
bearer : 'yorushika',
aliases : [ 'tagadd', 'addtag', 'createtag', 'tagcreate', 'maketag', 'make-tag', 'tag-create' ],
argument : [ '<...name:str>', '<..content:string>' ],
description: 'Create a tag',

View File

@@ -3,8 +3,10 @@ const { DiscordCommand } = require('../../../core');
module.exports = class TagDel extends DiscordCommand {
constructor(bot) {
super(bot, {
path : undefined,
name : 'tag-del',
syntax : 'tag-del <...tag:str>',
bearer : 'yorushika',
aliases : [ 'tagdel', 'deltag', 'tagdelete', 'deletetag', 'del-tag', 'tag-delete', 'delete-tag' ],
argument : [ '<...tag:str>' ],
description: 'Delete a tag',

View File

@@ -5,8 +5,10 @@ const moment = require('moment');
module.exports = class TagInfo extends DiscordCommand {
constructor(bot) {
super(bot, {
path : undefined,
name : 'tag-info',
syntax : 'tag-info <...tag:str>',
bearer : 'yorushika',
aliases : [],
argument : [ '<...tag:str>' ],
description: 'Info about a tag',

View File

@@ -3,8 +3,10 @@ const { DiscordCommand } = require('../../../core');
module.exports = class TagSource extends DiscordCommand {
constructor(bot) {
super(bot, {
path : undefined,
name : 'tag-source',
syntax : 'tag-source <...tag:str>',
bearer : 'yorushika',
aliases : [ 'tagsource', 'tagsrc', 'tag-src' ],
argument : [ '<...tag:str>' ],
description: 'Source of a tag',

View File

@@ -3,8 +3,10 @@ const { DiscordCommand } = require('../../../core');
module.exports = class Tag extends DiscordCommand {
constructor(bot) {
super(bot, {
path : undefined,
name : 'tag',
syntax : 'tag <...tag:str>',
bearer : 'yorushika',
aliases : [ 'show-tag', 'disp-tag' ],
argument : [ '<...tag:str>' ],
description: 'Display a tag',

View File

@@ -6,8 +6,10 @@ const { table } = require('table');
module.exports = class Tags extends DiscordCommand {
constructor(bot) {
super(bot, {
path : undefined,
name : 'tags',
syntax : 'tags',
bearer : 'yorushika',
aliases : [],
argument : [],
description: 'A list of all tags',

View File

@@ -6,8 +6,10 @@ const { eval: mEval, config } = require('mathjs');
module.exports = class Math extends DiscordCommand {
constructor(bot) {
super(bot, {
path : undefined,
name : 'math',
syntax : 'math <...equation:str>',
bearer : 'yorushika',
aliases : [],
argument : [ '<...equation:str>' ],
description: 'Evaluate an equation',

View File

@@ -3,8 +3,10 @@ const { DiscordCommand } = require('../../../core');
module.exports = class Ping extends DiscordCommand {
constructor(bot) {
super(bot, {
path : undefined,
name : 'ping',
syntax : 'ping',
bearer : 'yorushika',
aliases : [ 'pong' ],
argument : [],
description: 'Lists latencies',

View File

@@ -3,10 +3,12 @@ const { DiscordCommand } = require('../../../core/');
module.exports = class Snipe extends DiscordCommand {
constructor(bot) {
super(bot, {
name: 'snipe',
syntax: 'snipe',
aliases: [],
argument: [],
path : undefined,
name : 'snipe',
syntax : 'snipe',
bearer : 'yorushika',
aliases : [],
argument : [],
description: 'Re-post a deleted message',
hidden: false,

View File

@@ -0,0 +1,40 @@
const { DiscordCommand } = require('../../core');
module.exports = class name extends DiscordCommand {
constructor(bot) {
super(bot, {
path : undefined,
name : '',
syntax : '',
bearer : 'yorushika',
aliases : [],
argument : [],
description: '',
hidden : false,
enabled : true,
cooldown : 1000,
category : 'Utility',
ownerOnly : false,
guildOnly : false,
permissions: []
});
Object.freeze(this);
Object.freeze(this.static);
}
async execute(msg, args, user, guild) {
// ...
}
_localize(msg, extData = {}) {
try {
if (!msg) throw 'INVALID_STRING';
// ...
} catch (ex) {
return `LOCALIZE_ERROR:${ex.code}`;
}
}
};

View File

@@ -48,7 +48,7 @@ module.exports = class WumpDiscord extends Eris {
this.conf = options.config ? options.config : undefined;
this.start = Date.now();
this.requestHandler.userAgent = this.ua ? this.ua : `Wump (https://github.com/PassTheWessel/wump, ${this.pkg.version})`;
this.requestHandler.userAgent = this.ua ? this.ua : `Yorushika (https://github.com/PassTheWessel/yorushika, ${this.pkg.version})`;
}
async launch(events, commands, locales) {

View File

@@ -3,27 +3,38 @@ module.exports = class WumpCommand {
this.bot = bot;
this.extData = Object.assign({
// Information
name : null, // Command name ( required )
syntax : null, // Command syntax ( optional )
aliases : [], // Command aliases ( optional )
argument : [], // Command arguments ( optional )
path : undefined, // The config path of the command [`yorushika.utility.ping` for example] ( optional )
name : null, // Command name ( required )
syntax : null, // Command syntax ( optional )
bearer : 'yorushika', // Command bearer ( required )
aliases : [], // Command aliases ( optional )
argument : [], // Command arguments ( optional )
description: null, // Command description ( optional )
// Checks
hidden : false, // Hidden from view ( true / false )
enabled : true, // Enabled or disabled ( true / false )
cooldown : 1000, // Command cooldown ( optional )
category : 'General', // Command category ( required )
ownerOnly : false, // Owner only ( true / false )
guildOnly : false, // Guild only ( true / false )
permissions : [] // Bot permissions ( optional )
hidden : false, // Hidden from view ( true / false )
enabled : true, // Enabled or disabled ( true / false )
cooldown : 1000, // Command cooldown ( optional )
category : 'General', // Command category ( required )
ownerOnly : false, // Owner only ( true / false )
guildOnly : false, // Guild only ( true / false )
permissions: [] // Bot permissions ( optional )
}, opts);
this.static = {};
this.static = {};
this.mutable = {};
Object.freeze(this.static);
}
async execute(msg, args, user, guild) {}
async execute(msg, args, user, guild) {
// ...
}
_localize(msg) {}
_localize(msg, extData = {}) {
try {
if (!msg) throw 'INVALID_STRING';
// ...
} catch (ex) {
return `LOCALIZE_ERROR:${ex.code}`;
}
}
};

View File

@@ -1,18 +1,22 @@
module.exports = class WumpContext {
constructor(bot, msg) {
Object.assign(this, msg);
this.bot = bot;
this.orig = msg;
this.locale = null;
this.prefix = null;
}
get guild() { return this.channel.guild; }
get guild() {
return this.channel.guild;
}
getPrefix() { return this.prefix; }
getLocale() { return this.locale; }
getMember() { return this.member; }
setPrefix(prefix) { this.prefix = prefix; }
setLocale(locale) { this.locale = locale; }
setPrefix(prefix) {
this.prefix = prefix;
}
setLocale(locale) {
this.locale = locale;
}
};

View File

@@ -1,13 +1,25 @@
module.exports = class WumpEvent {
constructor(bot, opts = {}) {
this.bot = bot;
this.extData = Object.assign({ name: null }, opts);
this.extData = Object.assign({
name: null // Event name ( required )
}, opts);
this.static = {};
this.mutable = {};
}
emit(...args) {}
emit(...args) {
// ...
}
_localize(msg) {}
_localize(msg, extData = {}) {
try {
if (!msg) throw 'INVALID_STRING';
// ...
} catch (ex) {
return `LOCALIZE_ERROR:${ex.code}`;
}
}
};

View File

@@ -1,25 +0,0 @@
const { DiscordCommand } = require('../../../core');
module.exports = class name extends DiscordCommand {
constructor(bot) {
super(bot, {
name : '',
syntax : '',
aliases : [],
argument : [],
description: '',
hidden : false,
enabled : true,
cooldown : 1000,
category : 'Utility',
ownerOnly : false,
guildOnly : false,
permissions : [ 'embedLinks' ]
});
}
async execute(msg, args, user, guild) {}
_localize(msg) {}
};

View File

@@ -4,41 +4,56 @@ module.exports = class RESTclient {
}
getRole($, g) {
if (/^\d+$/.test($) && g.roles.get($)) return $;
else if (/<@%(\d+)>$/.test($)) {
const m = $.match(/^<@&(\d+)>$/);
const r = g.roles.get(m[1]);
if (r) return $;
if (/^\d+$/.test($) && g.roles.get($)) {
return $;
} else if (/<@%(\d+)>$/.test($)) {
const m = $.match(/^<@&(\d+)>$/);
const r = g.roles.get(m[1]);
if (r) {
return $;
}
} else {
const r = g.roles.filter((v) => v.name.toLowerCase().includes($.toLowerCase()));
if (r.length > 0) return r[0];
if (r.length >= 1) {
return r[0];
}
}
return undefined;
}
getUser($) {
if (/^\d+$/.test($) && this.bot.users.get($)) return this.bot.users.get($);
else if (/^<@!?(\d+)>$/.test($)) {
if (/^\d+$/.test($) && this.bot.users.get($)) {
return this.bot.users.get($);
} else if (/^<@!?(\d+)>$/.test($)) {
const u = this.bot.users.get($.match(/^<@!?(\d+)>$/)[1]);
if (u) return u;
}else if (/^(.+)#(\d{4})$/.test($)) {
if (u) {
return u;
}
} else if (/^(.+)#(\d{4})$/.test($)) {
const m = $.match(/^(.+)#(\d{4})$/);
const u = this.bot.users.filter((u) => u.username === m[1] && Number(u.discriminator) === Number(m[2]));
if (u.length > 0) return u[0];
const u = this.bot.users.filter((v) => v.username === m[1] && Number(v.discriminator) === Number(m[2]));
if (u.length >= 1) {
return u[0];
}
} else {
const u = this.bot.users.filter((u) => u.username.toLowerCase().includes($.toLowerCase()));
if (u.length > 0) return u[0];
const u = this.bot.users.filter((v) => v.username.toLowerCase().includes($.toLowerCase()));
if (u.length >= 1) {
return u[0];
}
}
return undefined;
}
getGuild($) {
if (/^\d+$/.test($) && this.bot.guilds.get($)) return this.bot.guilds.get($);
else {
if (/^\d+$/.test($) && this.bot.guilds.get($)) {
return this.bot.guilds.get($);
} else {
const tmp = this.bot.guilds.filter((v) => v.name.toLowerCase().includes($.toLowerCase()));
if (tmp.length > 0) return tmp[0];
if (tmp.length >= 1) {
return tmp[0];
}
}
return undefined;
@@ -49,43 +64,65 @@ module.exports = class RESTclient {
if (/^\d+$/.test($)) {
if (g) {
if (!g.channels.has($)) return undefined;
if (!g.channels.has($)) {
return undefined;
}
return g.channels.get($);
} else {
c = c in this.bot.channelGuildMap && this.bot.guilds.get(this.bot.channelGuildMap[$]).channels.get($);
if (c) return c;
if (c) {
return c;
}
}
} else if (/^<#(\d+)>$/.test(c)) {
const m = $.match(/^<#(\d+)>$/);
if ($) {
if (!g.channels.has(m[1])) return undefined;
if (!g.channels.has(m[1])) {
return undefined;
}
return g.channels.get(m[1]);
} else {
c = m[1] in this.bot.channelGuildMap && this.bot.guilds.get(this.bot.channelGuildMap[m[1]]).channels.get($);
if (c) return c;
if (c) {
return c;
}
}
} else if ($) {
c = g.channels.filter((v) => v.name.toLowerCase().includes($.toLowerCase()));
if (c.length > 0) return c[0];
if (c.length >= 1) {
return c[0];
}
}
return undefined;
}
getMember($, g, n = false) {
if (!$ || !g) return undefined;
if (/^\d+$/.test($) && g.members.get($)) return g.members.get($);
else if (/^<@!?(\d+)>$/.test($)) {
if (!$ || !g) {
return undefined;
}
if (/^\d+$/.test($) && g.members.get($)) {
return g.members.get($);
} else if (/^<@!?(\d+)>$/.test($)) {
const m = $.match(/^<@!?(\d+)>$/);
const u = g.members.get(m[1]);
if (u) return u;
if (u) {
return u;
}
} else if (/^(.+)#(\d{4})$/.test($)) {
const m = $.match(/^(.+)#(\d{4})$/);
const u = g.members.filter((v) => v.user.username === m[1] && Number(v.user.discriminator) === Number(m[2]));
if (u.length > 0) return u[0];
if (u.length >= 1) {
return u[0];
}
} else if (!n) {
const u = g.members.filter((v) => v.user.username.toLowerCase().includes(v.toLowerCase()));
if (u.length > 0) return u[0];
if (u.length >= 1) {
return u[0];
}
}
return undefined;

View File

@@ -10,16 +10,24 @@ const startTimestamp = Date.now();
module.exports = class CommandRegistry {
constructor(bot) {
this.bot = bot;
this.ignored = [ 'js', 'md' ];
this.ratelimits = new Collection();
}
start(directory, category, file) {
try {
const cmd = new(require(`${directory}/${category}/${file}`))(this.bot);
cmd.extData.location = `${directory}/${category}/${file}`;
cmd.extData.path = cmd.extData.path || [ cmd.extData.bearer || 'yorushika', cmd.extData.category || 'utility', cmd.extData.name || '*' ];
cmd.extData.location = `${directory}/${category}/${file}`;
if (!cmd.extData.enabled) return;
if (!this.bot.conf['discord']['commands'][cmd.extData.name]) return;
if (
!this.bot.conf.discord.commands.includes(cmd.extData.path.join('.').toLowerCase()) &&
!this.bot.conf.discord.commands.includes(`${cmd.extData.path[0].toLowerCase()}.${cmd.extData.path[1].toLowerCase()}.*`) &&
!this.bot.conf.discord.commands.includes(`${cmd.extData.path[0].toLowerCase()}.*`) &&
!this.bot.conf.discord.commands.includes(`*`)
) return;
if (this.bot.cmds.has(cmd.extData.name)) return this.bot.print(1, `${cyan('Discord')} -- Duplicate command found - ${red(`${directory}/${category}/${file}`)}` );
this.bot.cmds.set(cmd.extData.name, cmd);
@@ -31,7 +39,7 @@ module.exports = class CommandRegistry {
const categories = await readdirSync(directory);
for (let i = 0; i < categories.length; i++) {
if (categories[i].endsWith('md')) return;
if (this.ignored.some((v) => categories[i].endsWith(v))) return;
readdir(`${directory}/${categories[i]}`, (err, cmds) => {
if (err) process.handleError(err, 'LoadError', cyan('Discord'));
this.bot.print(2, `${cyan('Discord')} >> Loading ${green(cmds.length)} commands from category ${yellow(categories[i])}` );

View File

@@ -25,7 +25,7 @@ module.exports = class EventStore {
if (!e.endsWith('.js' )) return;
const event = new(require(`${directory}/${e}`))(this.bot);
if (!this.bot.conf['discord']['events'][event.extData.name.toLowerCase()]) return false;
if (!this.bot.conf.discord.events.includes(event.extData.name)) return false;
if (this.bot.events.has(event.extData.name)) return this.bot.print(1, `[${cyan('Discord')}] -- Duplicate event found - ${red(`${directory}/${event.extData.name}`)}`);
this.bot.events.set(event.extData.name, event);

View File

@@ -0,0 +1,24 @@
const { DiscordEvent } = require('../../core');
module.exports = class name extends DiscordEvent {
constructor(bot) {
super(bot, { name: 'name' });
Object.freeze(this);
Object.freeze(this.static);
}
emit(...args) {
// ...
}
localize(msg, extData = {}) {
try {
if (!msg) throw 'INVALID_STRING';
// ...
} catch (ex) {
return `LOCALIZE_ERROR:${ex.code}`;
}
}
};

View File

@@ -81,10 +81,11 @@ module.exports = class GuildMemberAdd extends DiscordEvent {
const prohibited = new RegExp((this.bot.locales.get('badwords') || []).join('|'), 'gi');
member.bans = {
'ksoft.si': this.bot.conf.api.ksoft ? await get(`${this.static.BASE_URL[0]}/bans/info/?user=${member.id}`, this.static.REQ_DATA[1]).send() : undefined,
'ksoft.si': this.bot.conf.api.ksoft ? await get(`${this.static.BASE_URL[1]}/bans/info?user=${member.id}`, this.static.REQ_DATA[1]).send() : undefined,
'discord.services': await get(`${this.static.BASE_URL[0]}/api/ban/${member.id}`, this.static.REQ_DATA[0]).send()
};
member.c = moment.preciseDiff(new Date(), new Date(member.createdAt), true);
let notes = [];
@@ -104,7 +105,7 @@ module.exports = class GuildMemberAdd extends DiscordEvent {
notes.push(`${this.bot.emote('logs', 'message_delete', '4')} ${strings.member.add.notes[3].replace(/{e\.ban\.reason}/, member.bans['discord.services'].body.reason || 'Unknown')}`);
}
if (member.bans['ksoft.si'] && !member.bans['ksoft.si'].body.code) {
notes.push(`${this.bot.emote('logs', 'message_delete', '5')} ${strings.member.add.notes[5].replace(/{e\.ban\.reason}/, member.bans['ksoft.si'].body.reason || 'Unknown')}`);
notes.push(`${this.bot.emote('logs', 'message_delete', '5')} ${strings.member.add.notes[4].replace(/{e\.ban\.reason}/, member.bans['ksoft.si'].body.reason || 'Unknown')}`);
}
this.bot.createMessage(entry.logger.channel, {

View File

@@ -15,7 +15,7 @@ module.exports = class Ready extends DiscordEvent {
this.bot.editStatus({
url : this.bot.conf.discord.playing.url || null,
type : this.bot.conf.discord.playing.type || 3,
name : this.bot.conf.discord.playing.name || 'Wump',
name : this.bot.conf.discord.playing.name || 'Yorushika',
status : this.bot.conf.discord.playing.status || 'online'
});
}

View File

@@ -1,8 +1,7 @@
/**
* @name Wunp
* @name Yorushika
* @author Wessel "wesselgame" T < discord@go2it.eu >
* @license GPL-3.0
* @version 0.1.1
* @description A multi-functional bot written in Node.js
*/
@@ -85,7 +84,7 @@ if (conf['discord']['enabled']) {
autoreconnect: true
},
ua : `${pkg.displayName}/${conf['nightly'] ? 'nightly' : 'distribution'} (https://github.com/PassTheWessel/wump)`,
ua : `${pkg.displayName}/${conf['nightly'] ? 'nightly' : 'distribution'} (https://github.com/PassTheWessel/yorushika)`,
db : mongoose,
pkg : pkg,
colors: col,