#development
1 messages · Page 1350 of 1
@dark grove you forgot theres more than one opt
message.react('735903870609391657')
.then(reaction => reaction.message.react('735903836727935098'))
.then(reaction => reaction.message.react('750759552542310410'))
.then(reaction => reaction.message.delete({ timeout: 5000 }))
.then(msg => console.log('Message Deleted!'))
.catch(err => console.error);
@midnight brook idk why i cannot see those messages but that worked thanks
yea
so rn, im using .json for database, but my bot always crashes because the size is 57.7 GB
i wanna switch to mongodb
if(message.attachments.first()){//checks if an attachment is sent
if(!storage[message.guild.id][type]){
storage[message.guild.id][type] = []
fs.writeFile("./storage.json", JSON.stringify(storage), (err) => {
if(err) console.log(err)
});
fs.writeFile("./storage.json", JSON.stringify(storage)
yikes
58gb bruh
is that all you store?
cause if so switching won't be hard, aside from setting it up
Hi, what is the rate limit in creating emojis? I have a command that creates some via requests to a git repository, adds them as reactions to a message (reaction roles), and then deletes them and I want to know if there needs to be a cooldown for this
wait what
60gb of json
how does it not fuck your cpu every time you read your db
Hi, I'm trying to make a system so that whenever someone messages my bot it creates a channel for staff members to message them. Currently I have it so that it opens a channel for every message they send, I just don't know how to make it so it only opens 1 channel per user. Could someone help me with this please? I will attatch the code here:
@client.event
async def on_message(message):
if message.author.bot:
return
if isinstance(message.channel, discord.channel.DMChannel):
guild = discord.utils.get(client.guilds, name="Snappy Support")
role = discord.utils.get(guild.roles, name="Support")
role1 = discord.utils.get(guild.roles, name="Member")
overwrites = {
role: discord.PermissionOverwrite(read_messages=True),
role1: discord.PermissionOverwrite(read_messages=False),
guild.me: discord.PermissionOverwrite(read_messages=True)
}
category = discord.utils.get(guild.categories, name="Support")
for member in message.guild.members:
channel1 = await guild.create_text_channel(f"{message.author}", overwrites=overwrites, category=category)
channel = discord.utils.get(guild.channels, name=f"{channel1}")
await guild.delete_text_channel(guild.channels, name=f"{channel1}")
e = discord.Embed(title=f"{message.author} said:", description=f"__`Content:`__ **{message.content}**\n \n __`Their ID:`__ {message.author.id}", color=0x0000ff, timestamp=message.created_at)
await channel.send(embed=e)
await client.process_commands(message)
pass
[Error: ENOENT: no such file or directory, scandir '../../commands/'] {
errno: -2,
code: 'ENOENT',
syscall: 'scandir',
path: '../../commands/'
}
I need to access the commands dir from the commandHandler.js file at line 26
Idk why it's wrong
which file did you give a screenshot of?
commandHandler.js
cause if so switching won't be hard, aside from setting it up
@grizzled raven well
theres
storage.json
disabled.json
prefix.json
slowmode.json
oh ok nvm
Bot going offline at every 30 seconds Why help me experts
oh ok nvm
@grizzled raven ?
Is there any way that when a person opens my website
It automatically changes to desktop version without person pressing Request desktop site
Hey, with which event in discord.js can I easily check if my Discord Bot gets disconnected from a Voice Channel?
@delicate shore media query css
Is there any way that when a person opens my website
It automatically changes to desktop version without person pressing Request desktop site
@delicate shore yes
css
Hey, with which event in discord.js can I easily check if my Discord Bot gets disconnected from a Voice Channel?
@jagged sun voiceChannel.leave
@indigo flax can you show me an example?
```client.shard.broadcastEval(this.channels.cache.has(${"${remind.chnnlid}"}) ? this.channels.cache.get(${"${remind.chnnlid}"}).send(${"<@${remind.lastbump}>"}) : null ).then(console.log);
any idea, why it can not ping the user?
with a normal message, it works
Egad, what is that
what are these strings
Wouldn't this be the right thing in JS for interpolation?
`<@${someVariableHere}>`
Well
Isn't that what JS uses for string interpolation?
That allows the ${} syntax inside a string?
node js
JS, nodejs. Roughly same thing
Try googling "JS string interpolation"
NodeJS is just the independent version of JS for running outside a browser
Same syntax. Different API calls
Wouldn't this be the right thing in JS for interpolation?
`<@${someVariableHere}>`
@faint prism that will not work becuase it is alread in the broadcasteval ein ``
then just put <@${someVariableHere}>
if that variable is a user/member object, you can just use ${variable}
Did you look up the syntax for string interpolation?
You only need to do those back ticks once to specify a string that will be interpolating a variable
@delicate shore media query css
@trim saddle I can enable desktop side with that ?
For the user
no, it changes the style based on the screen size
you can add a button with javascript
How do I fetch the guild that has no members
You can overrride mobile media-specific with css, but I personally hate when sites force me to use desktop on a mobile screen
Is there anyway to have the prune method list the users, or will it only show the count.
And can I get a cleaner code of
guild.channels.forEach(async c => {
let msg = await c.send('Thanks for adding me into your guild')
if (msg) return
})
Nvm that didn't work and sent a message to all the channels
Its a pain in da ass to delete all the message
S
just write a command searching for messages by the bot id and removing them
....
lol
there isn't a comparison there
I guess it would be, if (that's null)
You should check if the msg.author.id == yourclient.currentuser.id or something
idk the d.js properties of their objs though
Is there anyway to have the prune method list the users, or will it only show the count.
if i pass a variable in an if statement will the if statement run the code based on the value of the variable or whether the variable exists or not?
it goes off
null, undefined, 0, false
string, number > 0, true
@earnest phoenix I think anyways, prob missing some
Hi
this aint the place for a conversation
.
Hi
How to create a covid 19 tracker bot
Thing
well
I could send u mine
but eh
you'd need an external api for that
Ohk
if(msg) return
My website was facing issues on mobile
So I did this
If user is on mobile
He redirects to old website
Does it put a bad impression ?
Yes
Since old website
Will impact customers
Waiting time
Cloudfare
will take time
@delicate shore btw, how u made website and host it
Step 1) Make a website
Step 2) Upload it to a host.
Or host it yourself
lmao
Which sense makes a 10s redirect countdown if u can't cancle it? Why waiting 10s if so?
Just do an instant redirection if on mobile...
or use some modern framework. (IK https://motherfuckingwebsite.com but still... it's easier.. a lot of.)
man, I love that site
@delicate shore lol i just went to your website..those reviews sound so fake
lmao
Simple HTML/CSS to get static information across
aye, and a little js to create a "smooth" feeling for the user, if needed, not really complicated
even in 2020 I'm still coding in strict html and css2.0 (max) to ensure the website will look identical on each browser no matter the user lives in 1990 and uses IE
and they still look good, in my mind
@delicate shore your bot has a howgayme command, doesnt sound homophobic at all
Totally. I really try to avoid JS for visual elements unless it's really something CSS can't do
Which is a actually kind of surprising how much it can do
Also that cross-compat is a bit misleading, you can even use es3 in js too so IE7 is able to load it prob
how old are u, to feel triggered by a command called howgayme ... 12?

Tbh, doesn't every bot have that command?
aye, CSS 2.0 has a lot of possibiliets, some are just a bit more to do instead of using CSS3.x
what at the end the result is similar
I've seen complete animations with CSS, pretty wild stuff
aye, I have to say I'm more focused on building a 100% responsive site, even supported by IE, than doing all the fancy bullshit available in CSS3.x supported only by the latest browsers
if i needed website i would probably for real only use HTML5 + CSS2.0
Oh wow... HP LoadRunner Analysis outputs Netscape-compatible HTML reports
but the files probably start growing from my 100 lines of react code into 5000 html code with script tags to make requests into my REST api
and some random animations
Well that’s the moment frameworks like bootstrap taking into place
wait can u use bootstrap in HTML5?
I can't see why not
Im personally not a fan of overloaded sites with lots of animations etc
yeah same
...anyways
It increases the loading time anyways and I’m always try to calculate in mobile device users with slow connections, too
wait can u use bootstrap in HTML5?
@restive furnace ...you don't?
It’s like to find a balance between loading time, and overall look, “smoothness” and the users stupidness how to do things
so basically you should use CSS and HTML only if you don't want complains about your users with slow connections that site is not loading?
I think it’s not possible to call it out like that.
Lots of background images or not well optimized code can be an issue, too
Working with a lot of colors instead of images and maybe some shadows (webkit stuff etc) should be good enough
Maybe not what younger people today would prefer but fast and easy to see and understand what u have to do
The alternative (e.g. colors > image) is more native
someone told me that it was my fault my pc wasn't working, suck on this one https://cdn.yxridev.com/u/QCouvs54.png
Any buddy know what is image xray id
Lol
ctrl +shift+i
That's... the developer tools, what does that have to do with images?
uhm...
Are you talking about Ray ID?
Yes
Thats a cloudflare request identifier
All requests have a unique id
Even the same image should have a different id every time you reload
👍
@quartz kindle help me
i made a express server
in my vps
and then i get my vps's ip
fetch(the ip)
port forward
you connect to wrong port or did not port forward
then you did not port forward
Your VPS either has a firewall, or it's missing a port forward.
I said that before lol and you said you did, never lie to helpers or you only get guesses what's wrong.
but ur explain way
What are you even asking
Do you mind trying to use more words, because "image code" isn't a question or something anyone can address.
What is it used for
omg
What's this code for? Where did you get it?
github
lol
Except "it's an object"
u know imghash
no
image hash?
Just realized those are pokemon images.
npm i imghash
ok what about that?
imghash
Whats teh issue?
@umbral zealot Hi evie! I really appreciate your enmap project, although some of my projects outgrew it a bit, I think it's really useful for hacking things together
^.^
You might appreciate JOSH for growth and scaling though. By the same author 😛
(though it's still in pre-release)
how can i acces the guild object via a reaction collector?
I kinda need help, i can't quite figure this out. The array contains this [ '1,-3,4', '2,5,2', '4,-1,-2' ] but whenever i run this line of code to push it to a bigger array
array.forEach(element => array_2.push(element.split(',')));
it turns into this pattern of 0's and 1's: [0,0,1] , [0,1,0] , [1,0,0] where the 1's are the highest number and the 0's are every other number.
i dont know why exactly this is happening, can anyone tell me what im doing wrong
@earnest phoenix you want to know what is imghash for?
how can i acces the guild object via a reaction collector?
@earnest phoenix Can you just use the guild object from the message you create the collector from?
@earnest phoenix are you trying to make it like [ [ "1", "-3", "4" ], [ "2", "5", "2" ], [ "4", "-1", "-2" ] ]
or like
[ "1", "-3", "4", "2", "5", "2", "4", "-1", "-2" ]
or am I missing something
i think he wants to sort it
1's are the highest number and the 0's are every other number
i didnt understand what they are trying to do either tbh
no its only supposed to look like this[ [ 1, -3, 4 ], [ 2, 5, 2 ], [ 4, -1, 2 ] ] because that is the format i gotta put it into to solve it using a linear equation system library
the only problem is that the numbers are turning into 0s and 1s
and i dont know why its happening
we see where you starting, but can you provide an output example?
u might wanna send full code then
where you even getting 0's and 1's at from that array?
rip I have an exam to start in like 5 mins but
var a = [];
[ '1,-3,4', '2,5,2', '4,-1,-2' ].forEach(element => a.push(element.split(',')));
console.log(a);```
works just fine for me, what you had originally
var AND forEach()
@opal plank they're using var so they can push elements to the array and you can't change the value of a const
I was just chucking whatever he had into my browser's console 
you can use let on console too
let/const are native js
You can also use await on a browser console even tho it's not supposed to be an async function
the more you know ✨
still forEach() though, but getting there
@opal plank
This is what the array looks like[ '1,-3,4', '2,5,2', '4,-1,-2' ]
This is what array_2 looks like before the code: var array = [];
This is what the line of code looks likearray.forEach(element => array_2.push(element.split(',')));
This is what the array_2 that the array is being pushed into looks like after the line of code: [ [ 0, 0, 1 ], [ 0, 1, 0 ], [ 1, 0, 0 ] ]
oh whale
ur overwriting array
just a reminder, they all in string form
here
oops
that was a typo
not in the code
@tulip ledge i renamed the arrays for the discord messages for easier understanding cause in the code they have other names so that was a typo
but im not overwriting the array
@earnest phoenix
@earnest phoenix just send your whole code man
I'm p sure you're having false negatives (is that what you call em)
are you parsing the numbers by any chance?
wouldn't map be suffice?
based
based af

are you parsing the numbers by any chance?
@opal plank could be, the input syntax looks like this=solvesys 1,-3,4 / 2,5,2 / 4,-1,-2 = -5,27,-19
and the code is this:
var equations = [];
var input = msg.content.toString().substring(9).trim();
var input = input.replace(/\s+/g, '');
var inputsplit = input.split('=');
var inputsplit1 = inputsplit[0].toString().trim();
var inputsplit2 = inputsplit[1].toString().trim();
var inputsplit1_array = inputsplit1.split('/');
inputsplit1_array.forEach(element => equations.push(element.split(',')));
var solutions = inputsplit2.split(',');
var SOLVE = linSystem.solve(equations,solutions);
var style_decimal = {
style: "decimal"
}
var SOLVE = SOLVE.toLocaleString(style_decimal).toString();
var SOLVE = SOLVE.replace(/,/gi, ' , ');
var go brrrrr
but could that be part of the problem?
prob not
but var is function scoped and let is block scoped
what that means don't ask me
I just know it's better to use let
vars gets declared on initialization too
vars are hoisted with the compiler
they also, like you said, dont respect scopes very well
you can return values even though they dont exist
the basic concept of the code is that it is using a library which solves linear equation systems and the weird thing is EVEN THOUGH the numbers get turned into those weird 0s and 1s it STILL outputs the right answer
look in the screenshot i sent
returning a even though it hasnt even been declared
run my snippet that i sent with an eval or something
i doubt it'd be that
and switch all vars to const/let
ighzt
i know my code looks like it survived chernobyl
basically i fixed the redeclaring stuff and changed the vars to lets so my code looks a bit better now but the error still persists
also in my vscode terminal the numbers in my array are green and in the second array where it gets turned to 0s and 1s it is colored yellow what does that mean?
are you parsing them?
var SOLVE = linSystem.solve(equations,solutions);
log what this returns
-2 , 5 , 3
nvm, so immediately after the
var SOLVE = linSystem.solve(equations,solutions);
it outputs [ -2, 5, 3 ]
that means the 0s and 1s are also numbers
so they get turned from strings to numbers in the line of code that causes this
looks fine to me
theres no reason for the toString() btw
toLocaleString() already returns a string type
nothing wrong here either
yea i dont remember why i added that, at some point it refused to accept it as a string but i dont have that problem now
yup
read that
aight, time to go play now
good luck
im actually a dumbass
i just realised that the line of code is not causing the problem
my console.logs where way more lines down
when i put it directly under the line of code it was a normal string array
so now i just gotta find the real line of code that causes this
oh my fucking god
its the library
the fucking library itself is changing my array to 0s and 1s in a command that shouldnt even affect my array directly
What is the fastest way to get a channels message history? During testing, I found that for every 100 messages added to the limit for the history method, a second was added. That means 5000 messages take about 50 seconds to retrieve w/ that method.
I use discord.py, though answers from those using other libs still may be helpful, considering many of the general methods are the same. @ me when answering please.
${message.guild.members.cache.filter(mem => mem.users === true).size}
will it say how many members are in the server? (only members not bots)
member.bot is usually what you go for
you want to filter out bots then (mem => !mem.user.bot)
user.bot*
help me
my website is not working
www.website.com work
but website.com doesn't work
Well then fix ur dns records
could be caching
Then flush your dns cache if that’s an issue on ur side
could be caching
@pale vessel has to be
did you use memberCount for total?
where does it say not to use json file as db
if so, then your bot didn't cache all members
where does it say not to use json file as db
@stark abyss json db can get corrupted easily
[0mGET /.well-known/acme-challenge/9qk42UCGrBpmB8TZGdG5_3yuyQNCUS_4VyewUM96jLs [33m404 [0m1.499 ms - 20[0m
And what the fuck is this
onvm
there is 379 people in the server @pale vessel
well, you used members.cache.filter() which uses the cache
${message.guild.members.cache.filter(mem=> !mem.user.bot === true).size}
thats how i did
your bot didn't cache all members basically
it only cached 57/379 members
so the solution would be to cache/fetch all members (assuming you have the guild members intent) and then calculate the members again
if you don't have the intent, you have to request for it
not even
intents
to cache all members you'll need priviledged intents
@tardy hornet
o
GUILD_MEMBER intents iirc
theres only two, presence is one, the other one is the on you need
i forgot the actual name
GUILD_MEMBERS and GUILD_PRESENCES iirc
something along those lines
yeye
Anything on this? #development message
discord api has limits on how many messages you can get in one request
it would probably be on the developer docs site, which would be your hard limit
Hmm.. kinda makes grabbing more than 500 messages kinda undoable then. At least in reasonable times.
is there a specific reason you want to get so many messages?
Things such as logging a full channel or even purging it.
In case people want to delete old channels but keep records of what was said
Then just save the channel and lock it
purging channels should be done by cloning the channel and deleting the original if possible(a channel with 1,000,000 messages would take days to delete with bulk delete)
Right
Logging would be the real main use tbh. But sounds like its not feasible. Also, PII?
personally identifiable information
means youd need to start complying with a lot of laws
Ah yeah in the discord.py server they said "just store every message sent" and I was like um yeah no
Thats why I wanted to find a way to fetch them faster through discord itself, rather then keeping a sketchy database like that
I try my best to address and reduce all privacy concerns like that
well, youd have to save them either way if your logging.
Well what I would do is have the command create a txt or html fole w/ the logs, upload it as a file to the log message, and delete it from my own server
some channels have millions of messages, doing that for an entire channel isnt feasible even if you could get 10,000 messages per request 🤷♂️
Yeah
Thought id explore it, but I dont want to sacrifice user privacy/security for functionality.
Thanks for the info
Wait, is there a way to get an approximate message count in a channel quicker tho?
I think you'd need access to the search endpoint, which isn't available to bots.
sadly, bots dont have access to the search api users have, so i dont think its possible without manually counting
F
you could have users manually add it and track from that point. but thats not a good solution
Right
also since discord already provides it, kind of a useless feature
sadly, bots dont have access to the search api users have, so i dont think its possible without manually counting
@solemn latch makes sense, it's obvious how that could be abused
It would be more to determine if a full channel is loggable, or how to go about doing that. At some point I want to remaster the ticket system ive used for private servers, and make it more public.
My bot is essentially whatever i feel like working on at that point lol
honestly, locking the channel is the correct way to store old channels up until guilds hit the channel limit(which is so high, would more likely be abuse at that point).
Right. Though for tickets, message count is less likely to get as high.
what its a good place to make testings of web development(like glitch, replit etc)
Not sure if this is the best idea..but why don't you just iterate over the message history to see if it exceeds a certain number
what its a good place to make testings of web development(like glitch, replit etc)
@dire obsidian glitch, replit work really well
🙂
youre stalking me eh? rarw
or just local webserver 
I mean maybe 500-1000 messages in worst cases i would think. And wdym @hollow sedge?
I mean maybe 500-1000 messages in worst cases i would think. And wdym @hollow sedge?
@waxen tinsel well with discord.py i can just say that my limit is 100 and it will grab up to 100 messages from a channel
webservers are so insanely light in testing enviorments
Right
so that will work for you?
yeee but im (for the moment) not making web servers
if it's more than 100, you only get 100
if it's less than 100, you get the full text
So you are saying a system where I just keep going in 100s till I hit a #?
i have some problems 👉👈
NO
so thanks for the help
im saying only get up to 100 messages
or whatever your limit is
sorry i dont think im expressing this idea in the best way
True
Sorry I had to do that iteration sort of method to get records from an api at one point and it randomly popped up lol
oh lol
let embed = new MessageEmbed();
.setAttachment(neko.url);
message.channel.send({embed})
someone teach me how to put it in one line
where {embed} is
all 3 lines on one line?
REPL.IT IS A MASTERPIECE
@slender thistle I won one of their hackathons and made a quick buck, that was fun
like message.channel.send(create embed here)
Wew
message.channel.send({new MessageEmbed().setAttachment(neko.url)});
ty
or something 🤷♂️
Unexpected identifier
which one
didn't tell me
probably
hey, what parameter is setAttachment @stark abyss ? can you link me the docs to it
I cant find it
🤔
ok
what could be the cause for a node.js express server on ubuntu to send this: https://luca.is-inside.me/EZVmnJ5M.png
an invalid HTTP Response
fair
turns out i was actually double stupid
is there a way to execute a piece of code on every shard
in my case for a reload command
to reload the command on every shard
like a broadcast?
uh can someone help me with getting voting updates and sending them in a specific channel with discordjs?
ok
Where do i find voting. People have to vote after doing 10 questions. How do i get that code?
You write the code?
No I’m saying. How do i get top.gg to tell my bot that someone voted so they can continue doing trivia questions
like a broadcast?
@faint prism i tried that but i cant get it to work
@static trench https://discordbots.org/api/docs
Still. Can’t find it
what language?? all the info is there
client.shard.broadcastEval("const name = args[0].toLowerCase(); delete require.cache[require.resolve(`./${name}/js`)]; ..")
-> name = undefined
what language?? all the info is there
@hollow sedge py. It’s not. Am I being dumb?
bruh
What?
@hollow sedge ok. Ive been there. I’m asking. Where do i find the code that tells my bot someone voted on top.gg?
yw
Anyone know why join/leave events work when I run my bot on my PC but stop working on a VPS
no clue
&& )
are you trying to tell me that if (someBoolean && ) makes sense?
lol
All good
messages contain a mentions property
just check if the bot's mention is one of them in the msg
it will answer only after tagging.
ex: @earnest phoenix
@earnest phoenix hi
will not give when written ^^
bot.on('message', async message => {
if (message.channel.type === "dm") return
let prefix;
try {
let fetched = await db.fetch(`prefix_${message.guild.id}`);
if (fetched == null) {
prefix = PREFIX
} else {
prefix = fetched
}
} catch (e) {
console.log(e)
}
try {
if (message.mentions.has(bot.user) && !message.mentions.has(message.guild.id)) {
var kSayı =0
bot.commands.forEach(a=>kSayı+=1)
const embed = new MessageEmbed()
.setColor(autimatic)
.setDescription(stripIndents`Merhaba ${message.author}, ben autimatic.
**${message.guild.name}** sunucusu için prefix'im: \`${prefix}\`
Komutlarımı görmek için \`${prefix}yardım\`
Her hangi bir komut hakkında bilgi almak için \`${prefix}yardım <komut adı>\` yazabilirsin.
`)
.setAuthor(bot.user.username + ', ' + bot.users.cache.get("257062280779268097").tag + ' tarafından geliştirildi.' , bot.user.displayAvatarURL({ dynamic: true, format: 'png', size: 1024 }))
.addField(`**Bilgi:**`, stripIndents` **Geliştirici:** ${bot.users.cache.get("257062280779268097").tag}
 **Avatar:** [**Şevval Coşkun**](https://tr.pinterest.com/pin/206884176609870185/)`, true)
.addField(`**İstatistikler:**`, stripIndents` **Sunucular:** \`${bot.guilds.cache.size}\`
 **Kullanıcılar:** \`${bot.users.cache.size}\`
 **Kanallar:** \`${bot.channels.cache.size}\`
 **Komutlar:** \`${kSayı}\``, true)
return message.channel.send(embed)
}
} catch {
return;
};
});
@earnest phoenix hi
Because the mention is actually this ^
@faint prism
@earnest phoenix ?
and what?
&& = and some condition
but you have nothing there
so the ) is unexpected
@earnest phoenix maybe use an IDE that detects syntactical errors
@earnest phoenix #development message
reread this
if (someBoolean && ) is wrong because you mean
if (someBoolean)
hello guys
client.on('ready', (i, callback) => {
setTimeout(() => {
var randomSaniye;
setInterval(() => {
/* Bot Presence (Game and Status) */
client.shard.fetchClientValues('guilds.size').then(results => {
//let servercount = results.reduce((prev, guildCount) => prev + guildCount, 0)
var durum = [
"!!yardım | !!davet | !!p Şarkı",
"!!cortex | Benle konuşsana :3 ",
"Özel mesaj at, cevaplıyım UwU",
// "!!davet | Sunucuna beni çağır >_<",
];
//
var saniye = [
"5",
"10",
"15",
"20",
"25",
"30",
"35",
"40",
"45",
"50",
]
randomSaniye = saniye[Math.floor(Math.random() * saniye.length)]
var random = durum[Math.floor(Math.random() * durum.length)]
client.user.setPresence({game: {type: 0, name: random}})
})
}, randomSaniye * 1000);
}, 20 * 1000);
})
``` im make it this code for my shard.js bot but im getting so many error
error
np
okay i how to fix this pls
The error gets thrown when you try to get a value of <Client> from each shard using <ShardClientUtil>.fetchClientValues while the Sharding Manager is still spawning shards.
:c
you update to v12
? 😄
I have a university exam
ne zaman
well I'm not doing it for you
@toxic jolt but they have a guide
https://discordjs.guide/additional-info/changes-in-v12.html
okay but so hard.
shard üretirken
@earnest phoenix dm
#general-int for other languages
okay but so hard.
@toxic jolt 🤷 good luck. Follow the guide in that link is all I can tell you
idk Javascript. I'm a C# developer
sounds like you're passing in an incorrect variable type
It says it expected a number
rememeber "5" does not equal 5
I know Js
How do i make a GET using node-fetch? it asks me for Parameters
How do i make a GET using node-fetch? it asks me for Parameters
@ember lodge https://www.npmjs.com/package/node-fetch has documentation with samples
would be GET requests
do you mean headers?
GET can only pass in data via queries
which is http://example.com/something?my+query+here
@ember lodge example
const fetch = require("node-fetch");
fetch(`url/${parameter or input}`)
.then(response => response.json())
.then(data => {
message.channel.send(data.value.toLocalString()
})
yeah basically
I'll see thanks
np
Hopefully that's helpful but I am not good at this so don't blame me if i am wrong
POST or other HTTP protocols can send content via their body argument
In discord.js, i get this error Error: input stream: Could not find player config, can someone help me and try to fix the problem?
Is that a custom error?
or some module/lib's error?
sounds like it's looking for a config file that isn't present in the directory it searched
Error: input stream: Could not find player config
at exports.getBasicInfo (/home/simo/musibeth/node_modules/ytdl-core/lib/info.js:59:13)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Object.exports.<computed> [as getBasicInfo] (/home/simo/musibeth/node_modules/ytdl-core/lib/info.js:296:18)
at async exports.getFullInfo (/home/simo/musibeth/node_modules/ytdl-core/lib/info.js:187:14)
at async Object.exports.<computed> [as getFullInfo] (/home/simo/musibeth/node_modules/ytdl-core/lib/info.js:296:18)
discord.py, how would i make the bot dm me when an error happens
@quaint peak you can DM a user/member object w/ send method.
easiest way to go about it.
it returned invalid json
like the error says
more than likely because you failed to spell download properly
sry
@ember lodge i am sorry ):
const body = { a: 1 };
fetch('https://httpbin.org/post', {
method: 'post',
body: JSON.stringify(body),
headers: { { 'x-api-key': 'keyhere' } },
})
.then(res => res.json())
.then(json => console.log(json));```
example from the npm
i would look at the npm because it really have good examples
@balmy knoll Update ytdl-core to the latest version and restart your bot
assuming the url and then you can use different methods
i tried this:
const path = "arkps/ShooterGame/Saved/Logs/ShooterGame_Last.log"
const fetch = require("node-fetch")
fetch(`https://api.nitrado.net/services/6705374/gameservers/${path}/download`, {
method: 'GET',
headers: {
'Authorization' : `Bearer ${nitrapiToken}`
}
})
.then(res => res.json())
.then(json =>{
console.log(json)
})
but stills the same error
npm i ytdl-core@3.4.2 @balmy knoll
It also requires a parameter
fs.readdir("./assets/events/", (err, files) => {
if (err) return console.log(err);
files.forEach(file => {
var event = require(`./assets/events/${file}`);
let eventName = file.split(".")[0];
bot.on(eventName, event.bind(null, bot));
});
});```
<Base URL>?file="Path to the file"``` @ember lodge
@earnest phoenix Thanks
@wicked pivot Log and see what this returns
fs.readdirSync(".assets/events/").map(file => console.log(require(`./assets/events/${file}`)));```
As you see, one of them returns an empty object with you can't use bind on @wicked pivot
typo I forgot the s on module.exports thanks
Np
args[1] is not a number
parseInt(args[1])
What is the 4th line in your index.js
I mean the 25th line, show me that line in your main file
That's where the error comes from
Wait a second, it's the 2514th line
Bruh moment
Also that can happen if args[1] doesn't exist or is not a number
Add a check to see if it's a number
Best database to use for a bot that is able to handle a lot of information
MongoDB
depends if you want ease of use or actual "lot of information"
because straight up look into cassandra, postgres or mariadb for example
Is there a way I'd be able to grab the description of every command file, And put it into a embed (d.js)
like if my ping description was:
'Get the ping of the bot' the embed would display
Ping (field title)
Get the ping of the bot (field text)
Of course, do a loop
But doing all this in one embed would be bad because embeds can only have 25 fields at max, you need a pagination system as well
you could also use codeblocks
import discord
import asyncio
from discord.ext import commands
bot = commands.Bot
bot.tempf = 'Not Set'
bot.tempc = 'Not Set'
bot.skycon = 'Not Set'
bot.windspdm = 'Not Set'
bot.windspdk = 'Not Set'
bot.winddir = 'Not Set'
weather=f'''
*the weather report is as follows:
Tempature: {bot.tempf}°F/{bot.tempc}°C
Sky Conditions: {bot.skycon}
Wind: {bot.windspdm} MPH/{bot.windspdk} KPH from the {bot.winddir}
'''
class WeatherCog(commands.Cog, name="Weather Cog"):
def __init__(self, bot):
self.bot = bot
@commands.command(name='weather')
async def _weather(self, ctx):
print('Weather Report requested...')
await asyncio.sleep(0.1)
await ctx.send(weather)
await asyncio.sleep(0.1)
await ctx.send('(Not sure if this will work or if I should make it an embed. Let me know what you think!)', delete_after=7)
print('Weather Report sent!')
pass
@commands.command(name='tempf')
@commands.has_permissions(administrator=True)
async def _tempf(self, ctx, text):
print('Setting Fahrenheit Tempature...')
bot.tempf = text
await ctx.send('Fahrenheit Tempature Set!')
print('Fahrenheit Tempature Set!')
pass
pass
def setup(bot):
bot.add_cog(WeatherCog(bot))
This is not changing the tempf thing in Python
dude, what is this
in a cog you have to use self.bot
@trim saddle I am already using self, in the function
@hasty mulch yes but when you're referencing the bot you have to use self.bot, not just bot
tis how classes work
@hollow sedge Yeah, that didn’t work
const Discord = require(`discord.js`)
const guildModel = require(`../db/Guild`)
const { connect } = require(`mongoose`)
module.exports = {
name: 'test',
async execute(client, message, args) {
const doc = new guildModel({ id: message.guild.id })
await doc.save()
message.reply(`Made new document!`)
await connect('mongodb://localhost/mongodb-demo', {
useNewUrlParser: true,
useFindAndModify: true
})
},
};
self.bot.tempf = text did nothing
Not getting a response 🤔
Any errors?
Nope
@blissful coral log everything
I am doing it rn
Does it not say "Made new document!"?
Nope
const { Schema, model } = require(`mongoose`)
const Guild = Schema({
id: String,
prefix: {
default: '?',
type: String
}
})
module.exports = model(`Guild`, Guild)
That is the export for GuildModel
Doesn't get past doc.save()
self.bot.tempf = textdid nothing
@hasty mulch @trim saddle @hollow sedge
why are you doing bot.tempf
why cant it just be tempf?
you cant just add new properties like that
@hasty mulch
On another command I used just “shuffle” and that didn’t work, was told to do bot.shuffle, and it worked @hollow sedge
well anyway you cant add new properties like that
so just define them as a global variable
or put them in their own class and define an object of that class as a global variable
Then how come only this one doesn’t work?
because it was never defined as a variable in the class
[...iterable]
alguém sabe como posso saber quais membros tem o cargo?
oh
does anyone know how can i know which members have the role?
What library are you using?
discord.js
You could use <Guild>.members.cache.filter(...)
0.0000003500 anyone know how to get rid of the 0's to the right of the 35 in javascript?
Yeah I asked because it removes the 0s when you turn it into a string
maindb.js
const pool = mysql.createPool({
host: 'localhost',
user: 'root',
password: 'seminole2005',
database: 'boxfights',
charset: 'utf8mb4'
})
queries.js
const pool = require(`./maindb`)
module.exports = {
GuildConfig: function(guildid) {
pool.query(`SELECT * FROM GuildConfig WHERE guild = ${guildid}`, (err, results) => {
return results
})
},
}
command.js
const db = require(`../db/queries`)
module.exports = {
async execute(client, message, args) {
const { column1, column2, column3 } = db.GuildConfig(message.guild.id)
},
};
This should return the columns results right?
for each one
no
You try returning results in the callback in GuildConfig, but as it's a callback, it's not propagated to the return of the GuildConfig function.
Some solutions would be to accept a callback as a second parameter to GuildConfig and to call it with err and results, or you could use promises with new Promise((resolve, reject) => {...})
That's the only error I see in your code at first glance. You can always try it out and see what results you get.
var n = Number("3.5e-7").toFixed(10)
console.log(parseFloat(n))``` whenever i run this i get 3.5e-7
i want it to output 0.00000035
I believe that's just due to the way it's displayed to you.
It's value is still 0.00000035
Try and log it without the parseFloat() around n.
wanted to get rid of the zeros on the end so it is easier to read in a big list
yes i use it
i believe so
npm install discord.js for example
is requesting i install the discord.js
right?
my bot is not turning on
i cant stop and run
stay STOPPING forever
i hate when it happens
i cant turn on my bot
i am trying to turn on him
him turn on before, but when i put commands and turn on again my bot
he didn't turn on
it looks like because it STOP in the page, but it's not turned on
sorry for my english, i am brazilian
you can see i am brazilian for the image
isnt that your linter showing bad closure?
Feedback.
Try not to use ENV AND JSON at once, while theres no problem using both, its better to chose one or another
Multiple line declaration const a,b,c,d;
Merge does IF statements
startsWIth() can have operators inside, no need for repetition
try catch is bad for command handler since it will fail if someone tpyes your prefix and some random commmand infront
@earnest phoenix
it's requesting quick.db but i cant install
ok
i am trying for 30 minutes
to install everything is requesting
i made a bot, but i deleted, and i made the same things to construct this
and is joking with me
How do I make a log in with discord feature on a web page?
They look the same to me...
Ohhh
I'd just do ${message.member}
and forget about the <@!$
Probably not. Look at these lines for your error: ```js
// #4
if (msg.content.startsWith("e!kiss")) return`
// #5
msg.channel.send(`<@!${msg.author.id}> UwU you kissed <@!${mentioned.user}
This is just off your second code block.
Like I said, try it out and see. It only takes a second or two to plop it into your code editor for it to tell you what's wrong
if(message.content.startsWith("e!kiss")){return msg.channel.send(`${message.member} UwU you kissed ${message.mentions.members.first()}`)}
I believe this is the solution
return?
Return stops everything after the function from working
if the content of the message starts with "e!kiss", don't go further
You don't have to return, but you can
no i mean i dont think you return that
notice the logical error there
i know what a return is
What is the logical error?
if the command does not start with e!kiss, it doesn't run
refrain from spoon-feeding code next time
which will also lead to an infinite loop forgot the ignored bots at the top
False
False
@boreal flume he was talking about neglected, not yours
also i can just send e!kiss and i broke your command
yes
You did not cry
you cant return that
you can return it
why would you return that
I normally dont
run the command in a dm, another thing broken
tldr just explain it instead of spoon-feeding
Running it in DMs would not break the command
yes it would
members do not exist in dms
really the entire code snippet is incorrect
Members do exist in DMs, just no GuildMembers
Those are called users, and there are only two: you and the person you're talking with.
Correct
😆
I have done some testing.... and it definitely breaks in DMs
Though, I could likely make it work in DMs
It is msg...
I usually use message so everywhere in the snippet that says message is incorrect
neglected I don't want to come off rude, but you need to learn JavaScript before you try writing a bot. Most questions you ask are very primitive.
I have made it work in DMs
congrats
Read up on the discord.js documentation neglected
bot.on('message', msg => {
if(msg.content.startsWith("e!kiss")){
let member = msg.mentions.users.first() || 'No one'
return msg.channel.send(`${msg.author} UwU you kissed ${member}`)
}
})
Working in DMs
So you know no javascript?
you should learn js before you learn discord.js
How do you go to a new link in my discord bot's description?
\n doesn't work
How do you go to a new link in my discord bot's description?
\n doesn't work
@earnest phoenix What do you mean?
Everyone sent me discord.js thinking I know javascript but plot twist I didnt
@earnest phoenix plot twist learning X before using discord.X is a reasonable expectation
That or press enter two/three times
YES <br> worked.
Ok
Most people will just send you library documentation regardless.
he likes the color green
fair

Rumors say he couldn’t handle the pressure and the fear 
ahyes, let's learn a deeper part of programming without knowing how to print to terminal
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.
@sage bobcat You don't have to waste your time explaining your experience and what not, i have already told him what he could do and for him to learn it but it's like I'm talking to a wall 
One message removed from a suspended account.
Everybody makes mistakes
lots of people hate egirls
One message removed from a suspended account.
lots of people hate egirls
@quartz kindleYou just roasted the entirety of Twitch
and the entirety of haters
egirls girls don't even exist, most here are just guys acting like them 
Damn
@quartz kindle Does JS ASM exist?
@sage bobcat ngl i learned python from bot templates
and i sorta just picked up on js easily
message.member.id is giving me "cannot read property 'id' of null" in discord js library... this just started today
likewise, message.member.roles.find cannot read property 'roles' of null
did they just change how message.member works? Weirdest part is it only happens sometimes, not all the time
is member a proper attribute in message?
should be; it's been working for almost a year now
as long as the message is from a member of a server
Why it says this on my website ?
is not appropriate
My website has no explicit material
No abusive word
Dyno.gg opens
My website is similad
My website is similad
I'm also having problems with member, not sure if it's the same reason
Why it says this on my website ?
@delicate shore cause of all the fake reviews there 😆
Who is that
@clever dust pls tell @hollow sedge that you gave the feedback of black sheep bot
He changes his pfp
But he gave it
And jam is this person
"I used to enjoy watching PGamerX play games and do stupid stuff on youtube.
But now I enjoy using bots , meme generator and other things developed by him
I really can't believe that he is the one I used to watch on youtube 3 years ago"
"I used to enjoy watching PGamerX play games and do stupid stuff on youtube.
But now I enjoy using bots , meme generator and other things developed by him
I really can't believe that he is the one I used to watch on youtube 3 years ago"
@hollow sedge
You mean this
Yeah this is fake
Yea
But fr turn off your parents website blocker or whatever
That's what's causing your problem
@clever dust pls tell @hollow sedge that you gave the feedback of black sheep bot
@delicate shore ok
hey @hollow sedge , i left the feedback of black sheep bot
Ok cool
k bye
Lol
Wdym lol?
Are you like 9 years old that they need to watch over you like that 😆
Anyway that's an entirely different problem
No
But if you turn that off then you can access your site
@bot.event
async def on_member_join(member):
await member.add_roles(discord.utils.get(member.guild.roles, name="Syndicate Members"))
await member.add_roles(discord.utils.get(member.guild.roles, name="In Training"))
channel = discord.utils.get(member.guild.text_channels, name="sydcranklogs")
await channel.send(f"`Syndicate Members` and `In Training` was given to `{member.name}({member.id})` by `Auto Role`")```
it wont role both of the roles, even when i make them seperate events, please help. i just need it to autorole both
Quick question, I'm not really good with classes... By doing this will it create several warns maps or just keep one until the process restarts
@restive lily what's your intents setup looks like?
@earnest phoenix wym by that
intents, you would need to enable members intent in order to get member_join event
here's the usual setup for that ```py
import discord
from discord.ext import commands
intents = discord.Intents.default()
intents.members = True # Subscribe to the privileged members intent.
bot = commands.Bot(command_prefix='!', intents=intents)
This example enables members intent explicitly @restive lily
bot.on("guildCreate", guild => {
if (guild.memberCount < 6) {
guild.owner.send(`your server doesnt have enough members`)
guild.leave()
}
})
TypeError: Cannot read property 'send' of null
why
ok stella i just added that to the top and ill let u know if ut works or not
and i enabled the intents
on the dev portal
okie
your discord.py seems outdated
update to 1.5.1
probably your host have 1.5 but your local didn't
i updated it last night
put print(discord.__version__) and see what it prints
it shows your discord.py version
the error went away 💀


