#development
1 messages · Page 1699 of 1
i don't want rose since i prefer structured response
- discord api docs is not that good for me

We're bots
i am working on a command to add reaction to a msg tried this code but not working (py)
aemoji = {<":"+emoji.name+":"+emoji.id>}
await message.add_reaction(aemoji)```
cant figure out how to get the recent msg and add a particilat reaction to it
We all are bots. 
f"{emoji.name} text" like this
wait
let me explain
async def react(ctx):
for m in ctx.channel.history(limit=1):
await m.add_reaction(":hatbc:")
yep
this is the final code and its not working
hatbc?
i used in <:emojiname:emoji_id>
the way bots process the emoji
but the code is not working
no respone
and no error
Try emojiname:id without <>
no no it works in
async def react(ctx):
await ctx.add_reaction(":hatbc:")```
but i wnat to add reaction on a particular msg
like NQN does
you need to use async for since it returns an async iterator
or if you want it to be a list, use await channel.history().flatten()
how would i setTimeout() this without it sending blank embeds? i removed the setTimeout as its effecting the text being sent
const Discord = require("discord.js");
const fs = require('fs');
const path = require('path');
const charactersPerMessage = 1600 - 50;
const acheats = fs.readFileSync(path.resolve(__dirname, '../cheats/acheats.txt'));
const numberOfMessages = Math.ceil(acheats.length / charactersPerMessage);
exports.run = async (client, message, args, utils) => {
const embed = new Discord.MessageEmbed().setTitle(`The Sims 4 Adult Skill Cheats`).setColor("GREEN");
for (i = 0; i < numberOfMessages; i++) {
message.channel.send(
embed.setDescription(
acheats.slice(i * charactersPerMessage, (i + 1) * charactersPerMessage)
)
)}
message.delete()
}
ok and what did it look like with the setTimeout?
Also are you sure you didn't mean setInterval ?
const embed = new Discord.MessageEmbed().setTitle(`The Sims 4 Adult Skill Cheats`).setColor("GREEN");
for (i = 0; i < numberOfMessages; i++) {
setTimeout(() => message.channel.send(
embed.setDescription(
acheats.slice(i * charactersPerMessage, (i + 1) * charactersPerMessage)
)
), 2000)}
yeah so what's going on here is that you have code that says "hey for each message, after 2 seconds send it" and what it does is, it sends them all at the same time, after 2 seconds 
ya but it doesnt send whats in the txt if i have the timeout
Now, interestingly, the other problem you have is that you will probably need to setDescription outside of the message.send
embed.setDescription("Blah")
mesage.channel.send(embed)
probs due to some async issue
what are you actually trying to do?
it returns the class so that should work
so basically when the txt triggers it sends each embed in like 0.5ms and ratelimtes b4 it finishes all the embeds
Alright. try this. multiply the 2000 by i
so it's 2000, 4000, 6000, 8000
isntead of all being sent after 2 seconds
see if that helps it
itll be this part i do tht for right (i + 1)?
no
the 2000 milliseconds timeout
multiply it
by the i variable
Also, if that doesn't work, add a let in front of your declaration of i, as you should have done to start with, you need let or const when declaring variables in scope
it worked but still sent empty embeds
ya i forgot to add, now thats in its worked with the txt ty

what is php mainly used for
programming
back-end of websites usually
so its a serverside language
well yes there is only one front-end language so all other languages are server side
technically
yes, pretty much
thanks
im looking at this basic hello world
and it looks like some kind of html server side stuff
Hey guys, Im getting an HTTPException due to an error 429 when I run my bot. This error is because I "have exceeded the rate limit frequently". I believe it's because I have many users accessing at the same time, the server number has been growing fast. How can I get around this? My bot is running on repl.it
The only API calls I make are "if message.embeds" and "message.add_reaction"
Could you show your code?
Aaa... seems... yeah, can you try printing the times when the messages that pass the condition are sent?
you mean print on line 30 to check how many times I send the message.add_reaction?
Eh, works too
You could probably print more helpful information like channel ID and current time
I beg, use commands
Im having trouble setting up a subdomain on git jit book
Ive got a subdomain from mod.land and i added hosting.gitbook.io to the CNAME
When i try to set up the domain on my jitbook it says using cloudflare is discouraged and you shouldnt do that. I ignored and pressed next and it threw an unknown error
Any halp?
|| when in doubt, ping @quartz kindle||
Haha hadnt heard about them, looks a lot better, will use that
Discord.js v11.6.4
code : if (!users[person]) { makeUser(person); }
error
TypeError: makeUser is not a function
my code is in v11 so i cant update to 12 rn
then 👀
so update your code to v12 lol
that's such a stupid reason
v11 already started breaking
ok
and most likely, it's going to be fully out of function by the end of the year
Actually it's fully out of function now, the second you hit a server with a Stage channel, it's dead
@prime glacier im gonna purposely add your bot to a server with a stage channel and break it to force you to update to v12

