Cada solicitação que alguem fizer para o bot ele vai ter uma atividade. É uma raspagem…
Qual erro?
Eu criei um comando “letras.js” e colei o código que você enviou do jeito q tá ai quando uso o comando aparece:
Erro:TypeError: commandFile.run is not a function
Eu tentei colocar na Index tbm, aparece uma mensagem um pouco maior:
Promise { <pending> }
Hint: hit control+c anytime to enter REPL.
(node:81) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process!
/home/runner/ITE-AQWWIKI/node_modules/puppeteer/.local-chromium/linux-856583/chrome-linux/chrome: error while loading shared libraries: libgobject-2.0.so.0: cannot open shared object file: No such file or directory
TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
at onClose (/home/runner/ITE-AQWWIKI/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:193:20)
at Interface.<anonymous> (/home/runner/ITE-AQWWIKI/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:183:68)
at Interface.emit (events.js:326:22)
at Interface.EventEmitter.emit (domain.js:483:12)
at Interface.close (readline.js:416:8)
at Socket.onend (readline.js:194:10)
at Socket.emit (events.js:326:22)
at Socket.EventEmitter.emit (domain.js:483:12)
at endReadableNT (_stream_readable.js:1241:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
(node:81) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside o
Promise { <pending> }
Hint: hit control+c anytime to enter REPL.
(node:171) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process!
/home/runner/ITE-AQWWIKI/node_modules/puppeteer/.local-chromium/linux-856583/chrome-linux/chrome: error while loading shared libraries: libgobject-2.0.so.0: cannot open shared object file: No such file or directory
TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
at onClose (/home/runner/ITE-AQWWIKI/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:193:20)
at Interface.<anonymous> (/home/runner/ITE-AQWWIKI/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:183:68)
at Interface.emit (events.js:326:22)
at Interface.EventEmitter.emit (domain.js:483:12)
at Interface.close (readline.js:416:8)
at Socket.onend (readline.js:194:10)
at Socket.emit (events.js:326:22)
at Socket.EventEmitter.emit (domain.js:483:12)
at endReadableNT (_stream_readable.js:1241:12)
at processTicksAndRejections (internal/process/task_queue
Promise { <pending> }
Hint: hit control+c anytime to enter REPL.
Ping recebido às 12:39:35
(node:216) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process!
/home/runner/ITE-AQWWIKI/node_modules/puppeteer/.local-chromium/linux-856583/chrome-linux/chrome: error while loading shared libraries: libgobject-2.0.so.0: cannot open shared object file: No such file or directory
TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
at onClose (/home/runner/ITE-AQWWIKI/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:193:20)
at Interface.<anonymous> (/home/runner/ITE-AQWWIKI/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:183:68)
at Interface.emit (events.js:326:22)
at Interface.EventEmitter.emit (domain.js:483:12)
at Interface.close (readline.js:416:8)
at Socket.onend (readline.js:194:10)
at Socket.emit (events.js:326:22)
at Socket.EventEmitter.emit (domain.js:483:12)
at endReadableNT (_stream_readable.js:1241:12)
Promise { <pending> }
Hint: hit control+c anytime to enter REPL.
(node:260) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process!
/home/runner/ITE-AQWWIKI/node_modules/puppeteer/.local-chromium/linux-856583/chrome-linux/chrome: error while loading shared libraries: libgobject-2.0.so.0: cannot open shared object file: No such file or directory
TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
at onClose (/home/runner/ITE-AQWWIKI/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:193:20)
at Interface.<anonymous> (/home/runner/ITE-AQWWIKI/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:183:68)
at Interface.emit (events.js:326:22)
at Interface.EventEmitter.emit (domain.js:483:12)
at Interface.close (readline.js:416:8)
at Socket.onend (readline.js:194:10)
at Socket.emit (events.js:326:22)
at Socket.EventEmitter.emit (domain.js:483:12)
at endReadableNT (_stream_readable.js:1241:12)
Promise { <pending> }
Hint: hit control+c anytime to enter REPL.
(node:298) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process!
/home/runner/ITE-AQWWIKI/node_modules/puppeteer/.local-chromium/linux-856583/chrome-linux/chrome: error while loading shared libraries: libgobject-2.0.so.0: cannot open shared object file: No such file or directory
TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
at onClose (/home/runner/ITE-AQWWIKI/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:193:20)
at Interface.<anonymous> (/home/runner/ITE-AQWWIKI/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:183:68)
at Interface.emit (events.js:326:22)
at Interface.EventEmitter.emit (domain.js:483:12)
at Interface.close (readline.js:416:8)
at Socket.onend (readline.js:194:10)
at Socket.emit (events.js:326:22)
at Socket.EventEmitter.emit (domain.js:483:12)
at endReadableNT (_stream_readable.js:1241:12)
Promise { <pending> }
Hint: hit control+c anytime to enter REPL.
(node:525) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process!
/home/runner/ITE-AQWWIKI/node_modules/puppeteer/.local-chromium/linux-856583/chrome-linux/chrome: error while loading shared libraries: libgobject-2.0.so.0: cannot open shared object file: No such file or directory
TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
at onClose (/home/runner/ITE-AQWWIKI/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:193:20)
at Interface.<anonymous> (/home/runner/ITE-AQWWIKI/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:183:68)
at Interface.emit (events.js:326:22)
at Interface.EventEmitter.emit (domain.js:483:12)
at Interface.close (readline.js:416:8)
at Socket.onend (readline.js:194:10)
at Socket.emit (events.js:326:22)
at Socket.EventEmitter.emit (domain.js:483:12)
at endReadableNT (_stream_readable.js:1241:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
(node:525) UnhandledPromiseRejectionWarning: Unhandled promis
Promise { <pending> }
Hint: hit control+c anytime to enter REPL.
(node:711) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process!
/home/runner/ITE-AQWWIKI/node_modules/puppeteer/.local-chromium/linux-856583/chrome-linux/chrome: error while loading shared libraries: libgobject-2.0.so.0: cannot open shared object file: No such file or directory
TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
at onClose (/home/runner/ITE-AQWWIKI/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:193:20)
at Interface.<anonymous> (/home/runner/ITE-AQWWIKI/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:183:68)
at Interface.emit (events.js:326:22)
at Interface.EventEmitter.emit (domain.js:483:12)
Promise { <pending> }
Hint: hit control+c anytime to enter REPL.
(node:757) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process!
/home/runner/ITE-AQWWIKI/node_modules/puppeteer/.local-chromium/linux-856583/chrome-linux/chrome: error while loading shared libraries: libgobject-2.0.so.0: cannot open shared object file: No such file or directory
TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
at onClose (/home/runner/ITE-AQWWIKI/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:193:20)
at Interface.<anonymous> (/home/runner/ITE-AQWWIKI/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:183:68)
at Interface.emit (events.js:326:22)
at Interface.EventEmitter.emit (domain.js:483:12)
at Interface.close (readline.js:416:8)
at Socket.onend (readline.js:194:10)
at Socket.emit (events.js:326:22)
at Socket.EventEmitter.emit (domain.js:483:12)
at endReadableNT (_stream_readable.js:1241:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
(node:757) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:757) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Acho q atingir o máximo de mensagens de novato aqui
9 hrs pra eu poder responder de novo
eu mandei um email avisando pra vc caso não veja isso aqui
Vc ta usando o código que eu enviei? Ou outro? Manda aqui por favor
Pode enviar
Man, eu falei com o criador do bot q eu te falei, ele me disse q eu só precisava baixar um arquivo .jar e fazer isso aqui pra fazer o bot funcionar:
Só q eu fiz e não foi, diz q java não é reconhecido como um comando interno
Tem que adicionar o local de instalação do Java ao PATH. (https://mauriciogeneroso.medium.com/configurando-java-4-como-configurar-as-variáveis-java-home-path-e-classpath-no-windows-46040950638f)
Consegui, agora tá aparecendo isso aqui:
Acho q é algum erro né?
O programa não encontrou o arquivo “configTEST.json”
Eu refiz tudo de novo, o erro agora é na Main
Essa é a minha main.java
package io.darkfirekiller;
import io.darkfirekiller.core.Bot;
import io.darkfirekiller.settings.*;
public class Main {
public static final boolean TESTING = true;
public static Bot mayaBot;
public static void main(String[] args) {
String dir = args.length > 0 ? args[0] : null;
Settings.load(dir);
mayaBot = new Bot(Settings.token, Settings.prefix, Settings.aList).start();
}
}
classe Settings.java, linha 58
aqui está o código
package io.darkfirekiller.settings;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import io.darkfirekiller.Main;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
public class Settings {
private static final String defaultFolder = "C://Path/To/Config/";
public static String destFolder;
public static String token = "";
public static String prefix = "";
public static ArrayList<String> aList = new ArrayList<>();
public static void load(String dir) {
destFolder = (Main.TESTING || dir == null) ? defaultFolder : dir;
final JSONParser jsonParser = new JSONParser();
Object object;
try {
object = jsonParser.parse(new String(getConfig()));
JSONObject mainBlock = (JSONObject) object;
token = (String) mainBlock.get("token");
prefix = (String) mainBlock.get("prefix");
if (token.equals("") || prefix.equals("")) {
System.out.println("Prefix or token missing.");
System.exit(0);
}
JSONArray admins = (JSONArray) mainBlock.get("admins");
if (admins == null || admins.size() == 0) {
System.out.println("Warning, no admins");
} else {
for (Object a : admins) aList.add((String) a);
}
} catch (ParseException e) {
e.printStackTrace();
}
}
private static byte[] getConfig() {
try {
return Files.readAllBytes(Paths.get(Settings.destFolder + ((Main.TESTING) ? ("configTEST.json") : ("config.json"))));
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
}
Mas tipo o criador desse Bot me disse q eu não precisaria editar nd do código, só baixar ele criar um bloco de notas “config.json” com o token do meu Bot e executar com java -jar
, dessa forma:
De acordo com o código da classe Settings, se isso é true, ele procura o arquivo configTEST.json; false, config.json.
Então basta mudar TESTING para false.
Então eu devo extrair tudo q tem dentro do arquivo .jar
para poder editar isso é? ou é possível mudar pelo prompt de comando?
ou renomeie o config.json para configTEST.json
Fiz oq mandou
Tentei executar novamente, ocorreu o mesmo erro eu acredito
Veja o caminho no erro: D:\Z\Desktop\wiki\javabot\maya\configTEST.json
Tem que colocar o arquivo aí.
Ou edita o código mesmo e coloca aquele TESTING = false.
Pois é, para editar tenho q extrair todo ó código e abrir com o Intellij IDEA é?
E como eu salvo para ele ficar um arquivo .jar de novo?