forked from Supositware/Haha-Yes
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
4f5c0ac613
14 changed files with 200 additions and 59 deletions
BIN
asset/ytp/error1.mp4
Normal file
BIN
asset/ytp/error1.mp4
Normal file
Binary file not shown.
BIN
asset/ytp/error2.mp4
Normal file
BIN
asset/ytp/error2.mp4
Normal file
Binary file not shown.
|
@ -100,12 +100,16 @@ class ytpCommand extends Command {
|
|||
{
|
||||
id: 'link',
|
||||
type: 'string'
|
||||
},
|
||||
{
|
||||
id: 'max',
|
||||
type: 'string'
|
||||
}
|
||||
],
|
||||
description: {
|
||||
content: 'Generate random ytp | --add with a link or attachment to add a video to the pool, only .mp4 work | --pool to see how many vid there is currently in the pool | --force to make the command work outside of nsfw channel BE AWARE THAT IT WON\'T CHANGE THE FINAL RESULT SO NSFW CAN STILL HAPPEN',
|
||||
usage: '',
|
||||
examples: ['']
|
||||
usage: '(OPTIONAL) | [Minimum length of clip] [Max length of clip]',
|
||||
examples: ['5 10']
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -209,7 +213,8 @@ class ytpCommand extends Command {
|
|||
|
||||
let options = {
|
||||
debug: args.debug,
|
||||
MAX_STREAM_DURATION: args.link ? args.link : Math.floor((Math.random() * 3) + 1), // Random duration of video clip
|
||||
MIN_STREAM_DURATION: args.link ? Math.floor(args.link) : null,
|
||||
MAX_STREAM_DURATION: args.link && args.max ? args.max : Math.floor((Math.random() * 3) + 1), // Random duration of video clip
|
||||
sources: './asset/ytp/sources/',
|
||||
sounds: './asset/ytp/sounds/',
|
||||
music: './asset/ytp/music/',
|
||||
|
@ -254,7 +259,11 @@ class ytpCommand extends Command {
|
|||
.catch(err => {
|
||||
console.error(err);
|
||||
loadingmsg.delete();
|
||||
return message.reply('Oh no! An error has occured!');
|
||||
return message.reply({files: [Math.random() < 0.5 ? './asset/ytp/error1.mp4' : './asset/ytp/error2.mp4']})
|
||||
.catch(err => { // In case it can't send the vid for some reason
|
||||
console.error(err);
|
||||
return message.channel.send('Oh no, an error has occured! please try again.');
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
const { Command } = require('discord-akairo');
|
||||
const LogStats = require('../../models/').LogStats;
|
||||
|
||||
class ServerCommand extends Command {
|
||||
constructor() {
|
||||
|
@ -30,7 +31,10 @@ class ServerCommand extends Command {
|
|||
.addField('Owner', message.guild.owner, true)
|
||||
.setTimestamp();
|
||||
|
||||
const logStats = await LogStats.findOne({where: {guild: message.guild.id}});
|
||||
|
||||
if (logStats) addEmbed.addField('Logging', 'On ✅');
|
||||
else addEmbed.addField('Logging', 'Off ❌');
|
||||
|
||||
message.channel.send({ embed: addEmbed });
|
||||
}
|
||||
|
|
|
@ -38,15 +38,6 @@ class userInfoCommand extends Command {
|
|||
.setTimestamp();
|
||||
|
||||
|
||||
|
||||
if (member) {
|
||||
// Show since when this user have been boosting the current guild
|
||||
if (member.premiumSince) Embed.addField('Boosting this guild since', member.premiumSince, true);
|
||||
// Show guild nickname
|
||||
if (member.nickname) Embed.addField('Nickname', member.nickname, true);
|
||||
|
||||
}
|
||||
|
||||
Embed.addField('', '');
|
||||
|
||||
// Show user status
|
||||
|
@ -69,6 +60,15 @@ class userInfoCommand extends Command {
|
|||
if (user.presence.clientStatus.web) Embed.addField('Using discord on', '☁️ ' + user.presence.clientStatus.web, true);
|
||||
}
|
||||
|
||||
if (member) {
|
||||
// Show since when this user have been boosting the current guild
|
||||
if (member.premiumSince) Embed.addField('Boosting this guild since', member.premiumSince, true);
|
||||
// Show guild nickname
|
||||
if (member.nickname) Embed.addField('Nickname', member.nickname, true);
|
||||
// Show member roles
|
||||
if (member.roles) Embed.addField('Roles', `${member.roles.cache.array().join(', ')}`);
|
||||
}
|
||||
|
||||
return message.channel.send({ embed: Embed });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ const guildBlacklist = require('../../models').guildBlacklist;
|
|||
class serverblacklistInhibitor extends Inhibitor {
|
||||
constructor() {
|
||||
super('serverblacklist', {
|
||||
reason: 'serverblacklist'
|
||||
reason: 'serverblacklist',
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ class commandStartedListener extends Listener {
|
|||
.setColor('GREEN')
|
||||
.setTitle('Daily usage report!')
|
||||
.addField('Number of unique guild', uniqueGuild.length)
|
||||
.addField('Number of command exectued', executedCommands, true)
|
||||
.addField('Number of command executed', executedCommands, true)
|
||||
.addField('Most used command', `${getKeyByValue(commands, max)} (${max} times)`, true )
|
||||
.addField('Least used command', `${getKeyByValue(commands, min)} (${min} times)`, true)
|
||||
.setFooter(`Bot usage as of ${today}`);
|
||||
|
|
|
@ -22,13 +22,13 @@ class channelDeleteListener extends Listener {
|
|||
const channel = this.client.channels.resolve(await logStats.get('channel'));
|
||||
let Embed = this.client.util.embed()
|
||||
.setColor('NAVY')
|
||||
.setTitle('Channel created!')
|
||||
.setDescription(`${GuildChannel.type} channel ${GuildChannel} got deleted!`)
|
||||
.setTitle('Channel deleted!')
|
||||
.setDescription(`${GuildChannel.type} channel ${GuildChannel.name} got deleted!`)
|
||||
.setTimestamp();
|
||||
|
||||
if (!deletionLog) return channel.send(Embed);
|
||||
|
||||
Embed.setDescription(`${GuildChannel.type} channel ${GuildChannel} got deleted by ${deletionLog.executor}`);
|
||||
Embed.setDescription(`${GuildChannel.type} channel ${GuildChannel.name} got deleted by ${deletionLog.executor}`);
|
||||
|
||||
channel.send(Embed);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ class channelUpdateListener extends Listener {
|
|||
|
||||
async exec(oldChannel, newChannel) {
|
||||
const logStats = await LogStats.findOne({where: {guild: newChannel.guild.id}});
|
||||
|
||||
if (oldChannel === newChannel) return;
|
||||
if (logStats) {
|
||||
const fetchedLogs = await newChannel.guild.fetchAuditLogs({
|
||||
limit: 1,
|
||||
|
|
|
@ -11,7 +11,7 @@ class messageUpdateListener extends Listener {
|
|||
|
||||
async exec(oldMessage, newMessage) {
|
||||
const logStats = await LogStats.findOne({where: {guild: newMessage.guild.id}});
|
||||
if (logStats && oldMessage.content !== newMessage.content && !message.author.bot) {
|
||||
if (logStats && oldMessage.content !== newMessage.content && !oldMessage.author.bot) {
|
||||
const channel = this.client.channels.resolve(await logStats.get('channel'));
|
||||
let Embed = this.client.util.embed()
|
||||
.setColor('NAVY')
|
||||
|
|
38
event/listeners/log/roleCreate.js
Normal file
38
event/listeners/log/roleCreate.js
Normal file
|
@ -0,0 +1,38 @@
|
|||
const { Listener } = require('discord-akairo');
|
||||
const LogStats = require('../../../models/').LogStats;
|
||||
|
||||
class roleCreateListener extends Listener {
|
||||
constructor() {
|
||||
super('roleCreate', {
|
||||
emitter: 'client',
|
||||
event: 'roleCreate'
|
||||
});
|
||||
}
|
||||
|
||||
async exec(role) {
|
||||
const guild = role.guild;
|
||||
const logStats = await LogStats.findOne({where: {guild: guild.id}});
|
||||
if (logStats) {
|
||||
const fetchedLogs = await guild.fetchAuditLogs({
|
||||
limit: 1,
|
||||
type: 'ROLE_CREATE',
|
||||
});
|
||||
|
||||
const creationLog = fetchedLogs.entries.first();
|
||||
|
||||
const channel = this.client.channels.resolve(await logStats.get('channel'));
|
||||
let Embed = this.client.util.embed()
|
||||
.setColor('NAVY')
|
||||
.setTitle('New role')
|
||||
.setDescription(`${role.name} got created!`)
|
||||
.setTimestamp();
|
||||
|
||||
if (!creationLog) return channel.send(Embed);
|
||||
|
||||
Embed.setDescription(`${role.name} got created by ${creationLog.executor}`);
|
||||
|
||||
channel.send(Embed);
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = roleCreateListener;
|
38
event/listeners/log/roleDelete.js
Normal file
38
event/listeners/log/roleDelete.js
Normal file
|
@ -0,0 +1,38 @@
|
|||
const { Listener } = require('discord-akairo');
|
||||
const LogStats = require('../../../models/').LogStats;
|
||||
|
||||
class roleDeleteListener extends Listener {
|
||||
constructor() {
|
||||
super('roleDelete', {
|
||||
emitter: 'client',
|
||||
event: 'roleDelete'
|
||||
});
|
||||
}
|
||||
|
||||
async exec(role) {
|
||||
const guild = role.guild;
|
||||
const logStats = await LogStats.findOne({where: {guild: guild.id}});
|
||||
if (logStats) {
|
||||
const fetchedLogs = await guild.fetchAuditLogs({
|
||||
limit: 1,
|
||||
type: 'ROLE_DELETE',
|
||||
});
|
||||
|
||||
const creationLog = fetchedLogs.entries.first();
|
||||
|
||||
const channel = this.client.channels.resolve(await logStats.get('channel'));
|
||||
let Embed = this.client.util.embed()
|
||||
.setColor('NAVY')
|
||||
.setTitle('Role deleted')
|
||||
.setDescription(`${role.name} got deleted!`)
|
||||
.setTimestamp();
|
||||
|
||||
if (!creationLog) return channel.send(Embed);
|
||||
|
||||
Embed.setDescription(`${role.name} got deleted by ${creationLog.executor}`);
|
||||
|
||||
channel.send(Embed);
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = roleDeleteListener;
|
42
event/listeners/log/roleUpdate.js
Normal file
42
event/listeners/log/roleUpdate.js
Normal file
|
@ -0,0 +1,42 @@
|
|||
/* TODO
|
||||
* Show more details about the update like what permissions changed, if a name change occurred ect...
|
||||
*/
|
||||
const { Listener } = require('discord-akairo');
|
||||
const LogStats = require('../../../models/').LogStats;
|
||||
|
||||
class roleUpdateListener extends Listener {
|
||||
constructor() {
|
||||
super('roleUpdate', {
|
||||
emitter: 'client',
|
||||
event: 'roleUpdate'
|
||||
});
|
||||
}
|
||||
|
||||
async exec(oldRole, newRole) {
|
||||
if (oldRole === newRole) return;
|
||||
const guild = oldRole.guild;
|
||||
const logStats = await LogStats.findOne({where: {guild: guild.id}});
|
||||
if (logStats) {
|
||||
const fetchedLogs = await guild.fetchAuditLogs({
|
||||
limit: 1,
|
||||
type: 'ROLE_UPDATE',
|
||||
});
|
||||
|
||||
const creationLog = fetchedLogs.entries.first();
|
||||
|
||||
const channel = this.client.channels.resolve(await logStats.get('channel'));
|
||||
let Embed = this.client.util.embed()
|
||||
.setColor('NAVY')
|
||||
.setTitle('Role updated')
|
||||
.setDescription(`${oldRole.name} got updated!`)
|
||||
.setTimestamp();
|
||||
|
||||
if (!creationLog) return channel.send(Embed);
|
||||
|
||||
Embed.setDescription(`${oldRole.name} got updated by ${creationLog.executor}`);
|
||||
|
||||
channel.send(Embed);
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = roleUpdateListener;
|
32
package-lock.json
generated
32
package-lock.json
generated
|
@ -71,6 +71,16 @@
|
|||
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.1.5.tgz",
|
||||
"integrity": "sha512-CU1q0UXQUpFNzNB7gufgoisDHP7n+T3tkqTsp3MNUkVJ5+hS3BCvME8uCXAUFlz+6T2FbTCu75A+yQ7HMKqRKw=="
|
||||
},
|
||||
"@discordjs/form-data": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/form-data/-/form-data-3.0.1.tgz",
|
||||
"integrity": "sha512-ZfFsbgEXW71Rw/6EtBdrP5VxBJy4dthyC0tpQKGKmYFImlmmrykO14Za+BiIVduwjte0jXEBlhSKf0MWbFp9Eg==",
|
||||
"requires": {
|
||||
"asynckit": "^0.4.0",
|
||||
"combined-stream": "^1.0.8",
|
||||
"mime-types": "^2.1.12"
|
||||
}
|
||||
},
|
||||
"@discordjs/opus": {
|
||||
"version": "0.3.2",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/opus/-/opus-0.3.2.tgz",
|
||||
|
@ -111,9 +121,9 @@
|
|||
}
|
||||
},
|
||||
"minipass": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-3.1.1.tgz",
|
||||
"integrity": "sha512-UFqVihv6PQgwj8/yTGvl9kPz7xIAY+R5z6XYjRInD3Gk3qx6QGSD6zEcpeG4Dy/lQnv1J6zv8ejV90hyYIKf3w==",
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-3.1.3.tgz",
|
||||
"integrity": "sha512-Mgd2GdMVzY+x3IJ+oHnVM+KG3lA5c8tnabyJKmHSaG2kAGpudxuOf8ToDkhumF7UzME7DecbQE9uOZhNm7PuJg==",
|
||||
"requires": {
|
||||
"yallist": "^4.0.0"
|
||||
}
|
||||
|
@ -128,9 +138,9 @@
|
|||
}
|
||||
},
|
||||
"needle": {
|
||||
"version": "2.4.1",
|
||||
"resolved": "https://registry.npmjs.org/needle/-/needle-2.4.1.tgz",
|
||||
"integrity": "sha512-x/gi6ijr4B7fwl6WYL9FwlCvRQKGlUNvnceho8wxkwXqN8jvVmmmATTmZPRRG7b/yC1eode26C2HO9jl78Du9g==",
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/needle/-/needle-2.5.0.tgz",
|
||||
"integrity": "sha512-o/qITSDR0JCyCKEQ1/1bnUXMmznxabbwi/Y4WwJElf+evwJNFNwIDMCCt5IigFVxgeGBJESLohGtIS9gEzo1fA==",
|
||||
"requires": {
|
||||
"debug": "^3.2.6",
|
||||
"iconv-lite": "^0.4.4",
|
||||
|
@ -2480,16 +2490,16 @@
|
|||
}
|
||||
},
|
||||
"discord-akairo": {
|
||||
"version": "github:1Computer1/discord-akairo#10cef7efc7a329cb1e0d96d73ccb4b83bc0afa72",
|
||||
"version": "github:1Computer1/discord-akairo#678ae775c89947fcf77c566e04f9035941c42e0e",
|
||||
"from": "github:1Computer1/discord-akairo#master"
|
||||
},
|
||||
"discord.js": {
|
||||
"version": "github:discordjs/discord.js#5b9cdc5cd243b1588c285e22b90d92535a30b993",
|
||||
"version": "github:discordjs/discord.js#2583ad5da7db5ab92dfa357909f9c713db0a2981",
|
||||
"from": "github:discordjs/discord.js#master",
|
||||
"requires": {
|
||||
"@discordjs/collection": "^0.1.5",
|
||||
"@discordjs/form-data": "^3.0.1",
|
||||
"abort-controller": "^3.0.0",
|
||||
"form-data": "^3.0.0",
|
||||
"node-fetch": "^2.6.0",
|
||||
"prism-media": "^1.2.0",
|
||||
"setimmediate": "^1.0.5",
|
||||
|
@ -2671,7 +2681,7 @@
|
|||
}
|
||||
},
|
||||
"erlpack": {
|
||||
"version": "github:discordapp/erlpack#5d0064f9e106841e1eead711a6451f99b0d289fd",
|
||||
"version": "github:discordapp/erlpack#c514d36ec81a7a61ef90b75df261025ab046574d",
|
||||
"from": "github:discordapp/erlpack",
|
||||
"requires": {
|
||||
"bindings": "^1.5.0",
|
||||
|
@ -8132,7 +8142,7 @@
|
|||
}
|
||||
},
|
||||
"ytpplus-node": {
|
||||
"version": "git+https://git@github.com/loicbersier/ytpplus-node.git#a9edb7a9596734d0b518cb32e1581f06ce5f7ad7",
|
||||
"version": "git+https://git@github.com/loicbersier/ytpplus-node.git#cd8c7bb893a16625b6c6150489206498377c1f1a",
|
||||
"from": "git+https://git@github.com/loicbersier/ytpplus-node.git",
|
||||
"requires": {
|
||||
"ffmpeg-static": "^2.4.0",
|
||||
|
|
Loading…
Reference in a new issue