Twitter acces token secret
Twitter user id
Twitter acces token
Twitter consumer secret
Twitter consumer key
Are these necessary to transfer tweets to automatic discord channel?
If my commands are stored like this, How would I get each of the commands in the same category
Description is not final
why does js message.author.send(content) in discord.js return this error:(node:17248) UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown Channel
ive used that before
it should work
i dont get it
How can I check if a arg contains all capital letters in js?
if(message.content == message.content.toUpperCase()){```
thx
idk if the touppercase is correct but vscode intellesense should have you covered
standard js function
so it should
o wait shite uhhh replace message.content with whatever you use to refer to your arg
toUpperCase is for put all sentence in upper case
it works on any string obj, like i said replace where i said message.content with however you call the argument your referring to
you just need to see if string == string.toUpperCase()
ping me if need anything else
i was a green name before disc banned me for no reason
and how i check if sentence have 5 or more caps @near igloo
uhhm
i have try with > 5 but doesn’t work
you need to turn it into an array of characters... 🤔
yeah
thatll work
you could also do uppercase and not have the ! but either works
👍
tho i will warn you @earnest phoenix if you are doing automod, Four Caps Limit Is Really Small.
i dont get why this isnt wrting into the json file as instructed to some of it might be cutting off b4 it gets to the write? no err
const fs = require('fs');
const path = require('path');
exports.run = (client, message, args) => {
message.channel.send('Fetching Servers...').then(sent => {
sent.edit(`I Am In ${client.guilds.cache.size} Servers, Proudly Serving On <https://discord.com>`);
}).catch(console.error);
let guild = client.guilds
let servercount = {
Guildname: `${guild.name} | ID ${guild.id}`
};
message.delete({timeout:10});
fs.writeFileSync(path.resolve(__dirname, 'servers.json'), JSON.stringify(servercount)).catch(console.error);
}
@crimson vapor :
const getCount = sentence.split('').filter(e => e.toLowerCase() !== e).length;
if(getCount > 5) console.log(`No, the sentence have only ${getCount} caps!`);
else console.log(`Yes, the sentence have 5 or more caps. Caps count : ${getCount}`);```
He tell me « yes » but have only 2 and no 5 or more
your log is backwards
it should be but try write it as js ("Guildname: " + guild.name + " | ID: " + guild.id + "guild.id") since you arent even using it as an object
like just replace JSON.stringify(servercount with that
oki
your saying if it has more than 5 caps, log that it has only so many
uh yes lol
bump
welp, so i am trying to get someones pfp and put it in the dashboard as a gif
user3.user.avatarURL({size: 64, format: 'gif'})
the problem is that if this user doesn't have a gif pfp it doesn't show up at all
is there a way through this
Use the dynamic option
thanks!
@earnest phoenix do you know how to parse codeblocks and get what language the codeblock has (in typescript / javascript)
how do I do it
lol
You mean what the codeblock's specified language is?
Like
```<language> <- here?
Code
```
JavaScript or TypeScript? Which one are you writing it in
it might be
do you just use some kind of regex or an npm package
not really
how do you parse types in an eval
the typescript package has a way of transpiling strings that have typescript code to javascript
ah
import * as ts from "typescript";
let code: string = `({
Run: (data: string): string => {
console.log(data); return Promise.resolve("SUCCESS"); }
})`;
let result = ts.transpile(code);
see
function parseCodeblock(input: string) {
const [, language, code] = (input.match(/\`\`\`(\w+)\s*?\n([\s\S]*)\n\`\`\`/) || []);
return { language, code };
}```
is the object just gonna be empty if there are no codeblocks?
how would I check that
lol
If there are no codeblocks it would return { language: undefined, code: undefined }
how to get an custom image on top.gg like the background of your bot preview
like this
ok I see thanks
kinda hot ngl
love it
👍
Can someone help me with the pull request of js.org? Idk what to do
"pull request of js.org"?
The subdomain
Idk what i should do with the pull request
Can someone help me?
I found this bot, https://top.gg/bot/782309258620305438
How is it making the profile picture of the bot move up and down?
ik its the markdown css thing, but a ton of people have it and I wanted to know what it was
It's just CSS, with keyframes and animations, find the div that holds the avatar of the bot and apply the animation on it
um
what language is this lol
'PLEASE GIVE UP'
i
The Compiler Language With No Pronounceable Acronym (INTERCAL) is an esoteric programming language that was created as a parody by Don Woods and James M. Lyon, two Princeton University students, in 1972. It satirizes aspects of the various programming languages at the time, as well as the proliferation of proposed language constructs and notatio...
thanks lol
@earnest phoenix How would you rate this
it may or may not be a little bit ugly
but I tried my best ok
its the code for my eval command
lol
Not that bad, wanna see mine?
Type checks moment much?
juuust a little bit
if (typeof output !== 'string') output = util.inspect(output)
output = output.replace(/`/g, `\`${String.fromCharCode(8203)}`).replace(/@/g, `@${String.fromCharCode(8203)}`)
I added this now
to my code
lol
forgot that you had to do that or something
well whatever I have it now
time to wait 10 minutes or less for docker to build and run my bot
its a docker compose file with my bot container and a mongodb container
lol
cuz yes my bot is completely dockerized
docker ontop
Bump
guys i have a paragraph in my web and i want when the button is pressend add 1 to that paragraph like
clicks
1
clicks
2
Don't ping people, they're not here to help you 24/7
I like the "let's ping the person that keeps telling me to google and learn shit, surely they will help when I call!" Attitude.
feels like a help vampire lol
The Help Vampire problem is the idea that some users will continually ask the same tired questions in the hope that someone else will do their work for them, irrespective of whether the same question has already been asked or whether they could easily find the solution elsewhere.
maybe not the part with the continually asking the same questions
but defenitly the last part
lol
I recommend you to search ur question using a search engine first and then asking here
maybe ur bot doesn't have a dm channel open which is why it says Unknown channel
lol

