#development
1 messages ยท Page 1375 of 1
O_o then should have mentioned it in first place. We are normal people
Ooh u need to set the fields in the promise
the servers still have its default value on bottom part of the code
i was looking on a stack overflow thread for checking memory usage, and the top reply was this
process.memoryUsage().heapUsed / 1024 / 1024;
why are they dividing it by 1024 twice
process.memoryUsage().heapUsed gives the amount in bytes
divide by 1024 twice and you get megabytes
is 8.069923400878906 bad?
depends
y r u so worried about, memory usage?
because im hosting it from my pc
yeah you probably have nothing to worry about with that little usage
and i dont want my bot effecting my preformance
I also host my bot on my own laptop. 24/7
obviously not.
oh
node handles that stuff automatically
also if you are coming from c#, you can code ur bot in typescript. For type checkings and stuff. Normal js is so bad in that
i prefer discord.asm
but that is built on python. Previously u said, ur working in js
dude
its a joke
discord.assembly
i was making a joke that i scripted bots in assembly
LOL, and I started googling, about discord.asm
wait
if process.memoryUsage().heapUsed returns byte memory
and divided by 1024 2 times = mb
what is it divided by 1024 1 time
kilo byte?
yes
wdym
when i put it in an embed, it doesnt do the spaces
Use invisible characters instead of spaces
if (!message.member.hasPermission("MANAGE_GUILD")) return is not working anymore suddenly
Hello, i want to change vanity invite using a bot, it is possible?
My code
fetch = require('node-fetch')
fetch('https://www.discord.com/api/v6/guilds/762359120031907871/vanity-url', {
method: 'POST',
headers: { 'Authorization': 'Bot ' + client.token, 'Content-Type': 'application/json'},
payload: JSON.stringify({
"code":"test458"
})
})
.then(res => res.json())
.then(json => { console.log(json)})
i have tried with a request, but it returning only the code
{ code: 'invitecode', uses: 0 }
i think it's the PATCH method, but the api returning 405: Method Not Allowed so i'm not the sure on the method i need to use
WTF DUDE HAVENT YOU HEARD OF DISCORD.JS?
?
There is an npm package for discord bots
and you're here trying to run a discord bot using node-fetch
:xd:
No i'm trying to change the vanity invite
using the rest api
Because discord.js doesn't have the changeVanity function
ah
that makes sense
haven't found anything about changing the code on the docs
but i think guild.edit can help?
create an invite then if it does not mathces the string, it will delete the invite, then creates another one until you hit the perfect code?
yes that will take years
I would like if someone teach me to learn programs in order to make bot
I'm newbie
It's my job to make programming
@tawdry arrow https://discordjs.guide/
K
How do you code Discord Bot using Lua??
learn lua and use a library like discordia
@rocky hearth thanks i have to learn javascript i might buy javasxript from amazon
js is expensive on amazon
I'll check
Why why why
I learnt complete js in 1 month without spending a single penny. I was having prior knowledge of C++ though.
@tawdry arrow You might as well spend money on personal JS lessons at this rate. You can learn JS from multiple sources without spending a single cent
I've learned Python, C#, basic JS, HTML and CSS by relying on multiple free sources instead of buying stuf
@slender thistle is python better ?
Strongly depends on what you want to use it for
i have some code that checks if a member can be kicked with a catch block and it catches but the rest of the code still runs (sending the kicked embed and saving the case into the database)
did you add a return keyword?
yup
can you show the code?
heres the relevant code
person.kick(reason ? reason : "No reason given").catch(e => {
console.log(e);
return msg.channel.send({embed: {
title: "Uh oh...",
description: "A' was unable te kick that member",
color: "#FB524F",
footer: {text: msg.author.tag, icon_url: msg.author.displayAvatarURL()},
timestamp: msg.createdTimestamp
}});
});
msg.channel.send({embed:{
title: "Kick",
description: `${person} has been Kicked | Moderator: ${msg.author}\nReason: ${reason ? reason : "No reason given"}`,
color: "#FB524F",
footer: {text: msg.author.tag, icon_url: msg.author.displayAvatarURL()},
timestamp: msg.createdTimestamp
}});
const kick = new Case({
findID: msg.guild.id + person.id,
userID: person.id,
guildID: msg.guild.id,
caseType: "Kick",
reason: reason
});
const kicked = await kick.save();
console.log(kicked);

