Skip to content

Commit

Permalink
fix deprecated methods
Browse files Browse the repository at this point in the history
  • Loading branch information
BluDood committed Oct 30, 2022
1 parent 57819cd commit 23486ed
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
8 changes: 2 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { Client, Collection, Intents } = require('discord.js')
const { Client, Collection, GatewayIntentBits } = require('discord.js')
const fs = require('fs')
const deploy = require('./utils/deploy')
const bconsole = require('./console')
Expand All @@ -13,11 +13,7 @@ if (!fs.existsSync('./config.json')) {
if (!fs.existsSync('./databases')) fs.mkdirSync('./databases')

const client = new Client({
intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MESSAGES,
Intents.FLAGS.GUILD_VOICE_STATES
]
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages]
})

client.commands = new Collection()
Expand Down
24 changes: 13 additions & 11 deletions utils/log.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const { resolveColor } = require('discord.js')

module.exports = (guild, type, info) => {
const {
customization: { accent, colors },
Expand Down Expand Up @@ -74,25 +76,25 @@ module.exports = (guild, type, info) => {
ban: () => {
const embed = JSON.parse(JSON.stringify(templates.moderate))
embed.title = `Banned ${info.target.tag}`
embed.color = colors.bad || '#f45450'
embed.color = resolveColor(colors.bad || '#f45450')
return embed
},
unban: () => {
const embed = JSON.parse(JSON.stringify(templates.moderate))
embed.title = `Unbanned ${info.target.tag}`
embed.color = colors.good || '#36c84b'
embed.color = resolveColor(colors.good || '#36c84b')
return embed
},
kick: () => {
const embed = JSON.parse(JSON.stringify(templates.moderate))
embed.title = `Kicked ${info.target.tag}`
embed.color = colors.bad || '#f45450'
embed.color = resolveColor(colors.bad || '#f45450')
return embed
},
timeout: () => {
const embed = JSON.parse(JSON.stringify(templates.moderate))
embed.title = `Timed out ${info.target.tag}`
embed.color = colors.medium || '#fdbc40'
embed.color = resolveColor(colors.medium || '#fdbc40')
embed.fields.splice(2, 0, {
name: 'Duration',
value: `${info.duration}`
Expand All @@ -102,15 +104,15 @@ module.exports = (guild, type, info) => {
untimeout: () => {
const embed = JSON.parse(JSON.stringify(templates.moderate))
embed.title = `Removed timeout for ${info.target.tag}`
embed.color = colors.good || '#36c84b'
embed.color = resolveColor(colors.good || '#36c84b')
return embed
},
messageDelete: () => {
const embed = JSON.parse(JSON.stringify(templates.message))
embed.title = `Message deleted by ${
info.moderator ? 'moderator' : 'user'
}`
embed.color = colors.bad || '#f45450'
embed.color = resolveColor(colors.bad || '#f45450')
if (info.moderator)
embed.fields.splice(2, 0, {
name: 'Responsible Moderator',
Expand All @@ -121,7 +123,7 @@ module.exports = (guild, type, info) => {
messageEdit: () => {
const embed = JSON.parse(JSON.stringify(templates.message))
embed.title = 'Message edited'
embed.color = colors.medium || '#fdbc40'
embed.color = resolveColor(colors.medium || '#fdbc40')
embed.fields.splice(1, 0, {
name: 'Old Message',
value: info.oldMessage
Expand All @@ -133,7 +135,7 @@ module.exports = (guild, type, info) => {
embed.title = `Purged ${info.amount} message${
info.amount === 1 ? '' : 's'
}${info.target ? ` by ${info.target.tag}` : ''}`
embed.color = colors.medium || '#fdbc40'
embed.color = resolveColor(colors.medium || '#fdbc40')
if (info.target)
embed.fields.splice(0, 0, {
name: 'User',
Expand All @@ -144,19 +146,19 @@ module.exports = (guild, type, info) => {
lock: () => {
const embed = JSON.parse(JSON.stringify(templates.channel))
embed.title = `Locked #${info.channel.name}`
embed.color = colors.medium || '#fdbc40'
embed.color = resolveColor(colors.medium || '#fdbc40')
return embed
},
unlock: () => {
const embed = JSON.parse(JSON.stringify(templates.channel))
embed.title = `Unlocked #${info.channel.name}`
embed.color = colors.good || '#36c84b'
embed.color = resolveColor(colors.good || '#36c84b')
return embed
},
phish: () => {
const embed = JSON.parse(JSON.stringify(templates.message))
embed.title = `Deleted phishing site by ${info.target.tag}`
embed.color = colors.bad || '#f45450'
embed.color = resolveColor(colors.bad || '#f45450')
embed.fields.splice(3, 0, {
name: 'Harmful Site',
value: info.site
Expand Down

0 comments on commit 23486ed

Please sign in to comment.