owobot/plugins/commands/about.js

95 lines
2.2 KiB
JavaScript
Raw Normal View History

2024-07-28 16:30:19 -04:00
const version = require('../../version.json')
const settings = require('../../settings.json')
const getMessage = require('../../util/lang.js')
const cp = require('child_process')
module.exports = {
execute: function (c) {
c.reply({
translate: getMessage(c.lang, 'command.about.author'),
color: c.colors.secondary,
with: [
{
2024-07-28 16:48:46 -04:00
text: version.botName,
2024-07-28 16:30:19 -04:00
color: c.colors.primary
}
]
})
c.reply({ text: '' })
2024-07-28 16:48:46 -04:00
const botVersion = version.botVersion
2024-07-28 16:30:19 -04:00
let gitCommit
try {
gitCommit = cp.execSync('git rev-parse --short HEAD').toString('UTF-8').split('\n')[0]
} catch (e) {
gitCommit = false
}
if (gitCommit) {
c.reply({
translate: getMessage(c.lang, 'command.about.version'),
color: c.colors.secondary,
with: [
[
{
text: botVersion,
color: c.colors.primary
},
{
translate: ' (%s)',
color: 'white',
with: [
{
text: gitCommit,
color: c.colors.primary
}
]
}
]
]
})
} else {
c.reply({
translate: getMessage(c.lang, 'command.about.version'),
color: c.colors.secondary,
with: [
{
text: botVersion,
color: c.colors.primary
}
]
})
}
c.reply({ text: '' })
2024-07-29 00:55:38 -04:00
c.reply({
translate: getMessage(c.lang, 'command.about.sourceCode'),
color: c.colors.secondary,
with: [
{
text: version.sourceURL,
color: c.colors.primary,
clickEvent: {
action: 'open_url',
value: version.sourceURL
}
}
]
})
c.reply({ text: '' })
2024-07-28 16:30:19 -04:00
c.reply({
translate: getMessage(c.lang, 'command.about.serverinfo'),
color: c.colors.secondary,
with: [
{
translate: '"%s"',
color: 'white',
with: [
{
text: 'serverinfo',
color: c.colors.primary
}
]
}
]
})
},
aliases: ['info']
}