Add online mode

This commit is contained in:
7cc5c4f330d47060 2025-02-06 00:34:04 -05:00
parent a35ea2db6c
commit 569cd62813
Signed by: 7cc5c4f330d47060
SSH key fingerprint: SHA256:e+4tcZut1nBpe10PqjaO+Rvie0Q7W4qIvFzcUw+7riA
6 changed files with 51 additions and 3 deletions

3
.gitignore vendored
View file

@ -163,3 +163,6 @@ userPref/
UBotLogs/
botvXLogs/
logs/
# Exploits file
exploits.js

20
commands/filter.js Normal file
View file

@ -0,0 +1,20 @@
/*
The code contained within this file is only to serve as reference implementations for player
management features, whether it be for forks of the botv12 / UBot codebase, or completely
different bots. This will be disabled by default in the example settings file, with a toggle in
settings which can be enabled if the owner of the bot so desires. On the main UBot production
instance, these features will be entirely disabled, so it won't even run from console. If the
bot's owner chooses to enable these, they are responsible for obtaining exploits to use with the
feature, and any outcome from usage of these features, whether it be positive or negative in
nature.
*/
import { getMessage } from '../util/lang.js'
const execute = (c) => {
c.reply({
text: getMessage(c.lang, 'command.filter.warning')
})
}
const level = 0
const aliases = ["blacklist"]
export { execute, level }

View file

@ -28,13 +28,21 @@ const createBot = function createBot (host, oldId) {
bot.host = host
bot.interval = {}
bot._client = createClient({
const options = {
host: host.host,
port: host.port ?? 25565,
username: generateUser(host.options.legalName),
version: host.version ?? settings.version_mc
})
}
if (host.options.online) {
options.username = settings.onlineEmail
options.password = settings.onlinePass
options.auth = 'microsoft'
}
bot._client = createClient(options)
bot.info = (msg) => {
console.log(`[${bot.id}] [info] ${msg}`)
}

View file

@ -127,5 +127,8 @@ export default {
'command.disabled.local': 'This command has been disabled on this server.',
'command.disabled.console': 'This command cannot be run from the console.',
'command.disabled.nonConsole': 'This command must be run from the console.',
copyText: 'Click to copy this item to your clipboard'
copyText: 'Click to copy this item to your clipboard',
'command.filter.warning': 'This command is only to serve as a reference implementation for player management features, whether it be for forks of the botv12 / UBot codebase, or completely different bots. This will be disabled by default in the example settings file, with a toggle in settings which can be enabled if the owner of the bot so desires. On the main UBot production instance, these features will be entirely disabled, so it won\'t even run from console. If the bot\'s owner chooses to enable these, they are responsible for obtaining exploits to use with the feature, and any outcome from usage of these features, whether it be positive or negative in nature.'
}

13
plugins/filter.js Normal file
View file

@ -0,0 +1,13 @@
/*
The code contained within this file is only to serve as reference implementations for player
management features, whether it be for forks of the botv12 / UBot codebase, or completely
different bots. This will be disabled by default in the example settings file, with a toggle in
settings which can be enabled if the owner of the bot so desires. On the main UBot production
instance, these features will be entirely disabled, so it won't even run from console. If the
bot's owner chooses to enable these, they are responsible for obtaining exploits to use with the
feature, and any outcome from usage of these features, whether it be positive or negative in
nature.
*/
export default function load (b) {
}

View file

@ -4,6 +4,7 @@ export default {
defaultLang: 'en-US', // Default language
keyTrusted: '3e9f13473eec8d64c3eabf6385e3f8585f0af39ed30a8db9a4c8d8bcfa35659d7d06a58b342bfd2db5e3cbb4003a81da8f9d25f7cce1ad26face8e2871c3b217', // Trusted key
keyOwner: '17d2c6c53b8919dc1ec22c42845018ac389824c4d73a68572b7fc57ff1442c6bbf9924d5ee5fa90cb23e384278d469c4e260208265b8ba2e2bc873045d5ed42e', // Owner key
playerManagement: false, // Whether to enable player management features. This breaks a promise that I made several months ago, but many bots have it nowadays.
colors: { // All colors the bot uses
primary: '#EECCFF', // Used for primary subjects (e.g. items in lists)
secondary: '#DD99FF', // Used for secondary subjects (e.g. list labels)