discordbot-script
Advanced tools
Comparing version 3.1.1 to 3.2.0
{ | ||
"_from": "discordbot-script@latest", | ||
"_id": "discordbot-script@3.1.0", | ||
"_from": "discordbot-script", | ||
"_id": "discordbot-script@3.1.1", | ||
"_inBundle": false, | ||
"_integrity": "sha512-jw93INjZGea9dZhJMKWLPaKQK80YiTyJa0S8qtzvTTleRKSev9b4QQ1XTyRlhoQA5RkFHzZNXXz6PO/H5OPspw==", | ||
"_integrity": "sha512-83hvvWgcU2usGo8cjcWtYjGGN2O2eUU7Z7hieOcfQjsgKiTozbcuRIuAT+/6qIeVBfwST98dMfaYGaDuC9AigQ==", | ||
"_location": "/discordbot-script", | ||
@@ -11,6 +11,6 @@ "_phantomChildren": {}, | ||
"registry": true, | ||
"raw": "discordbot-script@latest", | ||
"raw": "discordbot-script", | ||
"name": "discordbot-script", | ||
"escapedName": "discordbot-script", | ||
"rawSpec": "latest", | ||
"rawSpec": "", | ||
"saveSpec": null, | ||
@@ -23,5 +23,5 @@ "fetchSpec": "latest" | ||
], | ||
"_resolved": "https://registry.npmjs.org/discordbot-script/-/discordbot-script-3.1.0.tgz", | ||
"_shasum": "7983a3d69eda1c61753f605ef58d88c83b00721a", | ||
"_spec": "discordbot-script@latest", | ||
"_resolved": "https://registry.npmjs.org/discordbot-script/-/discordbot-script-3.1.1.tgz", | ||
"_shasum": "64433a710a8594f7c4febf08f347b493eae5bd58", | ||
"_spec": "discordbot-script", | ||
"_where": "C:\\Users\\inspi\\OneDrive\\Desktop\\DB-Script\\Updates", | ||
@@ -65,3 +65,3 @@ "author": { | ||
}, | ||
"version": "3.1.1" | ||
"version": "3.2.0" | ||
} |
@@ -11,2 +11,6 @@ const moment = require("moment") | ||
client.reactionAdd.map(async command => { | ||
if (reaction.message.partial) reaction.message.fetch(); | ||
if (reaction.partial) reaction.fetch(); | ||
guild = reaction.message.guild | ||
@@ -13,0 +17,0 @@ let member = { guild, user } |
@@ -5,23 +5,46 @@ const { docs } = require("../functions/docs/docs.json"); | ||
const r = code.split("$disconnect[").length - 1 | ||
const r = code.split("$disconnect").length - 1 | ||
let inside = code.split("$disconnect[")[r].split("]")[0] | ||
if (code.split("$disconnect")[r].startsWith("[")) { | ||
if (!inside) return message.channel.send(`:x: Invalid channel ID in \`$disconnect[${inside}]\`.\n${docs.music}/disconnect`) | ||
let inside = code.split("$disconnect[")[r].split("]")[0] | ||
let id = (inside ? inside : message.guild.id) | ||
let guild = client.guilds.cache.get(id) | ||
if (!guild) return message.channel.send(`Error \`$disconnect\`: ${docs.music}/disconnect\nInvalid guild ID! Leave empty to define this guild!`) | ||
let channel = client.channels.cache.get(inside || message.channel.id) | ||
let queue = client.queue.get(guild) | ||
if (client.queue.get(message.guild.id)) { | ||
try { | ||
if (channel !== client.queue.get(message.guild.id).connection.channel) | ||
return message.channel.send(`:x: ${client.user.tag} is not in that voice channel.\n${docs.music}/disconnect`) | ||
} catch { | ||
return message.channel.send(`:x: Something happened when attempting to disconnect....\n${docs.music}/disconnect`) | ||
if (!queue) { | ||
let queueConnection = (queue ? true : false) | ||
if (queueConnection === false) { | ||
return message.channel.send(`Error \`$disconnect\`: ${docs.music}/disconnect\n${client.user.tag} is not in a voice channel in ${guild.name} **Catch with \`$voiceID[$client]\`**!`) | ||
} else { | ||
let queueChannel = queue.connection.channel | ||
client.queue.delete(guild) | ||
await queueChannel.leave(); | ||
} | ||
} | ||
client.queue.delete(message.guild.id) | ||
await channel.leave(); | ||
code = code.replaceLast(`$disconnect[${inside}]`, "") | ||
return { | ||
code: code, | ||
} | ||
} else { | ||
let queue = client.queue.get(message.guild.id) | ||
if (!queue) { | ||
let queueConnection = (queue ? true : false) | ||
if (queueConnection === false) { | ||
return message.channel.send(`Error \`$disconnect\`: ${docs.music}/disconnect\n${client.user.tag} is not in a voice channel. **Catch with \`$voiceID[$client]\`**!`) | ||
} | ||
} else { | ||
let queueChannel = queue.connection.channel | ||
client.queue.delete(message.guild.id) | ||
await queueChannel.leave(); | ||
} | ||
} | ||
code = code.replaceLast(`$disconnect[${inside}]`, "") | ||
code = code.replaceLast("$disconnect", "") | ||
@@ -32,33 +55,2 @@ return { | ||
} | ||
module.exports = disconnect; | ||
// const { docs } = require("../functions/docs/docs.json"); | ||
// const disconnect = async (client, message, args, name, code) => { | ||
// // let channel = client.channels.cache.get(inside || message.channel.id) | ||
// let queue = client.queue.get(message.guild.id) | ||
// if (queue) { | ||
// try { | ||
// if (!queue.connection.channel) | ||
// return message.channel.send(`:x: ${client.user.tag} is not in a voice channel.\n${docs.music}/disconnect`) | ||
// } catch { | ||
// return message.channel.send(`:x: Something happened when attempting to disconnect....\n${docs.music}/disconnect`) | ||
// } | ||
// client.queue.delete(message.guild.id) | ||
// await channel.leave(); | ||
// } | ||
// code = code.replaceLast(`$disconnect`, "") | ||
// return { | ||
// code: code | ||
// } | ||
// } | ||
// module.exports = disconnect; | ||
module.exports = disconnect; |
@@ -1,27 +0,32 @@ | ||
const hastebin = require("hastebin-gen") | ||
const {docs} = require("../functions/docs/docs.json"); | ||
const { docs } = require("../functions/docs/docs.json"); | ||
const haste = async (client, message, args, name, code) => { | ||
const hastebin; | ||
try { | ||
hastebin = require("hastebin-gen") | ||
} catch { | ||
return message.channel.send(`:x: Must \`npm install hastebin-gen\` before using \`$haste\`! \`$haste[${inside}]\`.\n${docs.action}/haste`) | ||
} | ||
let r = code.split("$haste[").length - 1 | ||
let r = code.split("$haste[").length - 1 | ||
let inside = code.split("$haste[")[r].split("]")[0] | ||
let inside = code.split("$haste[")[r].split("]")[0] | ||
let fields = inside.split(";") | ||
let fields = inside.split(";") | ||
if (!fields[0]) return message.channel.send(`:x: Empty content in \`$haste[${inside}]\`.\n${docs.action}/haste`) | ||
if (!fields[0]) return message.channel.send(`:x: Empty content in \`$haste[${inside}]\`.\n${docs.action}/haste`) | ||
let content = fields[0] | ||
let content = fields[0] | ||
let ext = fields[1] | ||
let ext = fields[1] | ||
if (!fields[1]) ext = "txt" | ||
if (!fields[1]) ext = "txt" | ||
let haste; | ||
let haste; | ||
try { | ||
haste = await hastebin(content, { extension: ext }) | ||
} catch { | ||
return message.channel.send(`Failed to create haste. Hastebin servers seem to be having issues.`) | ||
} | ||
try { | ||
haste = await hastebin(content, { extension: ext }) | ||
} catch { | ||
return message.channel.send(`Failed to create haste. Hastebin servers seem to be having issues.`) | ||
} | ||
@@ -28,0 +33,0 @@ code = code.replaceLast(`$haste[${inside}]`, haste) |
@@ -14,3 +14,3 @@ const moment = require("moment") | ||
let member = await client.users.fetch(userID ? userID : message.author.id).catch(err => { }) | ||
let member = await client.users.fetch(userID ? userID : message.author.id).catch(err => undefined) | ||
let guild = (client.guilds.cache.get(guildID ? guildID : message.guild.id)) | ||
@@ -21,11 +21,16 @@ | ||
let m = await guild.members.fetch(member).catch(err => { }) | ||
let m = await guild.members.fetch(member).catch(err => undefined) | ||
if (!m) return message.channel.send(`:x: Could not fetch member from the guild. \`$member[${inside}]\`.\n${docs.compacts}/member`) | ||
if (!m && (option !== "exists")) return message.channel.send(`:x: Could not fetch member from the guild. \`$member[${inside}]\`.\n${docs.compacts}/member\n**Catch with the \`exists\` option!**`) | ||
if (option === "exists") return { | ||
code: code.replaceLast(`$member[${inside}]`, m !== undefined) | ||
} | ||
/* Returns the date and time the member boosted the guild*/ | ||
let boostedat = moment(m.premiumSince).format("LLLL"); | ||
let boostdate = moment(m.premiumSince).format("LLLL") | ||
/* Returns how long ago the member boosted */ | ||
let boostingTimestamp = Object.entries(ms(Date.now() - m.premiumSinceTimestamp)).map((x, y) => { | ||
let booststamp = Object.entries(ms(Date.now() - m.premiumSinceTimestamp)).map((x, y) => { | ||
if (x[1] > 0 && y < 4) return `${x[1]} ${x[0]}` | ||
@@ -35,11 +40,12 @@ }).filter(x => x).join(", "); | ||
/* Returns the date and time the member joined the guild */ | ||
let joinedAt = moment(m.joinedAt).format("LLLL"); | ||
let joindate = moment(m.joindate).format("LLLL"); | ||
/* Returns how long ago the member joined the guild */ | ||
let joinedTimestamp = Object.entries(ms(Date.now() - m.joinedTimestamp)).map((x, y) => { | ||
let joinstamp = Object.entries(ms(Date.now() - m.joinstamp)).map((x, y) => { | ||
if (x[1] > 0 && y < 4) return `${x[1]} ${x[0]}` | ||
}).filter(x => x).join(", "); | ||
if (!option) return message.channel.send(`:x: Missing option in 3rd field of \`$member[${inside}]\`.`) | ||
if (![ //18 options | ||
if (![ //20 options | ||
"nickname", | ||
@@ -53,3 +59,3 @@ "id", | ||
"iskickable", | ||
"isinguild", | ||
"exists", | ||
"hexcolor", | ||
@@ -59,7 +65,9 @@ "guildid", | ||
"isbotabovemember", | ||
"boostingsince", | ||
"boostedat", | ||
"jointimestamp", | ||
"booststamp", | ||
"boostdate", | ||
"joinstamp", | ||
"joindate", | ||
"presence" | ||
"presence", | ||
"boostcount", | ||
"tag" | ||
].includes(option)) return message.channel.send(`:x: Invalid option in 3rd field of \`$member[${inside}]\`.`) | ||
@@ -76,2 +84,4 @@ | ||
break; | ||
case "tag": option = m.user.tag | ||
break; | ||
case "rolecount": option = m.roles.cache.size - 1 | ||
@@ -83,3 +93,3 @@ break; | ||
break; | ||
case "isinguild": | ||
case "exists": | ||
option = m.deleted | ||
@@ -100,18 +110,20 @@ if (option === false) { | ||
break; | ||
case "boostingsince": option = boostingTimestamp | ||
if (boostedat === "Invalid date") { | ||
case "booststamp": option = booststamp | ||
if (boostdate === "Invalid date") { | ||
option = "notboosting" | ||
} | ||
break; | ||
case "boostedat": option = boostedat | ||
if (boostedat === "Invalid date") { | ||
case "boostdate": option = boostdate | ||
if (boostdate === "Invalid date") { | ||
option = "notboosting" | ||
} | ||
break; | ||
case "boostcount": option = (m.premiumSubscriptionCount ? m.premiumSubscriptionCount : "0") | ||
break; | ||
case "isboosting": if (m.premiumSinceTimestamp === null || m.premiumSinceTimestamp === undefined) option = "false" | ||
else option = "true" | ||
break; | ||
case "jointimestamp": option = joinedTimestamp | ||
case "joinstamp": option = joinstamp | ||
break; | ||
case "joindate": option = joinedAt | ||
case "joindate": option = joindate | ||
break; | ||
@@ -118,0 +130,0 @@ case "presence": |
const Discord = require('discord.js') | ||
const client = new Discord.Client() | ||
const client = new Discord.Client({ partials: ['MESSAGE', 'CHANNEL', 'REACTION', 'USER', 'GUILD_MEMBER'] }) | ||
const db = require("quick.db") | ||
@@ -4,0 +4,0 @@ const chalk = require('chalk'); |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
902346
465
16402