2023-12-17 14:55:27 -05:00
|
|
|
|
const CommandError = require('../CommandModules/command_error')
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
|
name: 'translate',
|
|
|
|
|
//<< this one line of code broke it lmao
|
|
|
|
|
description:['<language 1> <language 2> <message>'],
|
|
|
|
|
aliases:['translation'],
|
2023-12-20 11:54:03 -05:00
|
|
|
|
trustLevel: 0,
|
2023-12-17 14:55:27 -05:00
|
|
|
|
async execute (context) {
|
|
|
|
|
const { translate } = require('@vitalets/google-translate-api')
|
|
|
|
|
const message = context.arguments.join(' ')
|
|
|
|
|
const bot = context.bot
|
|
|
|
|
const args = context.arguments
|
|
|
|
|
const amonger = args.slice(1).join(' ');
|
|
|
|
|
const source = context.source
|
2024-01-26 21:24:08 -05:00
|
|
|
|
const ChatMessage = require('prismarine-chat')(bot.options.version)
|
|
|
|
|
try {
|
2023-12-17 14:55:27 -05:00
|
|
|
|
const res = await translate(args.slice(2).join(' '), { from: args.slice(1).join(' '), to: args[1] })
|
2024-01-27 10:08:54 -05:00
|
|
|
|
if(bot.options.Core.CorelessMode){
|
2024-01-26 21:24:08 -05:00
|
|
|
|
bot.chat(ChatMessage.fromNotch([{ text: 'Result: ', color: 'gold' }, { text: res.text, color: 'green' }]).toMotd().replaceAll('§', '&'))
|
|
|
|
|
}else{
|
|
|
|
|
bot.tellraw([{ text: 'Result: ', color: 'gold' }, { text: res.text, color: 'green' }])
|
|
|
|
|
}
|
|
|
|
|
} catch (e) {
|
2024-01-27 10:08:54 -05:00
|
|
|
|
if (bot.options.Core.CorelessMode){
|
2024-01-26 21:24:08 -05:00
|
|
|
|
bot.chat(ChatMessage.fromNotch({ text: e.toString(), color: 'red' }).toMotd().replaceAll('§', '&'))
|
|
|
|
|
}else{
|
2023-12-17 14:55:27 -05:00
|
|
|
|
source.sendFeedback({ text: e, color: 'red' })
|
|
|
|
|
}
|
2024-01-26 21:24:08 -05:00
|
|
|
|
}
|
2023-12-17 14:55:27 -05:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//[%s] %s › %s
|
|
|
|
|
//was it showing like that before?
|
|
|
|
|
// just do text bc too sus rn ig
|
|
|
|
|
// You should remove the with thing and the translate and replace
|
|
|
|
|
|
|
|
|
|
// Parker, why is hashing just random characters???
|
|
|
|
|
//wdym
|