not rly sure tbh
u right
use message.author.createDM()
I think
idk if thats the method
lol
u can find what method it is in the docs
But I never had to do that before 🤔
well its good to do it anyways
I’ll try it tomorrow when at pc, tysm
at least try it
message.author.send works for me

maybe just a weird quirk idk
Would the bot having gotten verified change that by any chance?
Cuz that happened recently
uh what
Mines verified and the message.author.send way works for me
Not sure if this even matters for being able to send users DMs but does your bot have both intents enabled
It has members but I had to disable presence for discord to let me verify
Also try making your bot dm a user it hasn’t dmed before?
it really doesn't
lol
Idk who to DM
@near igloo I would suggest just adding a try catch block to send a message to chat so the user knows it failed to send the dm
lol
It doesn't have to do with intents since DMs are handled by REST
Make a temp alt (don’t even have to email claim it) and try dm it
dm yourself through the bot ez 
can someone help me with lua
😔
🚽
💩
@earnest phoenix
We are trying to make the bot dm someone it hasn’t before
the person should be in your server
@near igloo Still worked
Lmao I was just testing with my eval cmd
Hmmm idk then.
message.author => the author of the message in the server 
are you trying to dm someone outside of your current guild 
But everything coming from my ip doesn’t. Sus.
user objects have data only related to thier accounts
member objects only have data related to the server
well yeah
No I’m trying to make it dm anyone. The bot hasn’t dmed anyone before.
I just use .catch(e => {
Lmao yes ik what it is
did i say anywhere what it returns i mean sorry i couldnt explain it better lmao
but yeah u shouldnt have problem to dm people
yes
also typescript oop
Yea idk why. Maybe discord is sus of my ip.
It if was you wouldn't be able to do anything
DMing a user works fine as long as the user shares a guild and hasn't blocked your bot.
It doesn't require any intents.
discord doesnt really lock ips - only tokens on alot of ratelimits or when u get server banned
Whelp go to my initial message to see my error
Ye I get rate limited a lot
I'm confused as to why it's an Unknown Channel error though
If it couldn't DM the User you would get "DiscordAPIError: Cannot send messages to this user"
Yeah, and I would be fine with that
Show the full command or event code related to what produces this.
Wait so are stage channels audio streams the same as voice channels?
Yea it’s just when I run it alone In my eval cmd “message.author.send(“sex”)” I get the error
yeah they should be.
I’m legit running the dm cmd by itself
and thats why more people should use typescript
show your eval command then
Not at pc
when you are, let us know
But it’s basic eval and send results
So would the only difference be sending it to a stage channel?
hi
I assume so
When moving a music bot into a Stage channel with it already playing music it still plays the audio
Then yeah its the same
its the identifying them part and there attributes because they have more
stage channels are just glorified voice channels
hi
Eh ima just edit djs to have it work with stage channels 

where the hell are the stage channeld ocs
problem with stage channels is u cant give members specific perms if u want to have an event where someone can mute or unmute u have to five the person the manager role which gives them all perms for the vc 
wait were docs not updated yet?
aren't deployed on stable site but are on the github 
ikr 
this is what my code looks like when transpiled. tsc added some funcs for importing. I assume what it means import * as Puppeteer is that correct? That's probably reason why i had to put .default
Then it's like Erwin said
import() is different than import
It works the same as require or import * as something
Yeah thats what I am saying
naughty
I mean
You can't set them
To nsfw or not
I got kinda scared when I saw nsfw for stage channels lmfao
could be a bug/oversight
Eh
the docs are still not merged
djs master has a PR for stage channels
Ik
xD
they are just delaying it because the api docs are not finalized
djs never merges until discord merges the docs for it
Do you by chance know where this pr is
I may be blind
nvm
its literally the last one
xD
djs is pain
everytime they change stuff i have to study what they did to make sure it doesnt break djslight
xD
there a way to make a inventory command using an array?
there's duplicates in the array and I want it to appear as
item — item_count
and not
[item, item, item2, item, item]
better use an object
You should probably use an object instead then.
There, the 2 proficient people agree.
unless your inventory doesnt join items of the same type
if you want to display all items separately, including duplicates, then use an array
its already an array
if you want to show item count, use an object
no
Well they should 
how do you know there are duplicates then?
you have to have something to identify them
That's not answering the question
same name
alright
so use the name and create an object
like this
{
item1: {
... data about item one,
count: 1
},
item2: {
... data about item two,
count: 42
}
}
instead of having item2 42 times in an array, you have it once with a count field
what language is that
what language are you using?
python
ok but how would I add to the count and if its there
access it and increment the count
idk how python does it, but should be something like variablename[itemname]["count"]++
I Cant Get This To Write In The Assugned File (File is in the same place as index)
const fs = require('fs');
const path = require('path');
exports.run = (client, message) => {
message.delete({timeout:10});
message.channel.send('Fetching Servers...').then(sent => {
sent.edit(`I Am In ${client.guilds.cache.size} Servers, Proudly Serving On <https://discord.com>`);
}).catch(console.error);
let guild = client.guilds
fs.writeFileSync(path.resolve(__dirname, 'servers.json'), ("Guildname: " + guild.name + " | ID: " + guild.id + "guild.id"));
}
assigned*
what kind of fuckery is this
This
the parenthesis are not needed
you're storing a string, which is not valid json
you're overwriting the previous file every time that function runs
idm the overwrite as thats what i would expect, but its not writing anything when executed
also your guild variable is incorrect
client.guilds is a GuildManager object
it doesnt have name, nor id
its a container for guild functions
if you want the current guild, use message.guild
your json file could also be being written in the wrong location. try console.logging the output of the path.resolve function to see what is the actual path being written
o: tht might be why its not writing, and the goal of it is to log the server names the bots in so i can use that files to call in a later command
you dont need to store that kind of information in a file
it is always available in the client
oh ive tried getting names in a list and its became undefined
likely because you did it wrong
i used the "client.guilds" i think and that what returned it as undefined
yes because client.guilds is not a guild
there are several layers in discord.js's data structures
client -> contains everything
client.guilds -> contains functions to deal with guilds
client.guilds.cache -> contains list of guilds in a Collection
oh
client.guilds.cache.get(id) -> gets a guild from the list using its id
client.guilds.cache.find(guild => guild.name === "guildname") -> gets a guild from the list using one of its properties, for example its name
you can check here for all the things you can do with a Collection, which is the data type used to store lists of stuff in discord.js
so this would return the server list?
exports.run = (client, message, args) => {
client.guilds.cache.forEach(guild => {
message.channel.send(`${guild.name} | ${guild.id}`);
})
}
yes, but in a separate message for each guild
..
that's not good you might hit rate limit
I wouldn't recommend this
Gonna get ratelimited really quick
If I store commands like this, How would I get the commands that are labelled under the Music category specifically http://you-are.cringe.tf/NgqkAVm8
ik i have "setTimeout()" on it so i should be good?
ive tried googling how to use a pagintor style but i get nothing related to ym search
is clieint.users.cache also per shard
its per process
if you use the sharding manager, then it is also per shard as each process is one shard
commands.filter((c) => c.category === 'Music')
does anyone know windows good here?
I need help please I am so mad
I've been trying to sort my desktop icons
for like 1 damn hour
but everytime I try to align my desktop icons together they mix up
is it a virus?
I tried googling it, found nothing
Imma record it
I'm ready to send it. is anyone here
No
C:\Users\--\Desktop\Software\Bots\Discord\Genshin Bot\GenshinCardBot\Genshin-Impact-Discord-Bot\bot.js:10
const client = Discord.client({ shardCount: "auto" });
^
TypeError: Discord.client is not a function
at Object.<anonymous> (C:\Users\--\Desktop\Software\Bots\Discord\Genshin Bot\GenshinCardBot\Genshin-Impact-Discord-Bot\bot.js:10:24)
at Module._compile (node:internal/modules/cjs/loader:1083:30)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1112:10)
at Module.load (node:internal/modules/cjs/loader:948:32)
at Function.Module._load (node:internal/modules/cjs/loader:789:14)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:72:12)
at node:internal/main/run_main_module:17:47
C:\Users\--\Desktop\Software\Bots\Discord\Genshin Bot\GenshinCardBot\Genshin-Impact-Discord-Bot\node_modules\discord.js\src\sharding\Shard.js:158
reject(new Error('SHARDING_READY_DIED', this.id));
^
Error [SHARDING_READY_DIED]: Shard 0's process exited before its Client became ready.
at Shard.onDeath (C:\Users\--\Desktop\Software\Bots\Discord\Genshin Bot\GenshinCardBot\Genshin-Impact-Discord-Bot\node_modules\discord.js\src\sharding\Shard.js:158:16)
at Object.onceWrapper (node:events:434:26)
at Shard.emit (node:events:327:20)
at Shard._handleExit (C:\Users\--\Desktop\Software\Bots\Discord\Genshin Bot\GenshinCardBot\Genshin-Impact-Discord-Bot\node_modules\discord.js\src\sharding\Shard.js:384:10)
at ChildProcess.emit (node:events:327:20)
at Process.ChildProcess._handle.onexit (node:internal/child_process:277:12) {
[Symbol(code)]: 'SHARDING_READY_DIED'
}
hey, someone know what is the properties for stage channel??
what lang
discord.js
k
oh, okay
https://deploy-preview-551--discordjs-guide.netlify.app/additional-info/changes-in-v13.html v13 looking pretty pog so far
so i am trying to make multiple prefixes and this is the code i have but it only works with that one prefix till i rerun the code, how do i fix this?
client = commands.Bot(command_prefix='L.' and 'l.' and 'L?', intent=discord.Intents.all())
I am confused af, tf does this error mean:
[21-04-11 04:27:18.913] ERR RangeError [MESSAGE_NONCE_TYPE]: Message nonce must fit in an unsigned 64-bit integer.
[21-04-11 04:27:18.913] ERR at APIMessage.resolveData (./node_modules/discord.js/src/structures/APIMessage.js:155:44)
[21-04-11 04:27:18.914] ERR at TextChannel.send (./node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:166:62)
[21-04-11 04:27:18.914] ERR at eval (eval at run (./src/Commands/owner/eval.js:30:16), <anonymous>:5:13)
[21-04-11 04:27:18.914] ERR at runMicrotasks (<anonymous>)
[21-04-11 04:27:18.914] ERR at processTicksAndRejections (internal/process/task_queues.js:97:5)
[21-04-11 04:27:18.914] ERR at async eval (eval at run (./src/Commands/owner/eval.js:30:16), <anonymous>:4:2)
I never got it before
pls ping
Do you know what and does
>>> "q" and "w"
'w'
Pass a list into it instead
also it's intents, plural, not singular
Hey I wanted to ask something
My bot have custom prefix system
I set if anyone mentions bot it's tell prefix
I use this.client.prefix but If they changed it. it gives same how to output what they set ?
Wait i dont - its still v12.5.3 for me
because it isn't released fully yet
How to make command like this
assuming you're using js, you could make an array with .split(",") then pick a random element of that array
easy way for discord.py:
import random
@commands.command()
async def pick(ctx, sets: str):
arr = sets.split(",")
resp = arr[random.choice(arr)]
await ctx.send(f"I chose {resp}")```
random.choice() returns an element instead of an index
good point
@commands.command()
async def pick(ctx, sets):
await ctx.send(__import__("random").choice(sets.split(",")))
ez
i got 3 hours of sleep leave me alone 
i totally knew this

lmao
damnit. my logging event isnt working now. thx for showing me that lol
I would suggest just sticking with v12
untill v13 gets released
don't use Master unless ur just trying to experiment with it
lol
hey. anyone know how i can get the id of the channel i just created?
can somebody help me with discord-passport refresh?
alr so i was making a bot which prevents nuking. basically u can backup channel data like type and name of channel in a database. but i am unable to get channel overwrites/ channel perms for @everyone role. Could someone help me out?
my code -
let array = {}
let array2 = []
let channels = message.guild.channels.cache.array()
for (const channel of channels){
try{
array[channel.name] = channel.type
// array2[channel.name] = channel.permissionOverwrites.get("830707988988690442")
let p = channel.permissionsFor(message.guild.roles.everyone);
console.log(p)
}catch(err){
console.log('array error')
message.channel.send('An error occoured while getting the channels.').catch(() => {})
console.log(err)
}
}
this just gives me a permission bitfield when i print the variable p
permissionOverwrites.get should work
How to add commands in bot bro
u cant troll with that bot dev role
gives it away
alr imma see
lmao
it give undefined
i tested
with the guild id as the key?
it saves channel type in my db
heres what i did
let p = channel.permissionOverwrites.get(message.guild.roles.everyone)
channel is perfectly defined
try get(message.guild.id)
cause it saves channel type and name in my db. but fails to do so for perms
alr
i got this as an output for @everyone when i used guild.id -
PermissionOverwrites {
id: '830707988988690442',
type: 'role',
deny: Permissions { bitfield: 0 },
allow: Permissions { bitfield: 52289 }
}
how could i convert bitfield into the name of the perm?
should be in the docs
alr thanks i ll look into it
toArray() and serialize() i think
oke
@quartz kindle thanks for the help it worked
i did -
let p = channel.permissionsFor(message.guild.roles.everyone).toArray();
console.log(p)
👍
but the permissionsFor includes role permissions as well
its not only the channel overwrites
!play гимн ананимусов
Guys how was it to erase all reactions from the message? I couldnt find it
hey, so I have this really weird problem with my discord bot:
the log below is from my bot and the timestamps are the dates when the event happened and the bot is running in a linux screen (screen -AmdS bot python3 ./bot.py)
you can see that member counts get updated every 5 minutes but somehow they stopped after 22:35 yesterday. This morning I noticed my bot wasn't responding so I checked the screen and in the moment I opened it, it began to work again (as you can see in the last three entries)
I had that problem multiple times already some months ago but it stopped when I began to reboot my server every time I updated it. I don't know what to do and that's a fatal thing to happen so I really gotta fix it somehow
[10.04.2021 22:10:00] updated member counts
[10.04.2021 22:15:00] updated member counts
[10.04.2021 22:20:00] updated member counts
[10.04.2021 22:25:00] updated member counts
[10.04.2021 22:30:00] updated member counts
[10.04.2021 22:35:00] updated member counts
[11.04.2021 09:16:50] updated member counts
[11.04.2021 09:16:56] reconnected...
[11.04.2021 09:16:58] on_ready triggered afterwards
[11.04.2021 09:21:50] updated member counts```
yeah i got it. What i did was. Get channelOverwrites of everyone role. and then sorted out only the allowed ones. did toArray() on them and sent them to by database. thanks
is there a way to give my bot every permission or do i need to write every single one?
allow: ['ADMINISTRATOR']
its in a channel
This is my code - https://i.imgur.com/LF6qKXU.png
Preview - https://i.imgur.com/5Nwa1cJ.png
I want it to go to line 2nd, what should I do?
to break line use \n
Ok
example?
just replace \n with <br />
\n is js
<br /> is html
ye
yea
ok ty it worked
np
but for real. do i need to list ever perm?
thats stupid
okay. done. lol
8
really?
how does that make sense?
omg. for the last time! im in a channel!!
i cant use administrator
you give administrator in a server. not a channel
okay. i figured it out
can bots see screenshares?
Yes ik
How can I do my anti-spam? With each message it is stored in the database?
If you recieve too many messages events in an interval do your stuff
Clear the message count in every interval
hum ok thx
const discord = require('discord.js')
module.exports = {
name: 'quiz',
run: async (message, args) => {
const quiz = require('./quiz.json');
const item = quiz[Math.floor(Math.random() * quiz.length)];
const filter = response => {
return item.answers.some(answer => answer.toLowerCase() === response.content.toLowerCase());
};
message.channel.send(item.question).then(() => {
message.channel.awaitMessages(filter, { max: 1, time: 15000, errors: ['time'] })
.then(collected => {
message.channel.send(`${collected.first()} is correct`);
})
.catch(collected => {
message.channel.send('> :8ball:Looks like nobody got the answer this time.');
});
});
}
}
In my quiz.json I added a hint section , not how to I make it so if a member cant figure out the answer they type +hint for the bot to send hint
u could just listen for +hint in await messages event
@frigid mountain botinfo.js please give me code
?


