#development
1 messages · Page 1719 of 1
`const Discord = require("discord.js");
const client = new Discord.Client();
const config = require("./config.json");
client.commands = new Discord.Collection();
client.event = new Discord.Collection();
["command_handler", "event_handler"].forEach(handler => {
require(.handlers/${handler})(client, Discord)
});
client.login(config.token);`
did you edit the config.json in notepad by any chance
no
SyntaxError: C:\Users\MagiK\Desktop\BOT SENGOKU NADEKO\config.json: Unexpected end of JSON input
at parse (<anonymous>)
at Object.Module._extensions..json (node:internal/modules/cjs/loader:1135:22)
at Module.load (node:internal/modules/cjs/loader:972:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
at Module.require (node:internal/modules/cjs/loader:996:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object.<anonymous> (C:\Users\MagiK\Desktop\BOT SENGOKU NADEKO\index.js:3:16)
at Module._compile (node:internal/modules/cjs/loader:1092:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
at Module.load (node:internal/modules/cjs/loader:972:32)
3 16
hm
try programatically printing out the file content with fs
require fs at the top
comment out the config.json require
and console.log(fs.readFileSync("config.json", "utf8"));
lmk what it prints out
are you sure the file is there and is saved
wait
@vivid fulcrum PS C:\Users\MagiK\Desktop\BOT SENGOKU NADEKO> node .
node:internal/modules/cjs/loader:927
throw err;
^
Error: Cannot find module 'handlers/command_handler'
Require stack:
- C:\Users\MagiK\Desktop\BOT SENGOKU NADEKO\index.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:924:15)
at Function.Module._load (node:internal/modules/cjs/loader:769:27)
at Module.require (node:internal/modules/cjs/loader:996:19)
at require (node:internal/modules/cjs/helpers:92:18)
at C:\Users\MagiK\Desktop\BOT SENGOKU NADEKO\index.js:9:5
at Array.forEach (<anonymous>)
at Object.<anonymous> (C:\Users\MagiK\Desktop\BOT SENGOKU NADEKO\index.js:8:38)
at Module._compile (node:internal/modules/cjs/loader:1092:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
at Module.load (node:internal/modules/cjs/loader:972:32) {
code: 'MODULE_NOT_FOUND',
requireStack: [ 'C:\Users\MagiK\Desktop\BOT SENGOKU NADEKO\index.js' ]
now what
In Mariadb/MySQL what is the datatype for storing a list of things such as IDS/Strings
BTW someone alr did ask if you saved the file, see here #development message
One message removed from a suspended account.
Totally didn't spend 10+ min wondering why my code didn't work when I didn't save the file 
CREATE TABLE Guilds (
guildID VARCHAR NOT NULL PRIMARY KEY,
guildPrefix VARCHAR NOT NULL,
guildOperator VARCHAR NOT NULL,
);
``` It says syntax error, any ideas?
🤗
One message removed from a suspended account.
One message removed from a suspended account.
halp lmao
varchar needs a length
omfg i forgot
if you're using mysql, I recommend VARCHAR(191)
mysql has a reeeeeeally weird bug
i use mysql2 for npm but the db is mariadb ;)
if you input any utf-8 character (like emotes) and the length is higher than 191 it goes haywire
like data not being saved, being saved wrong or being fakely saved
kk
mysql garbage db anyways lol
also prone to corruption for absolutely no reason
I mean I believe IDs are 18 chars always
rule of thumb is: anything that comes from oracle is shit
i said
oracle java = shit
i use mariadb
i love how mysql has utf8mb4 and still has a stroke with some 4 byte chars
open jdk = god
mariadb is an engine
and java isnt all that bad
java isnt
i mean android is made in java
oracle jdk is
ok well it depends what jdk u use
i use oracle since its the default lmaoooooooooooooooooooooooooooo
oh maybe im using that then
which is the best thing after cheddar
windows?
99% sure you're using oracle's
when i install java i instal the one from oracle website
let me guess, java 1.8?
you're missing like THE WHOLE java
i use js for discord bots
1.8 is way too outdated
and py for small projects
I mean
1.8 is what mc uses
so i use whats best with it
it doesn't
mc uses the most recent version you have
oh
it doesn't
mc comes with a prepackaged java distribution in the launcher
idk what version it is
but i know that 1.17 drops support for java 1.8
look, there are two jdks
and 1.15 and 1.16 show warnings it's going to drop support
okay i need help making a warn command
the stinky greedy garbage that is oracle's
I use 1.8.8 paper since my server is a pvp based one
and the selfless humble god that is openjdk
my bot crashes and i have npm i everything again
openjdk doesn't have a fancy installer that tells you java is used in 1.6 billion devices
LMAO
error?
send the error here please
but the extra work is worth it
okay
when you think about it, over 50% of those devices were oracle making contracts with phone companies like nokia back in 2006 to put shitty java phone games on there lol
exactly
i cant
I wouldn't be surprised if oracle was behind most negative global events
btw Visual Studio Code is superior than Visual Studio
UX is WAYYYYYYYYYYYY better imo
i dont usually even use java lmao
to that organization
do you code discord bots in java?
first time project
imagine using java in 2021 when there's .net 5.0
my bot
she self-identifies as a loli
(someone didn't watch ngnl)
goes quiet lmao
but anyway
Is the invite manager broken?
the
does this have to do with topgg?
because if you need help on a specific bot go to their support server
module.exports = {
name: 'ban',
aliases: [],
category: 'Moderation',
utilisation: '{prefix}ban [member] <reason>',
description: 'Bans the users if the author have the permissions',
async execute(client, message, args) {
if (!message.member.hasPermission('BAN_MEMBERS')) return message.channel.send({
embed: {
color: 'BLUE',
author: { name: 'Ban' },
footer: { text: 'Error' },
fields: [
{ name: `${client.emotes.error} - ERROR:`, value: `You do not have permissions to ban members`, inline: false },
],
timestamp: new Date(),
},
});
const member = message.guild.member(message.mentions.users.first() || message.guild.members.cache.get(args[0]));
if (!member) return message.channel.send({
embed: {
color: 'RED',
description: `${client.emotes.error} - Please specify a user`,
}
}).then(msg => { msg.delete({ timeout: 2000 }) });
if (member.hasPermission('VIEW_AUDIT_LOG')) return message.channel.send({
embed: {
color: 'RED',
description: `${client.emotes.error} - This user can not be banned`,
}
}).then(msg => { msg.delete({ timeout: 2000 }) });
const reason = args.slice(1).join(" ") || 'No reason provided';
await message.guild.members.ban(member.id, { reason: reason, days: 7 }).then(member => {
message.channel.send({
embed: {
color: 'GREEN',
description: `${client.emotes.success} - **${member.tag}** was banned for **${reason}**`,
}
}).then(msg => { msg.delete({ timeout: 2000 }) });
})
},
};
this is my ban command
is this coded by u or copied from tutorial or sum?
what
ban command
so your saying it crashes on startup?
does it crash when you run the cmd or what
oh i did
ik
so send
the
warn
cmd
you cant expect us to help you when you dont give the info lol
ik'
One message removed from a suspended account.
wait
One message removed from a suspended account.
One message removed from a suspended account.
I can't say if that's smth I would be excited about.
One message removed from a suspended account.
One message removed from a suspended account.
they didnt have it?

One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
i like how for javascript there is not just ONE highlighting but 2
js and javascript
also i like spamming if if if if if firififi fifii if if because im using ighlighting for something not js```
One message removed from a suspended account.
it is forme
One message removed from a suspended account.
One message removed from a suspended account.
hmm wth
require()

One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
ik
One message removed from a suspended account.
'thats why i said im on windows
that's sad
cri
require
they should just release highlighting for everything at once
rather than just release it one by one
you gonna send the code for warn cmd? Cause you said that causes the error
unless u dont want help anymore
nvmi fixed it
istg the most types of errors with discord.js is with someone using a command handler but putting the wrong names for the parameters
for some reason statics problem was so bad that the cmd not only stopped the bot but also vs lmao
i boosted once just to be able to change nickname to that
ill buy nitro when i change it again
const learnJS = {whyDoesThisNotWork: "That's cause you didn't learn javascript"}
if (iDontKnowJs) return {learnJS}```
new member: does this work?
Regular helpful dude: checks code. yep, probably
TOPGG USERS:
https://tryitands.ee 🤔
lmfao so true
dot
making an api with express is quite easy 
i cant code so
if i eval'ed my nickname id return
i even used discord bot maker to get bot dev and topgg approved
lmfao imagine using discord bot maker tho
nah
i just cant code
my 'c' key broke because of the copy pasta i did to make a bot
O.o
im using the c key n the laptop built in keyboard since the on on my actual keyboard broke
Not everyone has the time to completely dedicate their focus into others' code bases to help them solve a problem. Asking if something will work is kinda pointless unless it's too expensive to test normally.
Although, understanding logic and being type safe helps everyone out in the long run and will prevent errors from occurring in the first place. I can't remember the last time I ran into an error that was actually my fault
lmao it was a meme
it seemed like an insult to some
umm
how can run events folder
all the time
?
I forgot..
I used to remember it
but after a long break forgot it.
You could do something like
fs.readdir("./Events/", ... other stuff here) in index.js, similar to how you load your commands folder @quaint wasp
Why can't VScode read the ID, how do i fix it?
Did you save your file properly before testing that code?
It shows it’s unsaved
just enable auto save smh
I'll Change Another Code But Before That,
I Already Save It And VScode Cant Read The ID
my bot is on my 100k member server, but when i do client.users.cache.size it return 1416 does someone know why
do you have guild_members intent
did you enable it in your code
Does the member role exist 
Like all lowercase
how can i
okay
Member Role And Mute Role?
can i do that?
const { Client, Intents } = require('discord.js')
const client = new Client({ intents: Intents.ALL});
now it say 800 users
did you enable intents in the developer portal
yes
but still get 800 users with client.users.cache.size
and everytime i restart the bot i get a new number
why
@ancient gulch cuz you arent requesting all users on startup, as the name says cache, its only users cached, djs by default will lazily load them
i wouldnt recommend doing it, but if you have the ram to spare, you can request ALL members from the guilds. You need intents enabled for MEMBER_CHUNKS though
d.js highly likely has an option for it on the client startup, but i dont remember. you can always do this too tho ts for(let guild of client.guilds.cache.values()) await guild.members.fetch()
oh yeah it's "fetchAllMembers: true"
Ram nuke
mine doesnt use that much tbh on detritus
i could run it without the members
1.2GB with 700k+ members
What host is that?
mine?
you could also hover over the error and read it
Yea
wholesaleinternet
wholesalemarket sound better
Is it a VPS
small capital letter in .env file?
Or all have to be capitilaized?
hi?
please help.
Its important.
Idk I’ve always used all capital letters in an env file lol
For example TOKEN= and DB_PASS=
I don't use .env often tho lel
Should I use MySQL or PostgreSQL for this levelling bot 
either should be fine
postgres is fun cuz it has a lot more advanmced stuff
and want to transform it
^
though i dont think you'll be using them
If it's just for leveling I say use sqlite
Smol, quick and simple
^^ something lighter is also a good choice
then djs is a blackhole? 
Djs is a whitehole
but it sucks ram
bruh
All the space sqlite saves goes to djs hog
answer me pelase
answer what?
do you have to capitilize letters in .env?
no
no
should you? yes
It's just a best practice
like
topken=tafasoiudfsannidfsabldgybcsadf
good*
its standard to capitalise it
You aren't forced to capitalize it.
alright, it will still work, right?
Yuh
I already do but the server the level bot is for has like over like 100k members and I’d rather not stick to that forever
in all honesty member count isnt an accurate representation of ur usage
i assume tis a normal exp bot
where you get exp when you type
Constants = SNAKE_CAPS
variables = camelCase
Class = PascalCase
Project = kebab-case
message/m is a much better way to see how much you should be concerning yourself with
What do you use to track this 
All in all, moving from sqlite to any other db is just plug-n-play
what host is that? lol its really interesting..
Since it use very primitive types
its not a host, i made it
What does host has to do with a panel?
its using grafana and prom
a simple ++ on every message and calculating the difference between querries
thats it
its a single integer

thats what we always say

theres more on the bottom part
but its not finished so i wont show
I mean, I already store stats and have a chart command
fuck!
But...I'll leave a live panel to another time
i keep coughing and it sounds like a rubber duck squeaking
Still have to finish my card market screen in the site
Why would anyone use heroku git?
because
I am an idiot so I am using a specific guid for idiots.
Install heroku
Add its path to env
how do you do that?
(I do)
Then just upload your peoject your project to github
I dont use girhub.
And link your github with heroku
And enable auto deploys for the repo
You must use any git client in order to use heroku
You can even use heroku git
?
Can someone help me make a discord bot please 🙏🙏🙏🙏
Dm me and we can talk about it
Ya he is right
wait
I need someone to do it for me
Please read this: #502193464054644737 message
if you don't want to do it yourself I know exactly where you can find one
OO
It's a great site
If you want someone else to make a bot for you, this isn't the place to ask. Go to a freelancing website like Fiverr
pay. Lol pay your developers.
Idk how to spell fevver
We can someone make me a website for the bot
Those services are thing you're gonna have to pay for
I did
No one is going to develop anything for you for free
Thx
@dusky sundial -needdev 😉
If only 😔
oh shoot! That's right, sorry.
tags are broken for trial mods lol
didn't mean to put you on the spot there!
@tropic whale You dont have to do it, you can pay me Ill do it for you!
f lol.
Where to look for devs:
<#general message>
feiverererer
tf
I don’t like paying for bots/websites I’d dumb
ya same thing here
discord blocked by fiverr that's so funny
Well then good luck getting everything for free in life, Karen.
do my patreon. Its sure is cheap!
nope
Bruh
not gonna happen
Are u the owner of this server bro
we're the guardians of the galaxy
I make servers too btw lmao
Yes pls
Click the botton named join and will start. 🙂
At this point @quaint wasp you're basically advertising
But not that Mutch god
I get the joke though 😛
But look at the link in my stats
Leave the homi alien
lol
Alown
@tropic whale no one is going to do this shit for you for free.
who said its a joke?
lol yes I agree no one will.
Well
Why u gotta be so mean yo
If you can't manage your own servers, hiring a rando is a great way to get the server deleted
Or at least nuked
IF you can't make your own bots and don't want to pay, there's 100% definitely the bot you want on top.gg already
I have Netflix
you do'nt even need to do anything, just invite the bot
yes.
plus
that will support the developers. 🙂
It will make someone happy.
And I dont mean gay here.
a lot of these bots even have dashboards too ("websites")
Is not online I need someone to put it online
not your bot. someone else's bot
lmao
a bot made by someone competent
I’m not a coder
what do you need your bot for?
what kind of bot are you looking for?
moderation?
Economy?
fun?
music?
Banimg someone in my server that has about 100k people in it
advertisers? (like the ones that send your server ads to other)
Great, so literally any moderation bots
Yep
lol
any of them. they all have a ban command.
get mee6
Levels
mee6 has levels
Logs
mee6 has logs
Welcomed
get SMUGY FUGY
Leaving
🙂
Or look for one of the other "multi-purpose bots" out there
lol
again, stop trying to advertise your shit
Lol
Lol ya right
Doesn't matter, linking your own bot is advertising, everyone knows this
fine.
@quaint wasp let's not try to advertise alright?
OML busted
I got a question @dusky sundial
Anyways back to the point: Literally all the multipurpose bots have the things you need.
Absolutely no programming involved.
no?
No?
We're giving you the help you need, not the one you want.
so wait what are you looking for? I am confused... Server staff? Server templates? Bots?
lol..
I remember times of me beeing like that
when Idk.. I was like 10 those years
we all do , smug 
I need staff in my server and what ever I need for my server🙏🤞🤞🤞
what is this stink I am looking at
ofc that accoutn got banned and I was litilary waiting in the bed wating till I am going to be 13 and now im here lol
you're looking in the wrong place and will not find quality staff by begging in other servers.
🥺
dude tfq.. Go to https://top.gg/servers/ and then pic advertising
Find servers you're interested in and meet new friends
How can i define multiple variable with an array
I mean my array is
const array = ['ban', 'kick', 'role']
for(var all of array) {
const all = ...
}
then choose one and they probobly got one
where you can ask to get staff
EZ.
At least thats what I do.
and it works perfectly.
Tf why lol not going to happen 🙅♂️ yo
What do you mean by "multiple variable"? What specifically do you need to do in the loop?
Bruh why do you always pick the hard ways.
or rather what are you looking to do with the array elements
Some one tell me what they thing about my new server I just made
Now, let's swap channels unless you need development help
I am
i need to get a module on my database, but i don't want to do
const ban = await client.getModule(message.guild, 'ban')
const kick = await client.getModule(message.guild, 'kick')
const role = await client.getModule(message.guild, 'role')
Each time
I cant login
That is what I need
to heroku
his begging for free spoonfeeding.
You keep asking for help with your server, which is not what you do in this channel
well, you can't exactly do that easily through that simple of a loop
how
Are you looking to define things like global modules or what?
Even tho we told him to go to places like https://fiverr.com, and top.gg/servers/ and then there look for servers to ask for staff, ect, and he just doesnt want to do those things.
what do those things do? why do you need to define them in a loop instead of just one after the other?
Brb imma show u the bot I made
lol..
probobly ghost bot host
or smth like that
?
o
yes.
welp..
Imma head into my bed now.
bye
thanks, good night.:)
As a developer with a lot of experience, I'll tell you this: just leave the separate lines, don't do the loop, it's not really worth it
Hm okay, thanks you for help :)
^_^
search up "How to store variables in an array"
@umbral zealot is someone going to Approve the bot I made 🤔🤔🤔🙏🤞🙏🙏
stop asking
Why
because they will most likely mute or ban you
and if you get banned
you cant upload bots
If you actualy submitted a bot, the wait time is up to 2 weeks, so, just keep your shirt on.
no problem, madam.
One message removed from a suspended account.
One message removed from a suspended account.
@umbral zealot imma put u as the bot dev helper on the website
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Why u have a problem with it
One message removed from a suspended account.
Ya that is what I thot
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
CREATE TABLE Guilds (
guildID VARCHAR(18) NOT NULL PRIMARY KEY,
guildPrefix VARCHAR(10) NOT NULL,
guildOperator VARCHAR(18) NOT NULL,
);
``` syntax err how i hate it
apparently the ); is wrong
One message removed from a suspended account.
Mhm I am
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
wait so if you run your own discord bot list website why are you tryna submit a bot here?
Be nice.
One message removed from a suspended account.
also i need help my smol brain cannot comprehend
One message removed from a suspended account.
Cus I can yo
You are "new to discord"
We all start someone in development so no need to criticize someone on their knowledge. Please and thank you for your time.
are you trying to pull a pickle on us
One message removed from a suspended account.
Lol
I can ask something
my code have error
client.on('ready' , async () => {
client.user.setActivity(STATUS+ '😎');
let channel =
client.channels.cache.get(CHANNEL) ||
(await client.channels.fetch(CHANNEL));
if (!channel) return;
const connection = await channel.join()
connection.play(ytdl(LIVE));
});
Who can help fix this
One message removed from a suspended account.
One message removed from a suspended account.
amazing
This three error
One message removed from a suspended account.
yea
One message removed from a suspended account.
smh my head
Anyway I was wondering what its called when a string in js uses var in a string like this `${client.guilds.cache.filter(g => g.available).size} Servers` cause i need to convert a normal string into that type but literally dont know what its called i cant even google how to do it
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
dumb question prob but are there any npm packages or stuff on github to make interactive prompts in djs easier
currently my code to ask questions, validate them etc is just callback hell and i hate it
One message removed from a suspended account.
How does one use dictionary, and or list manipulation?
How can I test my welcome command?
hey fellow developers
I am currently using query based authorisation in my api
I want to use header based
using header token thingy or whatever it's called
I am using NodeJS (express package) for my api
any idea how I can do that
just check the header if it contains the stuff you expect (on your API Application) from your client you just send the token as header
has djs not provided types or something
i can't ever get auto code to pop up
it does
lol
if the types still dont show up
add the types to the parameters
of ur function
i have no idea how to even do that
i just want it to show all the vars like if i type .channel it shows type, nsfw, etc
are you using typescript
no, just js
rip then
lol
in javascript ur parameters will just be any types
in typescript you would actually get the auto complete
oh, ok
lol
also btw
any javascript is also perfectly valid typescript
since typescript is just a superset
so uh if you really insist on the auto complete

i don't really want to use ts
i tried to get the grasps of it but i just don't really get it, and then i have to go compile code every time
not quick to just reload
it is quick, use tsc -w and your reload commands work just fine
and set up an npm script
Alao you do get autosuggestions when uaing javascript but not when your function is in a different file
You won't get em even with typescript without explicitly providing the types
You can do this:
/*
@param {import("discord.js").Message} message
*/
Something like this.. I don't exactly remember
i'm wondering if i enable intents, get verified but don't apply for intents, will i still be able to use the intents and get verified but just be limited to 100 servers?
Right above the functions
Right above the run function
Does anyone knows this icon and color theme?
Hard to say without code highlight colour
const lmm = new MessageEmbed()
.setTitle("Member Remove")
.setDescription(`${member} Goodbye :wave1: :bye: !! We will miss you! If you wanna join then here is the link : `)
.setFooter("We Are not satisfied 😒 with this ! || From Gamers Point")
.setThumbnail(member.guild.iconURL())
.setTimestamp()
const mm = new MessageEmbed()
.setTitle("Member Removed")
.setDescription(`Dm Successfully to ${member.user.tag}`)
.setTimestamp()
member.send(lmm).then(
client.channels.cache.get("835389487134932992").send(mm)
)
})
Error could not dm that user
User disabled dms
Nope
Then its the bot itself
Its human
Hm?
what
Mb first you need to https://discord.js.org/#/docs/main/stable/class/GuildMember?scrollTo=createDM
?
let embede = new Discord.MessageEmbed()
.setTitle(`Title`)
.setDescription(`Description`)
message.channel.send(embede)
let s2 = await message.channel.send("Voici les paramètres de la commande Embed:")
s2.react("📝")
s2.react("📣")
const filter = m => m.author.id == message.author.id;
let stopDEB = s2.createReactionCollector((reaction, user) => user.id === message.author.id);
stopDEB.on("collect", async(reaction, user) => {
if(reaction.emoji.name === "📝") {
let ad = message.channel.send("Veuillez rentrer la description de l'embed:")
s2.channel.awaitMessages(filter, { max: 1, time: 300000, errors: ['time'] })
.then(async collected => {
const description = collected.first().content
embede.edit(Discord.MessageEmbed()
.setDescription(description))
}).catch(collected => {
message.channel.send("Temps écoulé :x:");
return;
})
}```
How do I edit just part of the embed? I make a command to make the custom embed
I don't get it like
req.get("api_key")
// api_key is header name
like this?
and read its value
and like this
Try and see. Cant give you better instructions, wiped windows due to be flaky again
How do I edit just part of the embed? I make a command to make the custom embed
you have to edit the entire embed and add the stuff you want
if you keed the old informations the same it will work
dn
if(reaction.emoji.name === ":white_check_mark:") {
let ad = message.channel.send("Veuillez rentrer le salon où envoyer l'embed:")
s2.channel.awaitMessages(filter, {max: 1, time: 300000, errors: ['time'] })
.then(async collected => {
const channel = message.mentions.channels.first() || message.guild.channels.cache.get(args[0]);
console.log(channel)
channel.send("hey")
})```
https://media.discordapp.net/attachments/223867697312694272/835421321583919104/unknown.png
@earnest phoenix Le système fonctionne normalement sinon?
Le problème est que peut-être c’est un message en privé
du coup il renvoie ce message
mmmh
Ou bien alors il ne trouve pas le salon
bah
il trouve pas le salon
Tu as le soucis quand tu mentionnes le salon ou quand tu met l’identifiant du salon?
@earnest phoenix ?
la mention
Ok, alors
du coup j'essaie ça
ou alors ceci:
if(reaction.emoji.name === "✅") {
let ad = message.channel.send("Veuillez rentrer le salon où envoyer l'embed:")
s2.channel.awaitMessages(filter, {max: 1, time: 300000, errors: ['time'] })
.then(async collected => {
const channel = collected.first().mentions.channels
console.log(channel)
channel.send("hey")
})```
const getChan = message.mentions.channels.first() || args[0];
const channel = message.guild.channels.cache.first(getChan.id);
if(!channel) // Il trouve pas le salon
else // sinon, si il trouve le salon, il fait l’action```
psk en gros message.mentions.channels.first() c’est juste une mention, sa récupère pas les données du salon
déjà essayé
mais en mieux: const channel = message.mentions.channels.first() || message.guild.channels.get(args[0]);
ah mmmh
Ah nan att
faut metrte collected
qlq part
let getChan;
let mention = message.mentions.channels.first();
if(collected === mention) getChan = mention.id;
else getChan = message.guild.channels.cache.get(collected).catch(e => { return e;})```
@earnest phoenix essaye sa pour voir?
@earnest phoenix
mmh
avec la mention sa fonctionne ?
let getChan;
let mention = message.mentions.channels.first();
if(collected === mention) getChan = mention.id;
else getChan = message.guild.channels.cache.get(collected);
if(!getChan) // trouve po le salon```
euh jfais avec mention
Sa a l’air d’etre un truc tout con mais j’arrive pas a résoudre ptdr
là nn plius
:/
Get-chan~
no
Impossible
no really
You need the guild members intent for it lol
i know, it wasnt working before today
i dont even have the intents
im so confused XD
inb4 discord did a fucky wucky uwu
Probably because you used API v7 or something
nah still
im just using client.on('guildMemberAdd', async member => {
you won't receive the event at all without the intent on all gateway versions
did you apply for intents or something
It's greyed out so I guess they didn't
yes but they arent showing on the discord applications website
unless it takes time to show?
Your bot is verified, no?
my bot is verified
Then you need to contact support
i did that
and they granted you access?
i mean maybe but it isnt showing on the website
If they did then the intent would have been toggled and grayed
the intent is toggled off
No, you need to explicitly request for it
i know i did that, im telling you the intent is showing off on the website but somehow it is still using guildmemberadd without intents
Because Discord.js uses API v7 and it doesn't require you to use intents
So it just silently not trigger the event
and did they ever respond?
I guess you have to wait for a bit
maybe try clearing your browser cache idk
its strange because it wasnt working before today
did something change today/yesterday because why would it just suddenly start working
Hello guys
I am shit at Oauth2
I followed https://discordjs.guide/oauth2/#a-quick-example for oauth
I was wondering how I can make a user join my server
by their consent ofc
After you get the access token make a request to https://discord.com/developers/docs/resources/guild#add-guild-member
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
and you're done
like
just a min
{ message: '401: Unauthorized', code: 0 }

why get error :CCC
I also press authorise
did you exchange the code for an access token
wait
lemme check
const oauthResult = await fetch('https://discord.com/api/oauth2/token', {
method: 'POST',
body: new URLSearchParams({
client_id: clientID,
client_secret: clientSecret,
code,
grant_type: 'authorization_code',
redirect_uri: `http://localhost:${port}`,
scope: 'identify',
}),
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
});
const oauthData = await oauthResult.json();
const userResult = await fetch('https://discord.com/api/users/@me', {
headers: {
authorization: `${oauthData.token_type} ${oauthData.access_token}`,
},
});
I am getting the authorization_code
it works fine
but problem is at fetching user data
what does oauthData.token_type return
also I'm fairly certain that Authorization has to have a capital A, not entirely sure
headers are case-insensitive
Yeah
I get this response when authorising in first place
size: 0,
timeout: 0,
[Symbol(Body internals)]: {
body: PassThrough {
_readableState: [ReadableState],
_events: [Object: null prototype],
_eventsCount: 2,
_maxListeners: undefined,
_writableState: [WritableState],
allowHalfOpen: true,
[Symbol(kCapture)]: false,
[Symbol(kTransformState)]: [Object]
},
disturbed: false,
error: null
},
[Symbol(Response internals)]: {
url: 'https://discord.com/api/oauth2/token',
status: 400,
statusText: 'Bad Request',
headers: Headers { [Symbol(map)]: [Object: null prototype] },
counter: 0
}
}```
Bad request
undefined
Is it possible & best practice to have multiple processes for same shards?
What I mean is, lets say I have two commands.
I want 2 bot processes (python) running, one with each command, connected to the same shard.
This way I can separate functionality.
Is this sustainable long run, and is there a better way?
p.s. using discord.py AutoShardedClient
if you run 2 processes you get stuff like the bot answering mutiple times to the same command.
the only way to have stuff running on mutiple processes directly is with sharding
Actually I just figured out most of it
const userResult = await fetch('https://discord.com/api/users/@me', {
headers: {
authorization: `${oauthData.token_type} ${oauthData.access_token}`,
},
});
console.log(await userResult.json())
This is my code
{ message: '401: Unauthorized', code: 0 }
Error ^
even tho I have token
and toke type
@delicate shore did you get the token exchange working
yes
okay so there is no token_type probably
just use Bearer in the string
`Bearer ${access_token}`
token_type: 'Bearer'
there is
oh
now it doesn't
log the token
I did
it logs it
maybe it's node fetch messing up
like not putting the headers
yeah I mean running 2 processes, each one with different code to answer different commands
sharding is just for split load between servers
i mean like running 1 process that only listens to command !help and one that listens to !about (just a silly example)
both running on all shards
you could break down the Bot into Microservices, then it would be relatively easy to have mutiple processes handling commands, but there are no frameworks for this iirc
ig you can make a request manually with cURL
and check if it's node-fetch or something else
yeah this is what i am looking to do, and looking for someone with experience in breaking into microservices
i dont need a framework for this tbh
whats iirc btw
if i remember/recall correctly
ah
just looking for best practice in python
my bot just grown quite alot in the last few days and I am having some tech difficulties
idk about microservices, have no bot that would be large enough to require it
i just have a command that takes 10-20 seconds sometimes (its ok)