unless i cant see it and its super obvious
so the problem is that it is executing when it is not supposed to?
yeah
js is wack sometimes
oh did you try putting the kick embed in a .then() instead of the .catch()?
the .catch() is used for error handling. so if there is problems it will skip the .then(), and execute the catch method, else it would run the .then() and skip the .catch()
@gilded ice use try/catch intead of thenable. The rest of the code will run irrespective of the catch method
I mean either option is workable, just depends on what they choose to do it. From what I remember .kick() is a promise so .then().catch(). If it wasn't a promise then yes a try catch would be better. Like I said either one is workable
???.... try/catch do work with promises too
Yes I didn't say it doesn't
I mostly use try/catch when I immediately want to return, when there is an error. ๐
What is the response from dbl.getVotes()?
Yes, but at the same time it would do that with a thenable, since usually you just error handle in it, or your logging it. If you want an immediate return then if statements is the way to go 
hey
can anyone tell me how can i make a mute command that supports limit like after that much time the user will be unmuted again ??
@upper crescent You can create a Mute role in ur server. And have that assigned to the member. And remove it after some time
client.setTimeout(() => member.roles.remove(<RoleResolvable>), 60000);
it will unmute the member after 1min
but if i stop my bot then ??
then it wont work
i am using golang btw
for that u need to setup a database
yeah i thought that earlier
so what do i have to store in the database
the time at which the user will be unmuted ??
yes. Then you u've to calculate and create the timeouts again in ready event
For each user in the database
hmmm
for each user in the database
so i have to add handlers at ready event handler function and call it for each user who is muted ??
Yo is there any way to fimd a server by it's id in the cache of the bot?
client.guilds.cache.get()
you don't remove the cache
you remove the role itself, roles.remove(role)
it's an API call so it has nothing to do with cache
ooh sorry, there's also no method on cache to remove anything ๐
Where can I add my bot 
there is, since it's a collection. it takes an id but it only removes the role from the cache
it's not what you want to do
@earnest phoenix Most probably in your own server
Don't lie, u didn't say that
Yes, you can. But you've to ask the moderators
<@&304313580025544704> Help me plz
-atmods @earnest phoenix
@earnest phoenix
Please do not mention (ping) more than one or two moderators for help, unless there is an emergency.
Here are some examples of emergencies:
- Raids / Multiple members mass spamming.
- Severe disruption of Discord's ToS (NSFW content, etc)
- Anything that requires more than 2 moderators to handle.
I want to add my bot
grr
Thank
@modern sable is it too late to ask to get demoted
Hey people i am having problem in discord developer portal (the caching issue and the assets appearing after a long time) y'all got any idea how to fix it
I know not a top.gg problem, but if y'all can help
I feel pity. ๐ฆ sorry
I feel pity. ๐ฆ sorry
@rocky hearth yeah man, this is a problem from discord's side, searched the whole net and found nothing, what a shame
Alright if someone has a solution Pls ping me or dm,
Both open!
@dense karma right click on the reload button in chrome then press clear cache and hard reload
๐
I'm using that image, to find my key. Its too dark here
I'm using that image, to find my key. Its too dark here
@rocky hearth you fucking smartass that is an illegal use for light mode
can I get someone to help me :>
What language are you using
english
LOL
Coding language ๐
everyone understands english i think
ok so?
you can help me with this kind of embed?
visual studio code?
yes
wow great move
english
Python,js
discord.js
Okay so JavaScript
oki
Great place to start for discord bots
What language are you using
english
Coding language ๐
everyone understands english i think
you can help me with this kind of embed?
What programming language
hm
visual
i installed visual and node
@knotty basin ahhh yes you are definetely mr genius
However If you donโt have knowledge of the actual js language
This is now going on reddit
Then id start somewhere far away from discord bots
@knotty basin Please read and follow this guide, to get started in developing the bot
https://discordjs.guide/
You have to code an embed in a bot yes
how do i remove the "8ball" in the question section thingy
making a discord bot, requires you to have knowledge of some programming language @knotty basin
how do i remove the "8ball" in the question section thingy
@hazy sparrow splice out 8ball from args
so you guys help me for the commands or just me?
hey guys how do you find the indexes of documents in a collection? in mongodb
Unfortunately we wonโt spoon feed you a tutorial but all the info is on the docs
its returning only 1 index
console.log("indexes:", indexes);
// ...
}).catch(console.error);``` im using this
so you guys help me for the commands or just me?
@knotty basin We will help if you have questions or errors, we will NOT spoonfeed you code
how to create folder on glitch.com
When creating a file I believe you put it like folder/file
But this will cover more than my 5 second google knowledge
why are u using glitch but?
i think glitch is only for roblox and stuff
@knotty basin bro do you even know how programming works
no?
lol
yah ill do my best
there's a learning curve ๐
then it's not a good idea to start bot development now
even for us haha
ill do research
learn programming for a few days or weeks then when you're confident get into bot development
google is beside me
trust me it will be a lot better
You can learn by making discord bots
im tryna making bots like rn
you'll find a lot of problems and challenges but
you can always read docs while coding
You can learn by making discord bots
@ionic dawn yes but this guy literally has no experience with programming so it will probably be a lot worse for them
wait what code again for the prefix?
You don't need to take any course before starting with bots (even tho is better), but you'll need to learn javascript while coding your bot in order to complete your bot functions
like, if you want to make a moderation bot and want to store x data you'll learn sql/mongo and some specific javascript
wait what code again for the prefix?
@knotty basin there is no single "code" for prefix there are only examples. Your own method you figure out on your own
@earnest phoenix I first started with python/javascript with 0 idea, and learning while making the bot make it easier, you learn what you need/want
its less frustrating or bored.
@earnest phoenix I first started with python/javascript with 0 idea, and learning while making the bot make it easier, you learn what you need/want
@ionic dawn does that mean i wasted my time learning javascript for 8 months cuz i wanted to make a bot?
No
is it const prefix = "!" ?
that means you take another way to learn
is that right or nah?
@knotty basin read my message again
kk
In my case I didn't want to learn much of javascript cause I was at school and I was just having fun with bots, but if you want to work in a real project yeah you should learn general javascript
again it doesn't really help you if we give u the code directly
Studying while coding is the best way to learn "In my experience", you'll keep more information if you put it on practice
reading docs randomly dsnt make any sense and you wont remember everything
Do you guys can reference me some links where I can learn how to customize my top.gg page on my Discord bot?
also im saying this again, you should have at least a little bit of experience with programming before trying to make a bot. how would you do practical stuff (like bot development) and improve yourself if you don't even know anything in the first place?
Studying while coding is the best way to learn "In my experience", you'll keep more information if you put it on practice
@ionic dawnthis is where the scrimba ad comes in
Yes I know, but when I use CSS no changes are taken...
And that is a little bit frustrating.
Yes I know, but when I use CSS no changes are taken...
@vivid oar send your short description here
*long
ok
But no
it's fucked rn cuz express is weird
It's too long to send it here xD
k
https://hasteb.in/inumucux.xm
here you go
hastebin is perfectly fine it detecting the language right of course it's XML not like it's HTML
wow did you just send everything BUT the css which was the only thing i actually needed
how can I know the numbrer of all guilds where my bot is in? (python)
Let it be now
reload page
ok then
why is it happening?
https://hasteb.in/payobohi.xml
Here is the code without description, if that was annoying I appologise.
Ohhhh.
Appologise, I will start making it after my courses..
Nevermind that.
If I have my CSS made, how can I make it work with my top.gg description?
Like others?
That's what I want to know.
To customize my bot page
When your CSS is made just put it inside the style tags in head of HTML
Ok, thanks!
:+1:
How to check if a string only has certain letters in js?
How to check if a string only has certain letters in js?
@silver lintel string.split ("").includes (char);
๐ 
does my bot needs noblox.js to add roblox photo?
You're the Genius, shouldn't you know?
having the name MRGENIUS doesnt mean im too smart
having the name MRGENIUS doesnt mean im too smart
@knotty basin just like how having bot developer role does not make you a programmer who is so funny everybody loves his bot and it got approved
Change it to "callmemrretard" then so matches you.
Change it to "callmemrretard" then so matches you.
@quartz jewel that's rude man
i thought they gonna help me if i have questions i aint asking for code im figuring it out how to make it
i thought they gonna help me if i have questions i aint asking for code im figuring it out how to make it
@knotty basin because you're breaking the rules of programming chat
@knotty basin We will help if you have questions or errors, we will NOT spoonfeed you code
.
but im just asking if it needs a novblox
noblox*
What is inside of the noblox.js?
Why not try reading their docs to figure it out? We can't help you with everything. If no one is willling to help there is no reason to keep begging for help.
I was thinking of making a userinfo to find the personโs name
its like
message.guild.members.cache.get(a=> a.name === args.join(" "))
would that work?
get takes a string not a callback
Get is just the same as Map.get(), takes a key.
cache is a collection which is an extension of map, so therefore ^
okok
i make this
message.guild.members.cache.find(a=> a.name === args.join(" "))
okay.
but nothing returns
@earnest phoenix what you trying to make
I was thinking of making a userinfo to find the personโs name
@earnest phoenix you could do
const member = this.getMemberFromMention(message, args[0]) ||
message.guild.members.cache.get(args[0]) ||
message.member;```
That's cool and all but the first would only work if the extension was default
@arctic hare oh ok
KABOOM said the server when you got near it.
member.user.displayAvatarURL()
for avatar
you can to do like this const member = message.mentions.users.first()
.setImage(member.user.avatarURL)
@earnest phoenix
could i take this rest?
You can dm me.
ok
@earnest phoenix dm
Hi guys, im trying to change my bot max deleting messages from 100 to 500, i changed the number but it says some errors: limit: int value should be less than or equal to 100., i changed it to: if (parseInt(args[0]) > 500) {, but still problems
bulkDelete is only 100 msg / time
Should also check if deleteAmount is NaN.
As parseInt if a string is passed that isn't a number will be NaN.
how can i do this with embed
var players = 12;
${players}
and it will send the value but the text will be like this example
format?
use something like this @lean wing
let emb = new Discord.MessageEmbed()
.setColor("any color hex")
.setTitle("Players")
.setDescription(`The number of players are ${players}`)
message.channel.send(emb)
You can split the players however you want to with players.join(", ")
but assuming the players are an object you'd need to map them first
unless you want mentions
He wants that the value 12 contained in the variable player appears in the embed with the backticks quote so its darker than the rest of the text
He has to either escape the backticks or use concatenation
.setDescription(`bla bla bla \`${player}\``)
Or
.setDescription("bla bla bla`" + player + "`")
in the message event i did message.react() so now is it newMember.react() or something else?
so how do i react to the message that is sent when a person leaves the guild?
new bot creator @here. need someone to test my creation out. thx
@here pings doesesnt work
k thx
@sweet orchid we are not your test Guinea pigs
Test it yourself, we have to do so ourselves too
or creat a alt and test it lmao
That too
@rustic nova sorry
it keeps saying undefined
client.on("guildMemberRemove", (newMember) => {
const welcomeChannel = newMember.guild.channels.cache.find(channel => channel.name == 'welcome')
welcomeChannel.send(`Press F for ${newMember.usertag}. We are now back to ${newMember.guild.memberCount} :/`)
})
member.usertag isn't a thing.
look at the actual properties of GuildMember here: https://discord.js.org/#/docs/main/stable/class/GuildMember
<user>.tag
member.tag or u can do ${member.username}#${member.discriminator}
why does the button background just gone when i use bootstrap in my bot page?
https://i.imgur.com/Upjy8GZ.png
Don't import an entire CSS library into your bot page
It modifies the entire base CSS. Bad idea.
how would i only import just the one that i need?
Just write actual CSS directly, and only for the things you need.
It's possible to stop a prune when she started, as i know the prune is not a one-time kick, but it's a massive kick, so, if the user got kicked before the prune has ended did they stop?
I don't think so.
The prune endpoint is only one API request to my knowledge, which wouldn't allow you to cancel in the middle.
Unless you wanted to kick each member one by one, which is not efficient.
theres a way to disable the default css to be more easy to just create other css?
can anyone give me a code for when my bot join a guild, it send a dm message to server owner pls

as Koya or other bots
i can tell you how to do it, but not give you the code
here
I don't remember what the event is called
I don't code in js and only remember a portion of it
๐ญ
Depends on the library
it would be something like guildCreate or on_guild_create or something like that.
thks
uhm
service unavailable??
can you ask html questions here? related to a website of bot?
anything?
related to html stuff
what shappening to discord
so much msgs fail
What always happens
service unavailable?
happening to my bot too
if(cmd === `${prefix}ban`){ if(!message.member.hasPermission('BAN_MEMBERS')) message.channel.send("Required permission to use that command: ``BAN_MEMBERS``"); else { let member = message.mentions.members.first(); let reason = message.content.split(" ").slice(1).join(" "); if(member) { try { await member.ban(reason= `${message.author.username}: ${reason}`); console.log(`${member} is banned by ${message.author} in ${message.guild}`); message.react('โ
'); } catch(err) { console.log(err); } } } }
what could i do wrong?
just started to think about reasons
How do we know. Only you can see the errors
in reason=, replace = to : and surround it with braces
Your code does a handful of things.
What works what doesnt?
so it worked properly before i started to code the reason stuff
tour
now i did this
**if(cmd === `${prefix}ban`){ if(!message.member.hasPermission('BAN_MEMBERS')) message.channel.send("Required permission to use that command: ``BAN_MEMBERS``"); else { let member = message.mentions.members.first(); let reason = message.content.split(" ").slice(1).join(" "); if(member) { try { await member.ban(reason: `${message.author.username}: ${reason}`); console.log(`${member} is banned by ${message.author} in ${message.guild}`); message.react('โ
'); } catch(err) { console.log(err); } } } }
it finally showed error
ban takes an object
SyntaxError: missing ) after argument list
i just can't understand where should i put the )
After the argument list
After the argument list
@solemn latch cool
await member.ban({ reason: `${message.author.username}: ${reason}`} )
Discord right now
Same with me
i now tried doing like curiosbasant showed
it gave me this error
SyntaxError: Unexpected token '{'
shit I wanted to post in #memes-and-media lol
Blame discord
disocrds dying hard for me
It has been
I have to literary reload every message
yea me too
did you surround it with braces
the message was not delivering, so! ๐ฆ
@tribal siren
In node.js, how can I create charts in image form (JPEG or PNG)?
depends on how you create the charts
most chart generation libraries can output them as images
Some libraries example?
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.
Which privileged intent needed for guildMemberAdd event
How do you make your emojis private, so that others using your bot can't just use them?
Like enter your server and steal them
Make a private server just for emojis?
^
It's kinda confusing tho
A server is private when you don't give the invite to anybody... lol
Don't invite anyone else
Yeah and then restrict all permissions
And keep on adding emoji to it
Yeah and then restrict all permissions
@crystal wigeon
No because only you and your bot in server
Are in*
I see. Thanks, I'm dumb got kinda confused with it ;-;
how to make it
hi
@bot.command()
async def math(ctx, arg1, arg2, arg3):
if not(arg1):
await ctx.send("You need to enter the operation to be performed")
elif not(arg3):
await ctx.send("You need to enter the 2 numbers on which the operation is to be performed as well")
else:
if arg1 == "add":
ans = int(arg2) + int(arg3)
await ctx.send(f'The sum of {arg2} and {arg3} is {ans}')
elif arg1 == "subtract":
ans = int(arg2) - int(arg3)
await ctx.send(f'The difference of {arg2} and {arg3} is {ans}')
elif arg1 == "multiply":
ans = int(arg2) * int(arg3)
await ctx.send(f'The product of {arg2} and {arg3} is {ans}')
elif arg1 == "divide":
ans = int(arg2) / int(arg3)
await ctx.send(f'The quotient of {arg2} and {arg3} is {ans}')
elif arg1 == "mod":
ans = int(arg2) % int(arg3)
await ctx.send(f'The remainder of {arg2} and {arg3} is {ans}')
i have all this
and for some reason it sends an error when the arg1 isnt specified
instead of excuting the if block
btw i started py today so yea
the function expects four arguments and has to get four arguments
can someone help me with something in dm ?
"something"
dont ask to ask
could be anything, could be something we dont know
help me with TypeError: Cannot read property 'send' of undefined
msg.channel.send(embed);
msg.channel is undefined
channel can be nulled? since when ๐ค
??????
how is msg being defined
Here is entire code:
`const Discord = require('discord.js');
module.exports = {
name: 'penis',
description: "Penis Komanda",
execute(bot, msg, args){
let responses = [
"8=D",
"8==D",
"8===D",
"8====D",
"8=====D",
"8======D",
"8=======D",
"8========D",
"8=========D",
"8==========D",
]
let response = responses[Math.floor(Math.random() * responses.lenght )];
let embed = new Discord.MessageEmbed()
.setAuthor(`$(msg.author.username)'s pp`)
.setColor('RANDOM')
.setDescription(response)
msg.channel.send(embed);
}
}`
Lmao
One message removed from a suspended account.
One message removed from a suspended account.
wut
One message removed from a suspended account.
.setAuthor($(msg.author.username)'s pp)
$(msg.author.username) should be using {}
who pinged 
One message removed from a suspended account.
okay
probably a few others, but im blind to these things.
now i have other errors
One message removed from a suspended account.

here
TypeError: Cannot read property 'username' of undefined
.setAuthor(${msg.author.username}'s pp)
i think your msg variable isnt actually a message object
which is why i asked for it to be logged.
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.
}else if(command === 'penis'){ client.commands.get('penis').execute(msg, args);
One message removed from a suspended account.
idk ๐
your execute is sending (msg, args)
but your code is trying to get (bot, msg, args) @gusty quest
I tried something but not worked
G.tracks there is undefined
oh so
so how i can define 'search'
or 'G.tracks'
is your bot defined as client ๐ค
no
i have the api key in an .env file
so
Log what G returns
console.log(G)
oh ok
then just dont send bot at all, remove bot from your
execute(bot, msg, args){
since you dont use bot in this command anyway.
kek
client.commands.get('penis').execute(msg, args);
how are you running this code
whats your message event look like
client.commands.get('penis').execute(client, msg, args)
client.commands tho
so @gusty quest try to change msg to message
why????
One message removed from a suspended account.
One message removed from a suspended account.
He uses msg as his message object
i am just going off what he is telling me.
i love just waking up, hoping to have a productive developing day, and all I see is a penis command
You mean parameters?
๐
โค๏ธ
just a heads up, you gotta give correct info when we ask
lying makes the process 10x harder
@earnest phoenix Bruv, what was the output
the same as the other
search is not defined
What
I told you to log G?
yeah
but
i put
console.log
Where did you put it
And it throws the same result
wait
let me send an ss
and what is the error?
not the error, but I think you're missing the ${song.url} for the string literal
thats why I said 'not the error'
๐
the same
Uhh, where did you even put the
console.log(G);?
in
wait

sorry if my english is bad XD
then console.log(G)
btw how to put a custom status on ur bot.. i tried several ways
bot.on('ready', function(){console.log(1)
bot.user.setActivity("to use me", {"type": "ping me"})
bot.user.setStatus("Invisible")
bot.user.setPresence({status:"online", game:{name:"to use me",type:"ping me"}})
})
none work
in anyway
You have to put it under const G = new genius.Client(process.env.GENIUS_API)
Oh ok
@viscid gale i tried the same but i use client not bot
Bots can't have a custom status
??
yeah
i've seen it too many times.. so they can
That's an activity not custom status
did u see everything i tried
this is like
hmm
activity playing to the otis mom
i shall try that
btw client is = new Discord.Client(); right?
did he properly set up dotenv?
He didn't even log G for us to see what it's
@earnest phoenix Mate did you try what i said
@earnest phoenix Yeah
wait
So?
wait a sec
i was wondering because idk if the library populates G.tracks only after the client is successfully authenicated via the api key
but yeah still console.log(G)
read the error...
you're doing
console.log(G) // accessing it before it's even a thing
const G = g.clientwhatever()
Just put console.log(G), not wrap it inside a .then()
no
let me show you
Did you try that?
@earnest phoenix ur example works.. but how do i change the Playing part of the status to some text of your choice?
i need help
You can't, as i said bots can't have a custom status
Is it possible to attach a text file inside an embed, instead of sending it as a separate message
oh my god
Is it possible to attach a text file inside an embed, instead of sending it as a separate message
@snow urchin yeah
wait
It has to be either PLAYING | LISTENING | WATCHING | COMPETING @viscid gale
console.log doesnt fix an error 
@snow urchin No
see what it logged G as
It has to be either
PLAYING | LISTENING | WATCHING | COMPETING@viscid gale
@earnest phoenix oohhhh that's y i cud never say "ping meto use me"
i see i see
i assume it returns the client object
Hey, someone here know how could I check that the music bot and the requester are in the same channel?
The entire thing
The heck is "COMPETING", new?
whats above it
The hell, is that even a valid object
Or Client object is different from the one above
why did you just expose the api key
Welp, you're trying to access a property that doesn't exist
what even is that library it shouldnt just return the key
unless theres a method
this lib isnt very genius 
The client is either not logged in or you have to search for a song then view the tracks
oK ๐
well
theres a getter
/**
* Songs Fetcher
* @type {SongsClient}
*/
get songs() {
return new SongsClient(this.key);
}
try client.songs
Oh ok ๐
To remove a reaction from a message. which permission is required?
Aah, that is misleading
There should be a MANAGE_REACTIONS
ok I am a bit stuck now, using JS how would I do something like {something.that: "does this"}, I need this in order to check for a certain value inside of a value in a object in my db.
that's invalid
I know that, hence why I am asking for the proper method of doing it
something.that == "does this"
that is not how the db works mate
the db uses objects to search
hence why I need to do it using an object
Then I didn't get, what are you trying to ask
for instance, it's like this
What do you need to verify youโre bot?
To verify my bot, I need 73 more servers to join.
@summer acorn MongoDB?
yes
@summer acorn js <MongoDBCollection>.findOne({ "something.that": // something });
Properties can be a string
Np
How do I make commands that depend on the user using reactions to confirm an action with Discord.js?
Exist some tutorial or docs?
use the awaitReactions method
Could you give an example?
Discord.js documentation already gives you an example
It's more efficient to use collectors than awaitReactions
Because awaitReactions() is just promise based which isn't a good idea
Ok @earnest phoenix
hi
Hello, in discord.js, does channel.overwritePermissions() overwrite everything?
I'm trying to set a permission for a role on a channel, and all channel permissions get reset in the process.
Thank you!
@glacial ridge https://discordjs.guide/popular-topics/reactions.html
What should I use to get all the information in a video, such as length, channel name and title?
@glacial ridge https://discordjs.guide/popular-topics/reactions.html
@rocky hearth Thank you
What should I use to get all the information in a video, such as length, channel name and title?
@haughty bough you mean youtube video?
or normal video?
youtube video
it's probably in the meta data of the HTML iirc
it's probably in the meta data of the HTML iirc
@earnest phoenix I am currently using the YouTube API to be able to search for a video with the title the user gave, but it does not provide all the information I need (time of the video, for example). I may also be missing something, but I can't see
Official api?
yes
so im trying to use a package (g-i-s) for image search but it doesnt seem to be finding anything with any query
On the README, it says the library works as of June 2018
Maybe it broke during then, because it just looks like a Google images scraper.
i use ytsr
to do the search
it returns the url of thumb duration title author if the author is verifyed the description of the video
views
and other things
but you have to install the wip branch
@haughty bough You need to make one more request for the duration
static async search ( query: string, addedBy: GuildMember, maxResults = 1, searchType = 'video' ) {
if (!query) throw new Error('No query provided!');
const results: SearchedVideo[] = await youtube.search.list( {
// @ts-ignore
key: YOUTUBE_API_KEY,
part: 'snippet',
q: query + ', music',
type: searchType,
maxResults
// @ts-ignore
}).then(response => response.data.items)
.catch(console.error);
const videoIDs = results.map( result => result.id.videoId );
const durations = await youtube.videos.list( {
key: YOUTUBE_API_KEY,
part: ['contentDetails'],
id: videoIDs
})
.then(response => response.data.items!.map(item => item.contentDetails?.duration?.slice(2).toLowerCase()))
.catch(console.error);
const final = results.map((data, i) => new Song(data, query, durations[i] || '0m00s', addedBy));
console.log( final );
return final;
}
Obrigado! Thanks! I will look for more on @quaint hornet
@haughty bough
static async search ( query: string, addedBy: GuildMember, maxResults = 1, searchType = 'video' ) { if (!query) throw new Error('No query provided!'); const results: SearchedVideo[] = await youtube.search.list( { // @ts-ignore key: YOUTUBE_API_KEY, part: 'snippet', q: query + ', music', type: searchType, maxResults // @ts-ignore }).then(response => response.data.items) .catch(console.error); const videoIDs = results.map( result => result.id.videoId ); const durations = await youtube.videos.list( { key: YOUTUBE_API_KEY, part: ['contentDetails'], id: videoIDs }) .then(response => response.data.items!.map(item => item.contentDetails?.duration?.slice(2).toLowerCase())) .catch(console.error); const final = results.map((data, i) => new Song(data, query, durations[i] || '0m00s', addedBy)); console.log( final ); return final; }
@rocky hearth Is this used youtube api? Interesting, it will save me time. Thanks!
@earnest phoenix
Hi again, I just made a simple css code to put in my top.gg bot description and it looks like I don't really know how to import my own css there
https://hasteb.in/fakuhino.css
use <style> tags inside your long description
Error: MANAGER_DESTROYED
at WebSocketManager.destroy (C:\Users\Administrator\Desktop\CalypsoBot-develop\node_modules\discord.js\src\client\websocket\WebSocketManager.js:333:54)
at Client.destroy (C:\Users\Administrator\Desktop\CalypsoBot-develop\node_modules\discord.js\src\client\Client.js:236:13)
at Client.login (C:\Users\Administrator\Desktop\CalypsoBot-develop\node_modules\discord.js\src\client\Client.js:225:12)
at processTicksAndRejections (node:internal/process/task_queues:93:5)
2020-11-09 12:18:47 - debug [app.js]: [WS => Shard 0] WS State: CLOSED
2020-11-09 12:18:47 - error [app.js]: Privileged intent provided is not enabled or whitelisted.
{
"stack": "Error [DISALLOWED_INTENTS]: Privileged intent provided is not enabled or whitelisted.
Help meeeeeeeee
!
enabled the privileged intent
enabled the privileged intent
@rustic nova Me ?
"privileged inteny provided is not enabled or whitelisted"
nah the dude 300 message above you
Help Me
I do not realize the error
enable privileged intents
@cinder sandal
From which part should I do this ??
go to the page where you created your bot
search the settings
and enable privileged intents
hello @everyone i want add the bot on this image to my serv ! Someone can help me ?
can we create a bot to directly join a game from discord ?
ok so it's possible to directly join a game from discord ?
yes, if you integrate it into your game
it does work on all games ?
yes, if you integrate it into your game
lmfao you can't make it work with any game you want
that's not how anything works
the code for the discord game sdk needs to be in the game (among other things like the party secret etc.)
that's why i explicitly said your game
how many ms are in 30m?
calculate it
ok !
bad at math
Thanks man i got it !
luckily for you there's this thing called google
don't know if you ever heard of it
i didnt, is it like a food?
yeah
your browser is also able to calculate that on the go i think
at least firefox does
you could've also used SI conversion
is it a drink?
30(minutes) * 60 (seconds) * 1000 (milliseconds)
so yeah a drink
Anyone have a good guide to learning how to listen to a webhook request, trying to learn how to do it for DSL webhooks.
lol
basically it's a simple as opening a webserver and making an endpoint
yeah
Ez
well uh file is an incorrect term but yes
the JSON is in the body of the request
so if my bot does not need any server member or presence intents, does it need to get verified to grow over 100 servers?
You kiss leafy
@blissful coral do you know how i could have invited bots that are over 100 servers but not verified?
look
you could've, but not anymore
someone have cool bot for community server
not the channel for it
if you have dm me plewase
uh
know why?
That's possible
how
A bot with suspicious growth can go up to 250 until it settles down and they can apply for verification
wdym by suspicious
Means "growing too fast"
for example if they were added to, y'know, multiple bot lists. ๐
yeah
There's a failure message in verification called "suspicious growth" he meant that
Oh I'm sure they're aware of that, if they tried to apply
app.post('/', (req, res) => {
// check if verification token is correct
if (req.query.token !== token) {
return res.sendStatus(401);
}
// print request body
console.log(req.body);
// return a text response
const data = {
responses: [
{
type: 'text',
elements: ['Hi', 'Hello']
}
]
};
res.json(data);
});
GET / 401 Unauthorized
clearly req.query.token isn't equal token
have you tried logging them both and looking at them?
always debug
Token isn't even a returned value
When 5 servers match with the same owner ID the verification goes brrr
Authorization is tho
if (!webhook) webhook = await channel.createWebhook(name, {
avatar: avatar
});
My code just stops here and does nothing
you need the GUILD_WEBHOOKS intent, do you have that?
actually, i'm not sure since it barely has anything to do with events
but you can try adding that intent if you haven't already
will this filter out anything nsfw?
i think that aiohttp's json interpreter does convert things to bools
so == "false" will never be true
because the value is a bool
oh
should be if not res["data"]....["over_18"]:
so it would be == False?
should be
if not res["data"]....["over_18"]:
@warm cloud oh
yes, or if not
time to test!
@steep socket for the record, it's recommended you don't create a client session for a one-time use.
I'd recommend you keep it saved to a variable.
anyone here help me with canvas real quick?
how can I send a msg to a channel that is cached on an unknown shard?
You just fetch the channel with broadcastEval
discord.js v12
what is an eval command i can use
to make the bot leave the server
um
@earnest phoenix no..
how would i break the text to a new line if its big?
no its canvas
\n
<client>.shard.broadcastEval(`this.channels.cache.fetch('${<channel>.id}')`).then(c => {
//Code here
})```
thanks
but i think im just gonna use webhooks
its for logging joined/left guilds
Ah
but thanks anyways !! ๐
Could do
client.guilds.cache.get(`id`).leave().catch(() => message.channel.send(`Could not leave`))```
ok
how can i send a msg to a webhook if i have the url?
you make a webhook client and then do <webhook>.send()
ah thanks!!
Is there an easy way to check if a user has permission to edit a role in discord.js? I know I can do it manually by checking a users perms and then checking if they are above the role
I want a command debounce per user ok
But having an array of every user in the server would be a pretty bad on resources
so is there a more effective way i can do client debounce?
Is there an easy way to check if a user has permission to edit a role in discord.js? I know I can do it manually by checking a users perms and then checking if they are above the role
@tame kestrel I don't think there's an easier way to do it. Though, the implementation is very simple like you outlined manually:js get editable() { if (this.managed) return false; const clientMember = this.guild.member(this.client.user); if (!clientMember.permissions.has(Permissions.FLAGS.MANAGE_ROLES)) return false; return clientMember.roles.highest.comparePositionTo(this) > 0; }











