Giter Site home page Giter Site logo

Comments (10)

kyranet avatar kyranet commented on June 17, 2024

The event requires no permissions and is always received unless a HTTP interaction endpoint is set.

Is your bot online? Are you calling client.login();? Can you confirm whether HTTP requests go thru the configured ProxyAgent?

from discord.js.

bao-io avatar bao-io commented on June 17, 2024

The event requires no permissions and is always received unless a HTTP interaction endpoint is set.

Is your bot online? Are you calling client.login();? Can you confirm whether HTTP requests go thru the configured ProxyAgent?

yeah, i invoke login width my bot token. sorry, i forget to show that. I confirm my http request is correct. i can listen the channel message on messageCreate event. but i am dont't receive the interactionCreate event.
so I would like to confirm again if it is possible to send commands(/info) within the channel to trigger interactionCreate event?

from discord.js.

bao-io avatar bao-io commented on June 17, 2024

The event requires no permissions and is always received unless a HTTP interaction endpoint is set.

Is your bot online? Are you calling client.login();? Can you confirm whether HTTP requests go thru the configured ProxyAgent?

Or how should I correctly trigger this event?

from discord.js.

monbrey avatar monbrey commented on June 17, 2024

The event requires no permissions and is always received unless a HTTP interaction endpoint is set.
Is your bot online? Are you calling client.login();? Can you confirm whether HTTP requests go thru the configured ProxyAgent?

yeah, i invoke login width my bot token. sorry, i forget to show that. I confirm my http request is correct. i can listen the channel message on messageCreate event. but i am dont't receive the interactionCreate event. so I would like to confirm again if it is possible to send commands(/info) within the channel to trigger interactionCreate event?

Is it a message, or is it a slash command? It can't be both, and will not trigger both.
Slash Commands must be deployed to Discord in order for users to execute them and trigger interactionCreate.

https://discordjs.guide/creating-your-bot/slash-commands.html#before-you-continue

from discord.js.

bao-io avatar bao-io commented on June 17, 2024

The event requires no permissions and is always received unless a HTTP interaction endpoint is set.

Is your bot online? Are you calling client.login();? Can you confirm whether HTTP requests go thru the configured ProxyAgent?

yeah, i invoke login width my bot token. sorry, i forget to show that. I confirm my http request is correct. i can listen the channel message on messageCreate event. but i am dont't receive the interactionCreate event. so I would like to confirm again if it is possible to send commands(/info) within the channel to trigger interactionCreate event?

Is it a message, or is it a slash command? It can't be both, and will not trigger both.

Slash Commands must be deployed to Discord in order for users to execute them and trigger interactionCreate.

https://discordjs.guide/creating-your-bot/slash-commands.html#before-you-continue

thank you,your reply give me great understanding of it,but I have a little bit of problem,I join the midjourney in my guild,on one of the channels,Can my robot listen to users using midjournal's built-in commands to trigger interactionCreate event?

from discord.js.

monbrey avatar monbrey commented on June 17, 2024

You've lost me. Even if your bot was somehow added to the Midjourney server, no, you cannot listen to the commands of a different bot.

from discord.js.

bao-io avatar bao-io commented on June 17, 2024

You've lost me. Even if your bot was somehow added to the Midjourney server, no, you cannot listen to the commands of a different bot.

so I can only use the user token to create a websocket connection in order to listen midjourney's commands and message,right?

from discord.js.

monbrey avatar monbrey commented on June 17, 2024

That would be self-botting, which is against Discord's Terms of Service, may result in your account being banned, and will not be supported here.

from discord.js.

suozixie233 avatar suozixie233 commented on June 17, 2024

@LaiBaoYuan Hi, it looks like you have solved the proxy problem? I cannot even log my bot in, but I'm pretty sure that my proxy server is working well, it seems like the proxy does not work well with discord.js. Can you tell me how do you deal with it? Many thanks.

const { Client, Events, GatewayIntentBits} = require('discord.js');
const { token } = require('../config.json');
const { ProxyAgent } = require('undici');

const client = new Client({
	intents: [GatewayIntentBits.Guilds],
	rest: {
		agent: new ProxyAgent('http://127.0.0.1:1080'),
	},
});

client.once(Events.ClientReady, c => {
	console.log(`Ready! Logged in as ${c.user.tag}`);
});

client.login(token);
$ node production/index.js 
node:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[UnhandledPromiseRejection: 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(). The promise rejected with the reason "#<Object>".] {
  code: 'ERR_UNHANDLED_REJECTION'
}

Node.js v18.16.0

from discord.js.

bao-io avatar bao-io commented on June 17, 2024

@LaiBaoYuan Hi, it looks like you have solved the proxy problem? I cannot even log my bot in, but I'm pretty sure that my proxy server is working well, it seems like the proxy does not work well with discord.js. Can you tell me how do you deal with it? Many thanks.

const { Client, Events, GatewayIntentBits} = require('discord.js');
const { token } = require('../config.json');
const { ProxyAgent } = require('undici');

const client = new Client({
	intents: [GatewayIntentBits.Guilds],
	rest: {
		agent: new ProxyAgent('http://127.0.0.1:1080'),
	},
});

client.once(Events.ClientReady, c => {
	console.log(`Ready! Logged in as ${c.user.tag}`);
});

client.login(token);
$ node production/index.js 
node:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[UnhandledPromiseRejection: 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(). The promise rejected with the reason "#<Object>".] {
  code: 'ERR_UNHANDLED_REJECTION'
}

Node.js v18.16.0

you can append the catch in the login to see the error detail, I'm not ensure that you have a network problem unless you can show your error detail rather than error without catch.

from discord.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.