Do you need the members intent to check how many users is using a bot in discord.py? This is to show how many users are using a bot
Would {len(bot.users)} work?
that would be how much users that are cached
I think I got it to work now, I don't need the members intent now
I had to Try it and See
for an accurate count you would need every single member in every single guild cached
or you can just combine the memberCount (or member_count, i forgot dpy's naming style) of your guilds which will give you a rough estimate
it's snake case, yeah
I can't login to the bot. There is no error, but I cannot login. (T0ken Correct)
What is your line of code when u trying to connect?
bot.login(token)
I know it's like this but it doesn't work
did you define bot?
i smell a copipaste
Yes I defined as Client
you defined bot as client
show the error
why not just define client as client and use client instead of bot like a normal person
show me.
likely
const Discord = require("discord.js");
const client = new Discord.Client({
partials: ["MESSAGE", "CHANNEL", "REACTION"]
});```
what do you mean
are you sure the bottoken is correct and valid?
huh
yes
show us your code
did you say you used bot.login?
show the full code
this is why i think its a copypasta
yea
I am using client login
you said you used bot
show us your fucking code
There is no problem with the project
It works when I put another token
omg. then the token is obviously not valid
then the token is wrong?
send us the token
we will try
and if it works, we will tell you
then regenerate the token and put the new one
@river panther stop trying to get the token. we arent supposed to give that out
this
i was just checking if he has a basic knowledge of bot making
doesnt seem like it
@raw cloud
Please add the following code to your code base outside of any other event listeners and provide the full log output relevant to your issue.
client
.on('debug', console.log)
.on('warn', console.log)```
Note: if you initialize your Client as bot or other identifiers you need to use these instead of client. If the output is too long to post consider using a bin instead
<https://gist.github.com/>, <https://paste.nomsy.net/>, <https://hasteb.in/>, https://sourceb.in/, <https://hastebin.com/>
ok ok
somehow has the bot creator role tho
A Problem With This Discord Is When I Try Other Tokens But This Doesn't Get Into My Fucking Token
?
what
?
what
just regen the token and try
aww man, your last pfp was so good
yes but iv had it for years
I said...
Broken english moment
but it was good ;-;
uwu
oui
@raw cloud -> #development message
Kinda sus
yes
ok
?
Visual Studio Code rich presence client
how
Oh nice
this extension
Okay
thank you
ok
breh
lol
some use the Discord Developer License to do similar stuff
Just use Discord SDK
like erwin
i never really understood what is the use of the developer license
its usually for direct Discord integration into games
Is there a way to set a bot's prescense like that?
ah, so we bot developers don't have any benefit from it, right?
nooop
they can advertise with it
I've seen some users have custom rich prescence like it links to a website
since they can invite your bot over your presence
xD*
Publishing your applications or games represented in discord by making announcement channels (deprecated) and store channels and anything similar
i simply want it so people can see what im doing lol
Discord Developer License is basically useless pretty much nowadays
Whats it do? Lmao
Yes but it didnt seem like a game, as if they uploaded their own inage, text etc
Many people bought it for creating announcement channels but you can create them for free now
i can also do that
i know a few games that use it and its a nice gimmick, like you can invite people over the chat like the Spotify integration
go to rich presence of your bot and upload the images
yes
Ah
hardly 20 line code
No way to do it only from code? 
the dev license became useless with the removal of the game store
Discord RPC is deprecated
yes ik
I want to setup a hint command for the +quiz {so when the bot sends a random quiz if you type +hint the bot will send the hint for the random quiz}
https://srcb.in/iii4ZVyg11
https://srcb.in/yqNXc01V8o
you need to give seperate ids for the questions
Get the array value of the quiz question and use a key value pair array
Or is it an object
i didn't see it was an array
Pass in a filter that accepts +hint as the collected message same with the correct answer and see which one was chosen
use a seperate id, because filtering the questions and stuff will be slow
Like a discord collector?
const filter = ({ content }) => content.toLowerCase() === '+hint' || content.toLowerCase() === /* correct answer */;```
If you want to do it like Voltrex said you'll have to change your logic a bit and use a listener instead of awaitMessages
Basically, at the end, you gotta see which one was chosen

And yea, for this, you gotta use a collector instead of waiting for messages
How do you setup the custom buttons? I assume in the extensions files? @river panther
hh. im very annoyed and reactjs&expressjs is killing me
ah
express is easy, but react is annoying
express is killing me
ReactJS and expressJS is forbidden in the same sentence
lol ever heard of MERN?
lol
The hell is mern
its mern
Mongo Express React Node
wtf
its a full stack
app gon run like a snail
How can i make that my bot leaves every server in js?
What lib
how the hell am i supposed to let people login to my dashboard with their discord accounts so they can modify the servers they are moderators in 
discord.js
run a loop over the guilds manager and call on each guild .leave()
js isn't as powerful in the full stack department, backend easily gets outperformed by other languages like rust and c#
that's why companies use different languages to create their app, every language excels at something
Hello friends , my bot cmds all work , but whenever I have to ping a user nothing happen no errors nun still all , something wrong with my bot?
or just delete the Application in the Discord Developer Page
Just use Promise.all() and pass it and array of promises, loop over the guilds with using <Collection>.map() on <Client>.guilds.cache and call <Guild>.leave()
can you show some code
@river panther any chance you know how?
not everyone learns rust or c# out of fun on it.
Node.js is good for startups
...i know lol? i was just stating examples proving that js is sluggish asf for backend
also GO is probably a bit better for the backend than rust, since its relatively robust api wise. (atleast what ive read over it)
@candid harness https://paste.pythondiscord.com/difumecucu.py
client.guilds.cache.forEach(g => g.leave()) right?
Like when I do !user @short wraith it doesn’t work
but its still better than running everything in php right.
um
good point
can you paste code in here
Use oauth2
js is amazing for frontend, not so much for backend
That could also work but that doesn't wait until the promise is fullfilled
use oAuth and check permissions
@earnest phoenix your bot code doesnt make any sense
Read the discord developer documentation
did you know how to use oAuth?
(can recommend using passport and discord-passport if you use js)
New kick command!
i dont even know what that is
well then look it up, makes oAuth extreme easy
Oh no
i can literally read the simplest thing but i wont understand it
Is that an npm package
yes
i need someone to explain it to me lol
h
the docs are ok
okay. ill try
https://www.npmjs.com/package/passport-discordapp this is for the discord oAuth
but yea its pretty much outdated lol
okay
wait its the wrong one i think
lol
stupid devs, adding packages and let it rot, doesnt care if someone picks it up and notices to late its outdated
i literally dont even understand what im looking at here
isnt it obvious
Just don't use them, you can google how oauth2 flows work, and create a web-server based off of what was said
huh
imagine using libraries 🤮
nope sorri
It is too easy to create those flows if you understand them with using things like the built-in https module or the express to make it easier
does anybody know how to get the username and the avatarURL from the user who types the SLASH command?
.setAuthor(message.author.username + "'s command result.", message.author.avatarURL())```
like this when it's just message detection ^.
;-;
thank youuuu :)
BUT I DONT UNDERSTAND THEM!
i gotta find how tho
learn?
i cant learn when i have noone to teach me
Like I said, you could google how the flows work
i cant just type and hope for it to explain itself
literally read docs
google is a caotic mess of which only shows fake bullshit
I BLOODY DID!
Are you a self-taught programmer? If the answer is yes you should probably be able to teach yourself
if u dont understand them then u dont know shit about js
@vernal moth <InteractionResponse>.member.user.avatar
You can change avatar to username for the username
in worst case look for a youtube video that is not 3 years old
what can i replace the <InteractionResponse> with?
The interation object returned from whatever event you're using
I assume you're using discord.js right?
wait lemme try
yup :)
<Client>.ws.on('INTERACTION_CREATE', async interaction => {
// ...
});```
oof
(node:12256) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body```
You're probably sending invalid data while creating a slash-command or responding to one
const Embed = new Discord.MessageEmbed()
.setAuthor(interaction.member.user.username + "'s command result.", interaction.member.user.avatar)
reply(interaction, Embed)
})```does this work fine?
reply goes to the...sending process.
Here is the sending process. sorry if it looks like a wall of code
const reply = async (interaction, response) => {
let data = {
content: response
}
if (typeof response === 'object') {
data = await createAPIMessage(interaction, response)
}
client.api.interactions(interaction.id, interaction.token).callback.post({
data: {
type: 4,
data,
},
})
}
const createAPIMessage = async (interaction, content) => {
const { data, files } = await Discord.APIMessage.create(
client.channels.resolve(interaction.channel_id),
content
)
.resolveData()
.resolveFiles()
return { ...data, files }
}```
npm ERR! code 1
npm ERR! path D:\OneDrive\Bureaublad\chess\node_modules\canvas
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@14.16.0 | win32 | x64
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
npm ERR! gyp ERR! stack at PythonFinder.failNoPython (D:\OneDrive\Bureaublad\chess\node_modules\node-gyp\lib\configure.js:484:19)
npm ERR! gyp ERR! stack at PythonFinder.<anonymous> (D:\OneDrive\Bureaublad\chess\node_modules\node-gyp\lib\configure.js:509:16)
npm ERR! gyp ERR! stack at callback (D:\OneDrive\Bureaublad\chess\node_modules\graceful-fs\polyfills.js:295:20)
npm ERR! gyp ERR! stack at FSReqCallback.oncomplete (fs.js:183:21)
npm ERR! gyp ERR! System Windows_NT 10.0.19042
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\OneDrive\\Bureaublad\\chess\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd D:\OneDrive\Bureaublad\chess\node_modules\canvas
npm ERR! gyp ERR! node -v v14.16.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
Anyone knows how to fix this error?
Can't find Python executable "python", you can set the PYTHON env variable.
It says you don't have python installed
in env variables
is the problem here maybe?
did you added python to the path?
Have you even tried logging data
the avatar one gave an ID. not a URL that it's supposed to get
The avatar property is the hash of user's avatar
i guess :/
People get toxic quickly 
yes
lazyass
Lazy ass? How so
not u
im just gonna spamm my keyboard hoping something happens
Dont come in here & start yelling at people because they said "I dont fully understand..."
welp. avatarURL didn't work either
https://cdn.discordapp.com/:userID/:userAvatarHash.extension
ait tell me something
they threw a hissy fit here multiple times because they got told to read the docs lol
toddler behaviour
how are you supposed to understand something if you dont read trough its docs or learn it
He literally said he did, no?
you can omit the extension, discord will return the appropriate extension automatically
node module?
clearly didnt read enough
what
they didn't, they just say they did lol
is this link a node module link?
Oh of course, lol
cuz it doesn't work on my browser
😐








