discord embeds color config

This commit is contained in:
ChomeNS 2022-12-01 17:15:30 +07:00
parent eecd66bb4c
commit b0e158de84
20 changed files with 72 additions and 68 deletions

View file

@ -9,9 +9,9 @@ module.exports = {
execute (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
bot.tellraw(selector, [{ text: 'The bot\'s username is: ', color: 'white' }, { text: `${bot.username}`, color: 'gold', clickEvent: { action: 'copy_to_clipboard', value: `${bot.username}` }, hoverEvent: { action: 'show_text', contents: [{ text: 'Click here to copy the username to your clipboard', color: 'green' }] } }, { text: ' and the UUID is: ' }, { text: `${bot.uuid}`, color: 'aqua', clickEvent: { action: 'copy_to_clipboard', value: `${bot.uuid}` }, hoverEvent: { action: 'show_text', contents: [{ text: 'Click here to copy the UUID to your clipboard', color: 'green' }] } }])
},
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc, message) {
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc, message, config) {
const Embed = new MessageEmbed()
.setColor('#FFFF00')
.setColor(config.discord.embedsColors.normal)
.setTitle('Bot\'s User')
.setDescription(`The bot's username is: \`${bot.username}\` and the UUID is: \`${bot.uuid}\``)
channeldc.send({ embeds: [Embed] })

View file

@ -30,12 +30,12 @@ module.exports = {
throw new SyntaxError('Invalid argument')
}
},
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc, message) {
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc, message, config) {
if (args[0] === 'true' || args[0] === 'on') {
bot.visibility = true
bot.chat('/essentials:vanish disable')
const Embed = new MessageEmbed()
.setColor('#FFFF00')
.setColor(config.discord.embedsColors.normal)
.setTitle('Bot\'s Visibility')
.setDescription('The bot\'s visibility is now visible')
channeldc.send({ embeds: [Embed] })
@ -43,7 +43,7 @@ module.exports = {
bot.visibility = false
bot.chat('/essentials:vanish enable')
const Embed = new MessageEmbed()
.setColor('#FFFF00')
.setColor(config.discord.embedsColors.normal)
.setTitle('Bot\'s Visibility')
.setDescription('The bot\'s visibility is now invisible')
channeldc.send({ embeds: [Embed] })
@ -53,7 +53,7 @@ module.exports = {
const enableOrDisable = bot.visibility ? 'disable' : 'enable'
bot.chat(`/essentials:vanish ${enableOrDisable}`)
const Embed = new MessageEmbed()
.setColor('#FFFF00')
.setColor(config.discord.embedsColors.normal)
.setTitle('Bot\'s Visibility')
.setDescription(`The bot's visibility is now ${visibleOrInvisible}`)
channeldc.send({ embeds: [Embed] })

View file

@ -9,10 +9,10 @@ module.exports = {
execute (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
bot.bruhifyText = args.join(' ')
},
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc) {
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc, message, config) {
bot.bruhifyText = args.join(' ')
const Embed = new MessageEmbed()
.setColor('#FFFF00')
.setColor(config.discord.embedsColors.normal)
.setTitle('Bruhify')
.setDescription(`Bruhify set to: ${bot.bruhifyText}`)
channeldc.send({ embeds: [Embed] })

View file

@ -27,14 +27,14 @@ module.exports = {
bot.tellraw(selector, component)
},
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc) {
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc, message, config) {
let changelogs = ''
changelog.forEach((message, number) => {
number += 1
changelogs += `\`${number}\` - \`${message}\`` + '\n'
})
const Embed = new MessageEmbed()
.setColor('#FFFF00')
.setColor(config.discord.embedsColors.normal)
.setTitle(`Changelogs (${changelog.length})`)
.setDescription(changelogs)
channeldc.send({ embeds: [Embed] })

View file

@ -16,7 +16,7 @@ function clear (bot) {
bot.cloops = []
}
function list (bot, discord, channeldc, selector) {
function list (bot, discord, channeldc, selector, config) {
const message = []
if (discord) {
@ -32,7 +32,7 @@ function list (bot, discord, channeldc, selector) {
message.pop()
const Embed = new MessageEmbed()
.setColor('#FFFF00')
.setColor(config.discord.embedsColors.normal)
.setTitle('Cloops')
.setDescription(message.join(''))
channeldc.send({ embeds: [Embed] })
@ -84,29 +84,29 @@ module.exports = {
throw new SyntaxError('Invalid argument')
}
},
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc, message) {
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc, message, config) {
if (!bot.cloops) bot.cloops = []
if (args[0] === 'add' && args[2]) {
if (!Number(args[1]) && Number(args[1]) !== 0) throw new SyntaxError('Invalid interval')
add(args.slice(2).join(' '), args[1], bot)
const Embed = new MessageEmbed()
.setColor('#FFFF00')
.setColor(config.discord.embedsColors.normal)
.setTitle('Cloop')
.setDescription(`Added cloop \`${args.slice(2).join(' ')}\` with interval ${args[1]} to the cloops`)
channeldc.send({ embeds: [Embed] })
} else if (args[0] === 'list') {
list(bot, true, channeldc)
list(bot, true, channeldc, '@a', config)
} else if (args[0] === 'remove') {
remove(args[1], bot)
const Embed = new MessageEmbed()
.setColor('#FFFF00')
.setColor(config.discord.embedsColors.normal)
.setTitle('Cloop')
.setDescription(`Removed cloop \`${args[1]}\``)
channeldc.send({ embeds: [Embed] })
} else if (args[0] === 'removeall') {
clear(bot)
const Embed = new MessageEmbed()
.setColor('#FFFF00')
.setColor(config.discord.embedsColors.normal)
.setTitle('Cloop')
.setDescription('Removed all looped commands')
channeldc.send({ embeds: [Embed] })

View file

@ -36,7 +36,7 @@ module.exports = {
},
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc, message, config) {
const Embed = new MessageEmbed()
.setColor('#FFFF00')
.setColor(config.discord.embedsColors.normal)
.setTitle('Cowsay')
.setDescription(cowsay.say(args.slice(1).join(' '), { cow: cows[args[0]] }))
channeldc.send({ embeds: [Embed] })

View file

@ -9,9 +9,9 @@ module.exports = {
execute (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
bot.tellraw(selector, [{ text: 'ChomeNS Bot ', color: 'yellow' }, { text: 'was created by ', color: 'white' }, { text: 'chayapak', color: 'gold' }])
},
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc, message) {
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc, message, config) {
const Embed = new MessageEmbed()
.setColor('#FFFF00')
.setColor(config.discord.embedsColors.normal)
.setTitle('Creator')
.setDescription('ChomeNS Bot was created by chayapak')
channeldc.send({ embeds: [Embed] })

View file

@ -43,7 +43,7 @@ module.exports = {
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc, message, config) {
if (args[0] === 'run') {
const Embed = new MessageEmbed()
.setColor('#FFFF00')
.setColor(config.discord.embedsColors.normal)
.setTitle('Output')
.setDescription(`\`\`\`${util.inspect(bot.vm.run(args.slice(1).join(' '))).substring(0, 1950)}\`\`\``)
channeldc.send({ embeds: [Embed] })
@ -57,7 +57,7 @@ module.exports = {
code: args[1]
})).then((res) => {
const Embed = new MessageEmbed()
.setColor('#FFFF00')
.setColor(config.discord.embedsColors.normal)
.setTitle('Output')
.setDescription(`\`\`\`${res.data}\`\`\``)
channeldc.send({ embeds: [Embed] })

View file

@ -97,7 +97,7 @@ module.exports = {
bot.tellraw(selector, [pre, generalCommands, trustedCommands, ownerCommands])
}
},
discordExecute: async function (bot, username, usernameraw, sender, prefix, args, channeldc) {
discordExecute: async function (bot, username, usernameraw, sender, prefix, args, channeldc, message, config) {
if (args[0]) {
for (const command of bot.command_handler.commands) {
function run () {
@ -107,7 +107,7 @@ module.exports = {
alias = command.alias.join(', ')
}
const Embed = new MessageEmbed()
.setColor('#FFFF00')
.setColor(config.discord.embedsColors.normal)
.setTitle(`${prefix + command.name} (${alias}) - ${command.description}`)
.setDescription(`Trust level: ${command.trusted}
Supported: ${command.discordExecute ? 'true' : 'false'}
@ -133,7 +133,7 @@ module.exports = {
unsupportedCommands += command.name + ' '
}
const Embed = new MessageEmbed()
.setColor('#FFFF00')
.setColor(config.discord.embedsColors.normal)
.setTitle(`Commands (Length: ${bot.command_handler.commands.length})`)
.setDescription('**Supported Commands**\n' + supportedCommands + '\n**Unsupported Commands**\n' + unsupportedCommands)
channeldc.send({ embeds: [Embed] })

View file

@ -58,7 +58,7 @@ module.exports = {
}
},
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc) {
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc, message, config) {
try {
let players = ''
for (const property of bot.players.list) {
@ -66,7 +66,7 @@ module.exports = {
players += `\`${property.name}\` \`${property.UUID}\`` + '\n'
}
const Embed = new MessageEmbed()
.setColor('#FFFF00')
.setColor(config.discord.embedsColors.normal)
.setTitle(`Players (${bot.players.list.length})`)
.setDescription(players.substring(0, 4096))
channeldc.send({ embeds: [Embed] })

View file

@ -19,7 +19,7 @@ if (os.hostname() === 'chomens-kubuntu') {
let song
async function play (bot, values, discord, channeldc, selector) {
async function play (bot, values, discord, channeldc, selector, config) {
try {
const filepath = values.join(' ')
const absolutePath = await resolve(filepath)
@ -28,7 +28,7 @@ async function play (bot, values, discord, channeldc, selector) {
bot.music.play(song)
if (discord) {
const Embed = new MessageEmbed()
.setColor('#FFFF00')
.setColor(config.discord.embedsColors.normal)
.setTitle('Music')
.setDescription(`Added ${song.name} to the song queue`)
channeldc.send({ embeds: [Embed] })
@ -38,7 +38,7 @@ async function play (bot, values, discord, channeldc, selector) {
} catch (e) {
if (discord) {
const Embed = new MessageEmbed()
.setColor('#FF0000')
.setColor(config.discord.embedsColors.error)
.setTitle('Error')
.setDescription('```SyntaxError: Invalid file```')
channeldc.send({ embeds: [Embed] })
@ -48,7 +48,7 @@ async function play (bot, values, discord, channeldc, selector) {
}
}
async function playUrl (bot, values, discord, channeldc, selector) {
async function playUrl (bot, values, discord, channeldc, selector, config) {
try {
const url = values.join(' ')
const response = await axios.get('https://http-proxy.nongsonchome.repl.co', {
@ -62,7 +62,7 @@ async function playUrl (bot, values, discord, channeldc, selector) {
bot.music.play(song)
if (discord) {
const Embed = new MessageEmbed()
.setColor('#FFFF00')
.setColor(config.discord.embedsColors.normal)
.setTitle('Music')
.setDescription(`Added ${song.name} to the song queue`)
channeldc.send({ embeds: [Embed] })
@ -72,7 +72,7 @@ async function playUrl (bot, values, discord, channeldc, selector) {
} catch (e) {
if (discord) {
const Embed = new MessageEmbed()
.setColor('#FF0000')
.setColor(config.discord.embedsColors.error)
.setTitle('Error')
.setDescription('```SyntaxError: Invalid URL```')
channeldc.send({ embeds: [Embed] })
@ -89,7 +89,7 @@ async function resolve (filepath) {
return filepath
}
async function list (bot, discord, channeldc, prefix, selector, args) {
async function list (bot, discord, channeldc, prefix, selector, args, config) {
try {
let absolutePath
if (args[1]) absolutePath = await resolve(path.join(SONGS_PATH, args.slice(1).join(' ')))
@ -101,7 +101,7 @@ async function list (bot, discord, channeldc, prefix, selector, args) {
if (discord) {
const Embed = new MessageEmbed()
.setColor('#FFFF00')
.setColor(config.discord.embedsColors.normal)
.setTitle('Songs')
.setDescription(listed.join(', '))
channeldc.send({ embeds: [Embed] })
@ -136,7 +136,7 @@ async function list (bot, discord, channeldc, prefix, selector, args) {
} catch (e) {
if (discord) {
const Embed = new MessageEmbed()
.setColor('#FF0000')
.setColor(config.discord.embedsColors.error)
.setTitle('Error')
.setDescription(`\`\`\`${e.toString()}\`\`\``)
channeldc.send({ embeds: [Embed] })
@ -164,10 +164,10 @@ module.exports = {
execute (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
switch (args[0]) {
case 'play':
play(bot, args.slice(1), false, null, selector)
play(bot, args.slice(1), false, null, selector, config)
break
case 'playurl':
playUrl(bot, args.slice(1), false, null, selector)
playUrl(bot, args.slice(1), false, null, selector, config)
break
case 'stop':
try {
@ -222,7 +222,7 @@ module.exports = {
}
break
case 'list':
list(bot, false, null, prefix, selector, args)
list(bot, false, null, prefix, selector, args, config)
break
case 'nowplaying':
bot.tellraw(selector, [
@ -253,19 +253,19 @@ module.exports = {
throw new SyntaxError('Invalid argument')
}
},
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc, message) {
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc, message, config) {
let Embed
switch (args[0]) {
case 'play':
play(bot, args.slice(1), true, channeldc)
play(bot, args.slice(1), true, channeldc, config)
break
case 'playurl':
playUrl(bot, args.slice(1), true, channeldc)
playUrl(bot, args.slice(1), true, channeldc, config)
break
case 'stop':
try {
const Embed = new MessageEmbed()
.setColor('#FFFF00')
.setColor(config.discord.embedsColors.normal)
.setTitle('Stop')
.setDescription('Cleared the song queue')
channeldc.send({ embeds: [Embed] })
@ -277,7 +277,7 @@ module.exports = {
case 'skip':
try {
const Embed = new MessageEmbed()
.setColor('#FFFF00')
.setColor(config.discord.embedsColors.normal)
.setTitle('Skip')
.setDescription(`Skipping ${bot.music.song.name}`)
channeldc.send({ embeds: [Embed] })
@ -291,7 +291,7 @@ module.exports = {
case 'off':
bot.music.loop = 0
Embed = new MessageEmbed()
.setColor('#FFFF00')
.setColor(config.discord.embedsColors.normal)
.setTitle('Loop')
.setDescription('Looping is now disabled')
channeldc.send({ embeds: [Embed] })
@ -299,7 +299,7 @@ module.exports = {
case 'current':
bot.music.loop = 1
Embed = new MessageEmbed()
.setColor('#FFFF00')
.setColor(config.discord.embedsColors.normal)
.setTitle('Loop')
.setDescription(`Now looping ${song.name}`)
channeldc.send({ embeds: [Embed] })
@ -307,7 +307,7 @@ module.exports = {
case 'all':
bot.music.loop = 2
Embed = new MessageEmbed()
.setColor('#FFFF00')
.setColor(config.discord.embedsColors.normal)
.setTitle('Loop')
.setDescription('Now looping every song in the queue')
channeldc.send({ embeds: [Embed] })
@ -315,11 +315,11 @@ module.exports = {
}
break
case 'list':
list(bot, true, channeldc, prefix, '@a', args)
list(bot, true, channeldc, prefix, '@a', args, config)
break
case 'nowplaying':
Embed = new MessageEmbed()
.setColor('#FFFF00')
.setColor(config.discord.embedsColors.normal)
.setTitle('Now playing')
.setDescription(`Now playing ${bot.music.song.name}`)
channeldc.send({ embeds: [Embed] })
@ -328,7 +328,7 @@ module.exports = {
const queueWithName = []
bot.music.queue.forEach((song) => queueWithName.push(song.name))
Embed = new MessageEmbed()
.setColor('#FFFF00')
.setColor(config.discord.embedsColors.normal)
.setTitle('Queue')
.setDescription(queueWithName.join(', '))
channeldc.send({ embeds: [Embed] })

View file

@ -19,13 +19,13 @@ module.exports = {
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc, message, config) {
try {
const Embed = new MessageEmbed()
.setColor('#FFFF00')
.setColor(config.discord.embedsColors.normal)
.setTitle('Output')
.setDescription(util.inspect(eval(args.join(' ')), { stylize }))
channeldc.send({ embeds: [Embed] })
} catch (err) {
const Embed = new MessageEmbed()
.setColor('#FF0000')
.setColor(config.discord.embedsColors.error)
.setTitle('Error')
.setDescription(`\`\`\`${util.inspect(err).replaceAll('runner', 'chayapak1')}\`\`\``)
channeldc.send({ embeds: [Embed] })

View file

@ -30,9 +30,9 @@ module.exports = {
}
])
},
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc) {
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc, message, config) {
const Embed = new MessageEmbed()
.setColor('#FFFF00')
.setColor(config.discord.embedsColors.normal)
.setTitle('Hello!')
.setDescription('This is the first ever command to be discordified!' + '\n' + `More info: Username: ${username}, Prefix: ${prefix}, Args: ${args.join(' ')}`)
channeldc.send({ embeds: [Embed] })

View file

@ -19,13 +19,13 @@ module.exports = {
bot.tellraw(selector, component)
}
},
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc) {
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc, message, config) {
const timezone = args.join(' ')
const momented = moment().tz(timezone).format('dddd, MMMM Do, YYYY, hh:mm:ss A')
const description = `The current date and time for the timezone ${timezone} is: ${momented}`
if (timezone.toLowerCase() === 'asia/bangkok' || timezone.toLowerCase() === 'utc') {
const Embed = new MessageEmbed()
.setColor('#FFFF00')
.setColor(config.discord.embedsColors.normal)
.setTitle('Time')
.setDescription(description)
channeldc.send({ embeds: [Embed] })
@ -33,7 +33,7 @@ module.exports = {
throw new SyntaxError('Invalid timezone')
} else {
const Embed = new MessageEmbed()
.setColor('#FFFF00')
.setColor(config.discord.embedsColors.normal)
.setTitle('Time')
.setDescription(description)
channeldc.send({ embeds: [Embed] })

View file

@ -15,17 +15,17 @@ module.exports = {
bot.tellraw(selector, { text: String(e), color: 'red' })
}
},
discordExecute: async function (bot, username, usernameraw, sender, prefix, args, channeldc, message) {
discordExecute: async function (bot, username, usernameraw, sender, prefix, args, channeldc, message, config) {
try {
const res = await translate(args.slice(2).join(' '), { from: args[0], to: args[1] })
const Embed = new MessageEmbed()
.setColor('#FFFF00')
.setColor(config.discord.embedsColors.normal)
.setTitle('Result')
.setDescription(res.text)
channeldc.send({ embeds: [Embed] })
} catch (e) {
const Embed = new MessageEmbed()
.setColor('#FF0000')
.setColor(config.discord.embedsColors.error)
.setTitle('Error')
.setDescription(`\`\`\`${e}\`\`\``)
channeldc.send({ embeds: [Embed] })

View file

@ -10,9 +10,9 @@ module.exports = {
execute (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
bot.tellraw(selector, [{ text: 'The bot\'s uptime is ', color: 'white' }, { text: `${secondsToHms(Math.floor(performance.now() / 1000))}`, color: 'green' }])
},
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc, message) {
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc, message, config) {
const Embed = new MessageEmbed()
.setColor('#FFFF00')
.setColor(config.discord.embedsColors.normal)
.setTitle('Bot\'s Uptime')
.setDescription(`The bot's uptime is ${secondsToHms(Math.floor(performance.now() / 1000))}`)
channeldc.send({ embeds: [Embed] })

View file

@ -68,13 +68,13 @@ module.exports = {
const player = bot.playersAddedPlayers[playername]
if (player === undefined) throw new SyntaxError('Invalid UUID')
const Embed = new MessageEmbed()
.setColor('#FFFF00')
.setColor(config.discord.embedsColors.normal)
.setTitle('UUID')
.setDescription(`${playername}'s UUID: ${player}`)
channeldc.send({ embeds: [Embed] })
} else {
const Embed = new MessageEmbed()
.setColor('#FF0000')
.setColor(config.discord.embedsColors.error)
.setTitle('Error')
.setDescription('Invalid player name')
channeldc.send({ embeds: [Embed] })

View file

@ -17,18 +17,18 @@ module.exports = {
bot.tellraw(selector, { text: e.toString(), color: 'red' })
}
},
discordExecute: async function (bot, username, usernameraw, sender, prefix, args, channeldc) {
discordExecute: async function (bot, username, usernameraw, sender, prefix, args, channeldc, message, config) {
try {
const page = await wiki.page(args.join(' '))
const summary = await page.summary()
const Embed = new MessageEmbed()
.setColor('#FFFF00')
.setColor(config.discord.embedsColors.normal)
.setTitle('Output')
.setDescription(summary.extract)
channeldc.send({ embeds: [Embed] })
} catch (e) {
const Embed = new MessageEmbed()
.setColor('#FF0000')
.setColor(config.discord.embedsColors.error)
.setTitle('Error')
.setDescription(`\`\`\`${util.inspect(e)}\`\`\``)
channeldc.send({ embeds: [Embed] })

View file

@ -53,6 +53,10 @@ module.exports = {
'mc.chomens41793.ga': '1010734897796763758',
'real.chipmunk.land': '1042590315464364032'
},
embedsColors: {
normal: '#FFFF00',
error: '#FF0000'
},
prefix: '!'
},
servers: [

View file

@ -47,7 +47,7 @@ function inject (bot, dcclient, config) {
} catch (e) {
if (prefix === config.discord.prefix) {
const Embed = new MessageEmbed()
.setColor('#FF0000')
.setColor(config.discord.embedsColors.error)
.setTitle('Error')
.setDescription(`\`\`\`${e}\`\`\``)
channeldc.send({ embeds: [Embed] })