owobot/plugins/commands/about.js

80 lines
1.8 KiB
JavaScript
Raw Normal View History

const version = require('../../version.json')
2024-07-27 02:39:18 -04:00
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'),
2024-07-27 02:39:18 -04:00
color: c.colors.secondary,
with: [
2024-07-27 02:39:18 -04:00
{
text: settings.name,
2024-07-27 02:39:18 -04:00
color: c.colors.primary
}
]
})
c.reply({ text: '' })
const botVersion = version.bot
let gitCommit
2024-07-27 02:39:18 -04:00
try {
gitCommit = cp.execSync('git rev-parse --short HEAD').toString('UTF-8').split('\n')[0]
} catch (e) {
2024-07-27 02:39:18 -04:00
gitCommit = false
}
if (gitCommit) {
2024-07-27 02:39:18 -04:00
c.reply({
translate: getMessage(c.lang, 'command.about.version'),
2024-07-27 02:39:18 -04:00
color: c.colors.secondary,
with: [
2024-07-27 02:39:18 -04:00
[
{
text: botVersion,
2024-07-27 02:39:18 -04:00
color: c.colors.primary
},
{
translate: ' (%s)',
color: 'white',
with: [
2024-07-27 02:39:18 -04:00
{
text: gitCommit,
2024-07-27 02:39:18 -04:00
color: c.colors.primary
}
]
}
]
]
})
2024-07-27 02:39:18 -04:00
} else {
c.reply({
translate: getMessage(c.lang, 'command.about.version'),
2024-07-27 02:39:18 -04:00
color: c.colors.secondary,
with: [
2024-07-27 02:39:18 -04:00
{
text: botVersion,
2024-07-27 02:39:18 -04:00
color: c.colors.primary
}
]
})
2024-07-27 02:39:18 -04:00
}
c.reply({ text: '' })
2024-07-27 02:39:18 -04:00
c.reply({
translate: getMessage(c.lang, 'command.about.serverinfo'),
2024-07-27 02:39:18 -04:00
color: c.colors.secondary,
with: [
{
translate: '"%s"',
color: 'white',
2024-07-27 02:39:18 -04:00
with: [
{
text: 'serverinfo',
2024-07-27 02:39:18 -04:00
color: c.colors.primary
}
]
}
]
})
},
aliases: ['info']
2024-07-27 02:39:18 -04:00
}