小编Con*_*nta的帖子

必须向客户端提供 Discord API 有效意图

我正在编写一个 Discord 机器人。当我尝试运行节点时,我在CMD中收到此消息窗口中看到以下内容:

\n
\n

C:\\Users\\utente\\Desktop\\bouncerBot\\node_modules\\discord.js\\src\\client\\Client.js:544\n抛出新的 TypeError(\'CLIENT_MISSING_INTENTS\');
\n^

\n

类型错误 [CLIENT_MISSING_INTENTS]:必须为客户端提供
\n有效意图。
\nat Client._validateOptions (C:\\Users\\utente\\Desktop\\bouncerBot\\node_modules\\\xe2\x86\x90[4mdiscord.js\xe2\x86\x90[24m\\src\\client\ \Client.js:544:13)
\nat 新客户端 (C:\\Users\\utente\\Desktop\\bouncerBot\\node_modules\\\xe2\x86\x90[4mdiscord.js\xe2\x86\x90[ 24m\\src\\client\\Client.js:73:10)
\nat 对象。(C:\\Users\\utente\\Desktop\\bouncerBot\\main.js:2:16) \xe2\x86\x90[90m at
\nModule._compile (internal/modules/cjs/loader.js:1072) :14)\xe2\x86\x90[39m \xe2\x86\x90[90m
\nat Object.Module._extensions..js
\n(内部/模块/cjs/loader.js:1101:10)\xe2\x86 \x90[39m \xe2\x86\x90[90m 在 Module.load
\n(内部/模块/cjs/loader.js:937:32)\xe2\x86\x90[39m \xe2\x86\x90[90m 在
\nFunction.Module._load (内部/modules/cjs/loader.js:778:12)\xe2\x86\x90[39m
\n\xe2\x86\x90[90m 在 Function.executeUserEntryPoint [as runMain]
\n(内部/模块/run_main.js:76:12)\xe2\x86\x90[39m \xe2\x86\x90[90m 在
\ninternal/main/run_main_module.js:17:47\xe2\x86\x90[39m {
\n[\xe2\x86\x90[32mSymbol(代码)\xe2\x86\x90[39m]: \xe2\x86\x90[32m\'CLIENT_MISSING_INTENTS\'\xe2\x86\x90[39m } \\

\n

C:\\Users\\utente\\Desktop\\bouncerBot>node 。
\nC:\\Users\\utente\\Desktop\\bouncerBot\\node_modules\\discord.js\\src\\client\\Client.js:544
\n抛出新的 TypeError(\'CLIENT_MISSING_INTENTS\');
\n^ \\

\n

类型错误 [CLIENT_MISSING_INTENTS]:必须为客户端提供
\n有效意图。
\nat Client._validateOptions (C:\\Users\\utente\\Desktop\\bouncerBot\\node_modules\\\xe2\x86\x90[4mdiscord.js\xe2\x86\x90[24m\\src\\client\ \Client.js:544:13)
\nat 新客户端 (C:\\Users\\utente\\Desktop\\bouncerBot\\node_modules\\\xe2\x86\x90[4mdiscord.js\xe2\x86\x90[ 24m\\src\\client\\Client.js:73:10)
\nat 对象。(C:\\Users\\utente\\Desktop\\bouncerBot\\main.js:3:16) \xe2\x86\x90[90m at …

javascript node.js discord.js

11
推荐指数
1
解决办法
10万
查看次数

不和谐 oauth2 与 php

我正在尝试使用 disocrd 的 oauth2 创建登录系统。

这是我的代码:

  <?php
    ini_set('display_errors', 1);
    ini_set('display_startup_errors', 1);
    ini_set('max_execution_time', 300); //300 seconds = 5 minutes. In case if your CURL is slow and is loading too much (Can be IPv6 problem)
    
    error_reporting(E_ALL);
    
    define('OAUTH2_CLIENT_ID', 'XXXXXXXXXXXXXXXXXXXXXX'); //Your client Id
    define('OAUTH2_CLIENT_SECRET', 'XXXXXXXXXXXXXXXXXXXXXX'); //Your secret client code
    
    $authorizeURL = 'https://discordapp.com/api/oauth2/authorize';
    $tokenURL = 'https://discordapp.com/api/oauth2/token';
    $apiURLBase = 'https://discordapp.com/api/users/@me';
    
    session_start();
    
    // Start the login process by sending the user to Discord's authorization page
    if(get('action') == 'login') {
    
      // Redirect the user to Discord's authorization …
Run Code Online (Sandbox Code Playgroud)

php oauth-2.0 discord

5
推荐指数
1
解决办法
3838
查看次数

JS Firebase 数据库错误 db.ref 不是函数

您好,我正在尝试在我的网站中实现 firebase 实时数据库 API,我正在遵循此文档: https: //firebase.google.com/docs/database/admin/save-data#node.js但我收到此错误:

在此输入图像描述

这是我的代码:

 <script type="module">
    // Import the functions you need from the SDKs you need
    import { initializeApp } from "https://www.gstatic.com/firebasejs/9.8.3/firebase-app.js";
    import { getAnalytics } from "https://www.gstatic.com/firebasejs/9.8.3/firebase-analytics.js";
    import { getDatabase } from "https://www.gstatic.com/firebasejs/9.8.3/firebase-database.js";;

    // TODO: Add SDKs for Firebase products that you want to use
    // https://firebase.google.com/docs/web/setup#available-libraries

    // Your web app's Firebase configuration
    // For Firebase JS SDK v7.20.0 and later, measurementId is optional
    const firebaseConfig = {
      apiKey: "xxxxxxxxxxxxxxxxxxxxx",
      authDomain: "xx.x.xxx",
      databaseURL: "xxxxxxxxxxxxxxxx", …
Run Code Online (Sandbox Code Playgroud)

javascript firebase firebase-realtime-database

2
推荐指数
1
解决办法
4549
查看次数