【问题标题】:Discord.JS: How to use Web Proxy?Discord.JS:如何使用 Web 代理?
【发布时间】:2020-05-13 21:18:05
【问题描述】:

我有一个 Discord 机器人。我使用 Node.JS 和 discord.js 库。有时,我的项目 IP 被 Discord API 禁止。在这些情况下,我必须改变我的项目。 discord.js 库适用于 Web 请求。所以,我想我可以连接到网络代理并屏蔽我的项目的 IP。这可能吗?

代码:

const Discord = require('discord.js');
const client = new Discord.Client();
const config = require('./config.json');
//Other includes

//Example proxy
const proxyip = '210.210.129.83';
const proxyport = 59623;

client.on('ready', () => {
  //Some on ready code
});

client.on('message', msg => {
  //Commands and other codes
});

client.login(config.token);

【问题讨论】:

    标签: node.js proxy discord.js


    【解决方案1】:

    Discord.js 使用 Websockets 与 Discord API 进行通信,问题是 HTTP 代理对此不起作用。

    这是相关的问题 https://github.com/discordjs/discord.js/issues/489

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-16
      • 2013-05-07
      • 2021-01-13
      • 2018-05-21
      • 2015-01-14
      • 1970-01-01
      相关资源
      最近更新 更多