#development
1 messages · Page 1173 of 1
or only for 100+server bots
idk, forgot which one was it
So if we modify it
We can still use it
well yes, but I don't see the point
there isn't much difference except .cache from v11 -> v12
That’s false
embeds too
and they even made a well-documented migration guide
Fetching message too
embeds too
@thick gull who even uses the embed builder? /s
theres embed builders/visualisers out there
some of the code generated is those without OOP
https://hasteb.in/afacetuq.js my bot is not playing music but why?
yes i don't know how can i fix it. i play a mp3 stream
quick question, how do i print fades like this?
Google Is Your Friend If someone askes you annoying questions, tell him about giybf.com!
oh fr?
yes i don't know how can i fix it. i play a mp3 stream
@low phoenix if thats the case. http://giybf.com/
Google Is Your Friend If someone askes you annoying questions, tell him about giybf.com!
🙂

How can a bot check if the user has his/her DMs on?
you can't, discord will only give an error if you cannot send a dm message to a user
discord will only give an error if you cannot send a dm message to a user
you process that error and send another message in the channel?
I dont think dyno does send errors about dms
No, I mean in a message to the author
Are you saying about sending errors to message.author in dms
They implemented a new spam filter.
no its like, how fast it gets added to discords or how many times it sends a dm or something
not sure exactly
you have to file a support request afaik
no its like, how fast it gets added to discords or how many times it sends a dm or something
@oak cliff wdym?
first part
How fast the bot gets added to guilds
like if you suddenly get your bot added to a thousand guilds in one day when previously you were only getting like 5
okay so my bot hasnt been added to any server in 100 years
private bot
;-;
its a custom bot for a big server and still sigh
the new system officially killed half the bots
Wait i think its only effect on unverified bots
Coz my other bots which legit do work more then the one being flagged isnt flagged
any1 know canvas?
canvas for me was: fiddle around with it till you get it
and I literally do not know how to explain it
@thick gull can i ask u something?
Yeah?
Thats not a question
i'm trying to add image at the end
Thats not a question
@pure lion -_-
i'm trying to add image at the end
but the image highest not enough i guess
is there a way to make the image highest auto fill or something ?
hastebin is a little buggy on mobile
send the code here ?
nah
I think you can use vh/vw if that's a thing
It's a measurement of the percentage of the dimension of the canvas
I'm getting a error about code I've never written- Can someone help please? (D.js)
error
Error: val is not a non-empty string or a valid number. val=null
at module.exports (C:\Users\Jon\Desktop\SpiderBot Project\node_modules\ms\index.js:34:9)
at BaseClient.SpiderBotUptime [as Uptime] (C:\Users\Jon\Desktop\SpiderBot Project\index.js:47:14)
at Object.<anonymous> (C:\Users\Jon\Desktop\SpiderBot Project\index.js:52:26)
at Module._compile (internal/modules/cjs/loader.js:1200:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
at Module.load (internal/modules/cjs/loader.js:1049:32)
at Function.Module._load (internal/modules/cjs/loader.js:937:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
PS C:\Users\Jon\Desktop\SpiderBot Project>```
My code worked fine a few days ago, And all of a sudden I get the error
something you're trying to parse using the ms package is not a valid number
read the trace
I've never used ms
should I use mongoose to have server specific configs for custom prefixes etc?
Nevermind I've used ms once and its never been a problem
never used ms but it's in your node_modules folder bruh
https://hastebin.com/kazomoqaho.js
line 68
i'm trying to add image at the end
but the canvas image highest not enough i guess
is there a way to make the image highest auto fill or something ?
https://cdn.discordapp.com/attachments/272764566411149314/746281304475304036/bufferedfilename.png
I am getting missing permissions error even if i gave my bot adminstrator permission
what is wrong
How can I read 4 values in each 212 arrays without having 1k+ lines?
missing permissions with admin = you’re probably trying to access another server that your bot isn’t in
How can I read 4 values in each 212 arrays without having 1k+ lines?
@carmine summit what
can you use a better translator
I am getting missing permissions error even if i gave my bot adminstrator permission
@wanton anvil what exactly are you doing to get that error?
Why not just explain it here
it's a bit though
I want to read 4 values inside 212 arrays without having 1k+ lines of codes
inside of 212 arrays?
Is there any specific filter you need to use?
no filters
random numbers
Hold on. Do you mean 4 values inside of each array?
And how do you want to.. well, store them?
why do you want to do that
i want ot store them
what
all i want is to store them then put it inside variables
you want to store random numbers from 212 arrays into something?
yyeah
and if the bots detect something like (buyPrice < sellPrice)
it will message.channel.send
why are you using arrays
its an API
bruh
JSON formatted
k
you’re using an api to do a merch system?
perch system?
its a game
with an economy
and if the bots detects a price crash
it will send it
thats why i have 212 arrays to search
and 4 values to get
in each array
can you send one array here
so i’ll be able to see what they look,like
and help u
is this a good way to make sure a comamnd can only be used by admins?
because for some reason it doesn't work
thats not how it works
thats a class @eternal osprey
you need A guildmember, not GUILDMEMBER
owh
if that makes sense
looks like you copy pasted a awful discordjs guide
nvm i got it already
you're importing a class
lack of understanding of OOP in general
that too
i should get the id of my guild
What the hell did I just read about a command not working +_+
that’s not an array, that’s an object
I have 15 .addField() but I only want 10 to show in one embed page.
how do I maintain the number limit?
ohhh
remove 5 add fields
sorry i dont know the difference
there's the option of if (x % 10 !== 0) addField() in a for-loop
huh
no wait
i've never used that operator, so ngl, dont even know how it works
... ofc I forget about cases like 9 % 10 where 9 is returned
i want to read object.products.BROWN_MUSHROOM.quick_status.buyPrice
and it not just BROWN_MUSHROOM i want to read
there are 211 more
oh i see
that operator can be quite handy

though i usually just cast into an object with a while loop
the other object is same.. all i want to change isbrown mushroom
set that value
since it has is in it, i assume its a bool
wait, i think theres a typo there and i misunderstood
what do you want to change in brown_ mushroom?
How do you do integer division in JS if // is comments?
i thought you meant is_brown_mushroom
"BLAZE_ROD","BLESSED_BAIT","BONE","BROWN_MUSHROOM","CACTUS","CARROT_BAIT","CARROT_ITEM","CATALYST","CLAY_BALL","COAL","COBBLESTONE","COMPACTOR","DARK_BAIT","DIAMOND","EMERALD","ENCHANTED_ACACIA_LOG","ENCHANTED_BAKED_POTATO","ENCHANTED_BIRCH_LOG","ENCHANTED_BLAZE_POWDER","ENCHANTED_BLAZE_ROD","ENCHANTED_BONE","ENCHANTED_BONE_BLOCK","ENCHANTED_BREAD","ENCHANTED_BROWN_MUSHROOM","ENCHANTED_CACTUS","ENCHANTED_CACTUS_GREEN","ENCHANTED_CAKE","ENCHANTED_CARROT","ENCHANTED_CARROT_ON_A_STICK","ENCHANTED_CARROT_STICK","ENCHANTED_CHARCOAL","ENCHANTED_CLAY_BALL","ENCHANTED_CLOWNFISH","ENCHANTED_COAL","ENCHANTED_COAL_BLOCK","ENCHANTED_COBBLESTONE","ENCHANTED_COCOA","ENCHANTED_COOKED_FISH","ENCHANTED_COOKED_MUTTON","ENCHANTED_COOKED_SALMON","ENCHANTED_COOKIE","ENCHANTED_DARK_OAK_LOG","ENCHANTED_DIAMOND","ENCHANTED_DIAMOND_BLOCK","ENCHANTED_EGG","ENCHANTED_EMERALD","ENCHANTED_EMERALD_BLOCK","ENCHANTED_ENDER_PEARL","ENCHANTED_ENDSTONE","ENCHANTED_EYE_OF_ENDER","ENCHANTED_FEATHER","ENCHANTED_FERMENTED_SPIDER_EYE","ENCHANTED_FIREWORK_ROCKET","ENCHANTED_FLINT","ENCHANTED_GHAST_TEAR","ENCHANTED_GLISTERING_MELON","ENCHANTED_GLOWSTONE","ENCHANTED_GLOWSTONE_DUST","ENCHANTED_GOLD","ENCHANTED_GOLDEN_CARROT","ENCHANTED_GOLD_BLOCK","ENCHANTED_GRILLED_PORK","ENCHANTED_GUNPOWDER","ENCHANTED_HAY_BLOCK","ENCHANTED_HUGE_MUSHROOM_1","ENCHANTED_HUGE_MUSHROOM_2","ENCHANTED_ICE","ENCHANTED_INK_SACK","ENCHANTED_IRON","ENCHANTED_IRON_BLOCK","ENCHANTED_JUNGLE_LOG","ENCHANTED_LAPIS_LAZULI","ENCHANTED_LAPIS_LAZULI_BLOCK","ENCHANTED_LAVA_BUCKET","ENCHANTED_LEATHER","ENCHANTED_MAGMA_CREAM","ENCHANTED_MELON","ENCHANTED_MELON_BLOCK","ENCHANTED_MUTTON","ENCHANTED_NETHER_STALK","ENCHANTED_OAK_LOG","ENCHANTED_OBSIDIAN","ENCHANTED_PACKED_ICE","ENCHANTED_PAPER","ENCHANTED_PORK","ENCHANTED_POTATO","ENCHANTED_PRISMARINE_CRYSTALS","ENCHANTED_PRISMARINE_SHARD","ENCHANTED_PUFFERFISH",
integer division
"ENCHANTED_PUMPKIN","ENCHANTED_QUARTZ","ENCHANTED_QUARTZ_BLOCK","ENCHANTED_RABBIT","ENCHANTED_RABBIT_FOOT","ENCHANTED_RABBIT_HIDE","ENCHANTED_RAW_BEEF","ENCHANTED_RAW_CHICKEN","ENCHANTED_RAW_FISH","ENCHANTED_RAW_SALMON","ENCHANTED_REDSTONE","ENCHANTED_REDSTONE_BLOCK","ENCHANTED_REDSTONE_LAMP","ENCHANTED_RED_MUSHROOM","ENCHANTED_ROTTEN_FLESH","ENCHANTED_SAND","ENCHANTED_SEEDS","ENCHANTED_SLIME_BALL","ENCHANTED_SLIME_BLOCK","ENCHANTED_SNOW_BLOCK","ENCHANTED_SPIDER_EYE","ENCHANTED_SPONGE","ENCHANTED_SPRUCE_LOG","ENCHANTED_STRING","ENCHANTED_SUGAR","ENCHANTED_SUGAR_CANE","ENCHANTED_WATER_LILY","ENCHANTED_WET_SPONGE","ENDER_PEARL","ENDER_STONE","FEATHER","FISH_BAIT","FLINT","FOUL_FLESH","FUMING_POTATO_BOOK","GHAST_TEAR","GLOWSTONE_DUST","GOLDEN_TOOTH","GOLD_INGOT","GRAVEL","GREEN_CANDY","GREEN_GIFT","HAMSTER_WHEEL","HAY_BLOCK","HOLY_FRAGMENT","HOT_POTATO_BOOK","HUGE_MUSHROOM_1","HUGE_MUSHROOM_2","ICE","ICE_BAIT","INK_SACK","INK_SACK:3","INK_SACK:4","IRON_INGOT","LEATHER","LIGHT_BAIT","LOG","LOG:1","LOG:2","LOG:3","LOG_2","LOG_2:1","MAGMA_CREAM","MELON","MINNOW_BAIT","MUTTON","NETHERRACK","NETHER_STALK","OBSIDIAN","OLD_FRAGMENT","PACKED_ICE","PORK","POTATO_ITEM","PRISMARINE_CRYSTALS","PRISMARINE_SHARD","PROTECTOR_FRAGMENT","PUMPKIN","PURPLE_CANDY","QUARTZ","RABBIT","RABBIT_FOOT","RABBIT_HIDE","RAW_BEEF","RAW_CHICKEN","RAW_FISH","RAW_FISH:1","RAW_FISH:2","RAW_FISH:3","RECOMBOBULATOR_3000","REDSTONE","RED_GIFT","RED_MUSHROOM","REVENANT_FLESH","REVENANT_VISCERA","ROTTEN_FLESH","SAND","SEEDS","SLIME_BALL","SNOW_BALL","SNOW_BLOCK","SPIDER_EYE","SPIKED_BAIT","SPONGE","SPOOKY_BAIT","STOCK_OF_STONKS","STRING","STRONG_FRAGMENT","SUGAR_CANE","SULPHUR","SUMMONING_EYE","SUPERIOR_FRAGMENT","SUPER_COMPACTOR_3000","SUPER_EGG","TARANTULA_SILK","TARANTULA_WEB","UNSTABLE_FRAGMENT","WATER_LILY","WHALE_BAIT","WHEAT","WHITE_GIFT","WISE_FRAGMENT","WOLF_TOOTH","YOUNG_FRAGMENT"
pick one
Python:
>>> 5 // 2
2
>>> 5 % 2
1
JS:
>>> 5 / 2
2.5```
thats an array cwic
that % operator i just looked at
Modulus (division remainder)
it divides by that number and then returns the extra
10 / 3 = 3.33333
10 % 3 = 1 (9 which is maximum whole divisor of 3, then 1 which is extra)
The maximum divisor operator
10 / 3 = 3.33333
10 % 3 = 1 (9 which is maximum divisor of 3, then 1 which is extra)
@opal plank im confused about this
it's not directed at you
^^
ah
Hey
i think i know what you mean
lemme see if theres an operator for that or if you have to use that
I gave you a fucking Python script as an example 
goose
My music bot is working perfectly but it's not going deafen like other bot like groovy and Rythm what to do?
:/
Make sure the bot can deafen itself with the DEAFEN_MEMBERS permission
Luck
How to do that
let:number = x
x - (x % y) / y
Oh disgrace JS
so you get whole number
Time to use IPC with a Python script 😂
ipc is fun to play with
thats what i use for communicating between the different bots
Hosting a local webserver that returns calculations lmao
recommendation: set silent mode true
Heh
otherwise it'll log every operation on ipc
If only I had an actual use case for it
make a bot in 5 different langs and use ipc to interact with eachother
that sounds like fun
The problem in my bot is Not deafening itself and 🙄 Not staying in the vc after the song ends
Can anyone help me with the problem?
i also need to port my shit to redis
this is growing out of proportion
had a spike of 200k registered users in that short span of time
postgres isnt keeping up with 5k calls per minute
Jesus
i do wanna bring that number higher if possible to be able to hold that many calls
but it needs to scale accordingly
currently i hit a wall with 800k users active at once
hey guys
luckily enough IPC is keeping up
so not gonna have to change anything in that regard
but non admins can still see the message
whats the best way to have server specific configs for custom prefix settings etc
any way how to make sure they can't see the contents of this command
you should use final permission @eternal osprey
though administrator should be fine in that case
though still good practice to account for channel overrides
@earnest phoenix likely store them in memory and in a database for long term
I am not that known with the command final permission. I will look at the docs.
map it with guildid and prefix
but how do i make sure someone can't see the command
lemm get you the guide for it
without admin rides
@opal plank what db should i use for it?
lovely
i use postgres, but thats because i have a huge amount of users, SQLlite or something smaller might be what you need
im gonna get that google cloud trial but gotta use another cc from my family since my own cc is already used lol
it usually boils down to preference most times
i still remember when i used json for database
oh god the fucking file was corrupted every minute
Oof
Mongo /postgres / sql / sqlite, pick whichever tou like
so i looked through the docs
{ VIEW_CHANNEL: false });
i guess i gotta use this
this is the bit you wanna be looking for @eternal osprey
is that website yours?
wusup?
or is the host
the panel is mine, yes
i think you can better serach up a tutorial
is there like a command
im not sure how to compile py
Technically its possible to store in json without corruption
damn that sounds like nerd stuff
If you need to store json you could use something like this https://www.npmjs.com/package/jsoning
Porting Js code to Ts strict is the bane of my existance
help
its a #development channel
wut with
the heck were u expecting?
i havent got the answer to my previous question
i did tell the answer for that
but that was another person
i think cw was stuck with his brown_mushroom something something
is it
message.guild.prefix = hehaha
im not sure how to compile py
@opal plank https://datatofish.com/executable-pyinstaller/
Need to create an executable from Python script using pyinstaller? If so, I'll show you the full steps in Windows to accomplish this goal.
Also... MENHERA-CHAN!!! THAT WAS MY PFP LIKE 2 YEARS AGO
or use thonny
Well, that's an interpreter :^)
i dont even know if this was a dependency for something or if i compiled code
its likely a dependency
shiv might be able to tell you that
i want to read object.products.BROWN_MUSHROOM.quick_status.buyPrice
and i would like a loop to change the "BROWN_MUSHROOM" to 211 other objects. to get its value
Most apps used to require python2.7
ive got no experience with py
aight
i think i remember what it was
Not sure what you mean exactly
Jekyll is Ruby, no?
nah
actually
yeah
i meant nah as in 'was something else'
i dont recall what needed that
kek
i want to read object.products.N.quick_status.buyPrice and object.products.N.quick_status.sellPrice
and if (sellPrice > buyPrice) it will message.channel.send
I doubt it was something tbh. I'd expect Python2.7 at most but some applications do use Python 3.8
@carmine summit i have absolutely no idea what you trying to do
okay...
wahts the diffrence?
im not sure
whatever those 212 items are composed of
how to define in python
object
Define what
its an object then cw?
cw???????
define discord
import discord
what is cw?
Make sure you install discord.py with pip first
you
ok
you are cw, for the sake of me not having to type full name
Tell me one thing
its an object then
its an object then cw?
@opal plank yes
Are you experienced with Python, Magma?
so how is that object formatted?
Why are you trying to create a Discord bot as your first Python project?
so how is that object formatted?
@opal plank wdym
obecj.Brown_mushroom ? or you need to filter properties insde?
coz thats all i know how to make
object.products.BROWN_MUSHROOM.quick_status.buyPrice
i want to read the value of buyPrice
Please take a step back and get a hang of basic Python first
aight
https://automatetheboringstuff.com/ (for complete beginners to programming)
https://learnxinyminutes.com/docs/python3/ (for people who know programming already)
https://docs.python.org/3/tutorial/ (official tutorial)
http://python.swaroopch.com/ (useful book)
see also: http://www.codeabbey.com/ (exercises for beginners)
check these out
who here codes on node.js
{
products: {items}
}
@carmine summit growtopia very nice game
like this i assume?
jekyll? isn't that a static site generator that you can use on github
@carmine summit growtopia very nice game
@earnest phoenix dont mind it
yes indeed flaz
okay, we getting somewhere
@carmine summit i play it
@carmine summit i play it
@earnest phoenix i quit it
now what you want to do with BROWN_MUSHROOM ?
oof
read ...quick_status.buyPrice
by doing that you already reading the value
object.products.BROWN_MUSHROOM.quick_status.buyPrice
i have 212 objects
this will return buyPrice
i would like to create a loop
what are some free hosts
then for(let a in object.products) {//do stuff}
@timber plume dont use free hosts
im broke rn
then for(let a in object.products) {//do stuff}
@opal plank can you explain
i dont earn money
let obj = {
a: 1,
b: 2,
}
let int = 0;
for(let something in obj) {
int + something
}
int (returns 3);
for() is a loop
you are looping each property inside the object
so its adding int(0) + 1(a) in the first loop, then int(1) + 2(b) in the second, return 3
needless to say you can do whatever you want inside, not only additions
but if you want a loop for works just fine
though there are better methods depending on what you're doing
im still confused
about what?
all
wdym all?
all
i assume you would know the rest by now, its basic syntax
but it only works if its an array
but you aint using arrays dude
you said yourself, its an object
what is a: ?
let myvariable = 1;
let myarray = [1, 2, 3];
for (number in myarray)
{
// this loop body is executed on each iteration (an iteration is a run through the loop body ONCE)
myvariable += number;
// what happens is that JS loops through this loop body THREE times because length of `myarray` is 3
// and on each ITERATION, `number` changes from 1 to 2 and 3, and added to `myvariable`
}
console.log(myvariable); // Will return 7, because 1 + 1 + 2 + 3 = 7
i need object
I did use for of though
for in
what's the fucking difference between them, bismillah
wdym by (number in myarray)
this explains a bit more thoughrouly
Imagine you going through a box of coins
there's 3 coins: 1, 2, 3 dollar coins
If you go from the left (start of the array), you get one coin. That coin happens to be 1 dollar. You do something with it, and then get to the next coin (2 dollars), do something with that coin, and move to the third one
@carmine summit ^^
i think im catching it
foor just loops the entries
alright i be coding and i be chat if i need help
aight
Using type annotations is fucking painful
Imagine using typescript
fking badge

Python 
interfaces are a pain
ik, im using ts, i feel your pain
at least we can do :any if we really feeling like it
A friend of mine had to use one and I had to Google the answer for him
because he was literally clueless about it
took me a couple hours to figure out types in ts too, ngl
kek
strict mode is a bitch
And as in looping through arrays or objects, doing for (let variable of(or "in" for objects) array) { is better than for (variable of( or "in" for objects) array) { but as both works, i have no idea behind why is the first recommended

how can i make a loop that runs every 3 seconds?
Set an interval
let just declares it in the scope
var would be good if you wanna keep the value in that case
setInterval(() => {
// Function or whatever you do
}, 3000);```
Do you mean a loop with an interval between each iteration with 3 seconds?
Or a snippet of code that runs every 3 seconds?
tysm
im not saying you shouldnt
but usually, you shouldnt
idk what you trying to do but remember doing that with discord api(which i likely think you'll be doing) is bad
a snippet that runs every 2 seconds
does it use the discord api?
yeah D:
why
API abuse
^^
API abuse is not tolerated resulting in ratelimits
as a dev you have responsibilities too
its ok as long as i dont reqquest 120 requests a minute
Just because X doesn't hit the ratelimits doesn't mean it's automatically good
No, making more than 25 requests per minute without user input is API abuse
that'll likely trigger internal spam flags
Wow
maybe 10 seconds will be nice??????
how about if its not user input, 5 minutes?
Even 1 minute is not good
uhhhhhhhhhh
the only rare instances ive seen shit require lower than that and went by without too much issue is pokecord, which needed to ask for special permission for rate limits
5 minutes if no user input, it's ok, if there's user input, 10 seconds is fine
if you're doing something for your server only, i dare say even 2 mniutes is fine
For example, a user input is when a user uses a command to trigger the bot, but if there's no user input and the bot does something automatically, that means "no user input"
in a channel or two max
but going for a bot that can be added anywhere with that kind of automation is definetly asking for trouble
if voice and voice.is_connected():
await voice.disconnect()
I want to make an automatic leave function for my music bot whenever the music/queue ends, the bot should leave. How would i change the if state to make it disconnect. I'm using ffmpeg and ytdl for the music commands by the way
... probably use a custom event?
<Wait python has ytdl too>
What does your code look like rn?
mine?
yes
whats the recommended interval if no user input and requires using API?
5 minutes
ok then
there isnt a set value, but 5 mins should be fine
but for testing can i do 5seconds?
Even for Testing, it's a bad thing
just remember that none of us are discord devs/employees, we can only tell you good practices but its not up to us to judge
it shouldnt last long
ehh testing is a bit of an exception
if voice and voice.is_connected():
await voice.move_to(channel)
else:
voice = await channel.connect()
song_there = os.path.isfile("song.mp3")
try:
if song_there:
os.remove("song.mp3")
queues.clear()
except PermissionError:
await ctx.send("Music playing.")
return
ydl_opts = {
'format': 'bestaudio/best',
'quiet': True,
'postprocessors': [{
'key': 'FFmpegExtractAudio',
'preferredcodec': 'mp3',
'preferredquality': '192',
}],
}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download(['https://www.youtube.com/watch?v=9mEyJCXv9B8'])
for file in os.listdir("./"):
if file.endswith(".mp3"):
name = file
os.rename(file, "song.mp3")
voice.play(discord.FFmpegPCMAudio("song.mp3"), after=lambda e: print(f'{name} has finished playing.'))
voice.source = discord.PCMVolumeTransformer(voice.source)
voice.source.volume = 0.10
Oh
waw
my bad,
which event/command is that
command for a specific yt link
it should be played upon using it and then the bot should leave when it finished playing
is this good?
Send the content of the file in a hastebin
<You know nobody gonna download that file>
you also are not doing anything with that for loop
(for something in something) you arent doing anything here
oke wait
also number isnt defined
@opal plank Did you download the file and view it?
and would catch a bad error if you js is in strict mode
im pretty sure number is a blacklisted word
@earnest phoenix i did
Madlad
i just copied whats is necessary
how about NOT copying
The thing you did could work but it would log NaN into console
cuz both me and shiv were explaining you how it works
I only gave you an example and tried to explain how a for in loop generally works
its an example dude
CHILL
@carmine summit What are you exactly Trying to do in this case
i would like a variable that changes everytime a loop completes
inside loop? var. outside? let
Variable changes to?
indeed, you need the basics before doing a bot
luckily got me into a good mood today
usually i'd just foward them to learn js w3schools
what is that suppose to be?
next item
its not even an array
he said
I mean

What will be the next item?
can be fixed by learning js
A variable gonna be the next item?
shiv already told you
An array's element gonna be the next item?
Wot
@carmine summit So which and what's the purpose of your code
Can you show an example of what you're trying to do
im trying to get a value from 212 objects
Objects?
Those are elements
whats the iffeerence?
Object and elements are different things
what is an element for you
@tight plinth you're an element
An object is {} and an element is [ "bruh" ] (the thing in the array "bruh")
I'm talking seriously
object : {h: "j" }
property : h
value: "j"
array : ["hi"]
element 0: "hi"
Yes elements as you see is different
objects properties can contain anything from objects to arrays, numbers, strings, maps...
So if you're trying to get the next item of the array and log it to console or whatever, here's an example
let counter = 0;
let myArray = [1, 2, 3];
setInterval(() => {
console.log(myArray[counter]);
counter++;
}, 300000);
// Logs 1 after 5 minutes
// Logs 2 after 10 minutes
// Logs 3 after 15 minutes``` but i still don't know what else you're trying to do
objects are ez to do
object is confusing
like
Bruh an object can turned into an array and done the same
Bruh an object can turned into an array and done the same
@earnest phoenix how
Object.entries(<object>);```
let obj = {h: "hi" , g: {k: "hello"}}
obj.h returns "hi"
obj.g.k returns "hello"
Object.entries(<object>);```
@earnest phoenix i cant have 200 lines of this in my code
as i was trying to say
its 212 objects
you gotta go through all of them
o k ?
=>
Object.entries({
Bruh: "Nani",
Huh: "Wot",
Hmm: "Damn"
});```
<=
```js
[ ["Bruh", "Nani"], ["Huh", "Wot"], ["Hmm", "Damn"] ]```
you can do forEach with arrays
So you can work with this array as my example showed
you can do forEach with arrays
@tight plinth He logs an item every 5 minutes with an interval
i cannot convert the object into an array since its an API
No
Api returns a promise
If you resolve it, it turns into an object
And then you can turn that into an array
And then you can turn that into an array
@earnest phoenix how
its basics on js && communicating with APIs btw
For example, this is our base url, let's assume this is an api and returns an object as a response
https://api.example.com```
We make a request to get the object
```js
require("node-fetch")("https://api.example.com").then(res => res.json());```
This return
```js
{
Hey: "This is a test",
Hi: "Hmm",
Oof: "No"
}```
And now we want to resolve the promise to use this freely
```js
let getObject = await require("node-fetch")("https://api.example.com").then(res => res.json());
let turnObjectIntoArray = Object.entries(getObject);
turnObjectIntoArray; // [ ["Hey", "This is a test"], ["Hi", "Hmm"], ["Oof", "No"] ]```
@carmine summit ↑
Breh pointing at my message
I know how to read APIs
the problem is i got to read 212 different objects
and its gonna take a load of space
and i need to simplify it
or create a loop
let myObjects = <Your object here>;
for (let object in myObjects) {
// Do something with this specific object, for example access it's property and change it
object.value = 3;
}```
so i have to copy paste that 212 times?
Bruh
That iterates through all of your 212 objects
explain more
Explain more of which part
let myObjects = <Your object here>;
its ur object
Voltrex, in the loop you gave object will be every key, not every value
When my friends want to initiating cmd, it keep saying reference error at token
let myObjects = <the objects you received from the api>;```
Example: (I'm not showcasing an object from an api but still the same with an object received from the api)
```js
let myObjects = {
{
Something: "Bruh",
No: "Yes",
Yes: "No"
},
{
Huh: "test",
Some: "hmm",
Wtf: "Hold up"
}
}``` @carmine summit
@cinder patio What?
he ment that GoogleFeud
object will be the key in every entry, not the value
No it's the entire object
const obj = {a: {}, b: {}}
for (let object in obj) {
console.log(object); // a, then b
}
no
yes he does want that i assume
i am trying to read products.BROWN_MUSHROOM.quick_status.buyPrice
and BROWN_MUSHROOM is the object i want to change for every loop
Example:
let someObjects = { { hmm: "test" }, { huh: "another test" } };
for (let object in someObjects) {
console.log(object);
// First time it logs { hmm: "test" }
// Second time it logs { huh: "another test" }
}``` @cinder patio
I think you are confusing objects with arrays here...
Wot
{ { hmm: "test" }, { huh: "another test" } }; That's not valid syntax
[{}]
Aside from that, a for...in loop iterates through the keys in an iterable
const obj = {a: {}, b: {}}
for (let object in obj) {
console.log(object); // a, then b
}
@cinder patio This got my problem solved
thank you
Oh wait, this guy said his 212 objects were inside an object
That's what confused me
I said if his 212 objects were inside an object or array and he said object
So i was confused
bruh
but when i run the code, terminal bursted... but i want it to run every 3 seconds
how do i use timeout?
You'd want to use setInterval:
setInterval(functionThatYouWantToRunEvery3Seconds, 3000);
He's already using that
how can i exceed "z"?
{ { hmm: "test" }, { huh: "another test" } };That's not valid syntax
it is if he ment object
it is if he ment object
@restive furnace i got that working
Yea i did not notice
const obj = {a: 'muhahaha', b: 'lol'}
for (let object in obj) {
console.log(object); // a, then b
}
}, 3000);```
As he said object it got me confused
try to run this
is support wrong channel for that?
ignore the fact that i defined a and b
@vivid wadi You can't test your bot until it's approved
Gotta wait 4+ weeks
on my alt i had a bot
and i waited like some months
and it got declined
with no dm
Hello
hi 
Cwickks, That should output
a
b
Every 3 seconds
hello i want to add my bot to your site
yeah
-faq 1 @dire flower
@dire flower
Cwickks, That should output
a bEvery 3 seconds
dont confusw him more, he wants it act like that
Sa
Naber
-notr @timid terrace @dire flower
@timid terrace @dire flower
İngilizceden başka dillerde sohbet etmek için #memes-and-media kanalını, top.gg hakkında (Türkçe olarak da) destek almak için #support kanalını kullanın.
Bu kanalda Türkçe konuşmayın.
Ok @slender thistle
O ne doctor
When my friends want to initiating cmd, it keep saying reference error at token
Someone can help?
"refrence error at token" token not defined or invalid?
how do i define const obj ?
by doing const obj
How do i do bot count in serverinfo?
you can iterate through all the guild members, and add one to a counter if they are a bot
could somebody tell me if i could join this server for free?
if so can somebody give me an invite
ty
https://mystb.in/FashionGatewayStress.python
I'm looking for a random music command which will also queue up a random link upon using it once more.
However I'm not sure how to pick a random link and if it queue's up correctly
the code's in the link
if i have the server counter in the status on my bot do i need to do something to make it update automatically or does it do it already?
It auto updates
const obj = {a:"", b:""}
for (let object in obj) {
console.log(object); // a, then b
}
@cinder patio this code is good, but one of my object is called "logs:2" which messes with the syntax of how you define obj
okay now im suspicious i have 2 answers
If you want it to auto update without restarting the bot you can set an interval
Put it in like this {"logs:2": "some value..."}
i have 2 bots stable version for it and the dev build aka the one i use for testing before pushing it to the real bot
Kinda pog
so i can set up hosting on google cloud
can anyone tell me how this looks? https://buizelbox.tk/Privacy-Policy.html its the Privacy Policy for my discord bot
The Privacy Policy of BuizelBox
I wouldn't worry too much about the styling of your privacy policy ngl
just make it easily enough to be read
why align text by center though
you could probably align it to the left
it's because my whole website is aligned like that it would feel weird for me to change one page to look different
oh wait nvm I'm blind 
lol
You might want to add some kind of border-bottom for sections titles
because I can't differ them from the text itself
might want to add a colored line above the text and below the section titles
but yeah that's more or less bearable
x = list of url's to pick from
select = random.choice(x)
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download([url])
How to make it pick one of the random url (what should be written there instead of the ([url]))
just pass select?
random.choice returns a random element from an iterable based on a seed
and does ydl.download() require you pass a list, or just a string/some value
x = list of url's to pick from
select = random.choice(x) with youtube_dl.YoutubeDL(ydl_opts) as ydl: ydl.download([url])How to make it pick one of the random url (what should be written there instead of the ([url]))
@acoustic bridge What Lite said. Your variableselectIS the random url. So use that inydl.download(select)
i fixed it when i realized i had (url: str) as a parameter next to (ctx) - my bad
async def playlist(ctx, url:str):
can any one help me with this?
const bot = new Discord.SendEmbed()
^
TypeError: Discord.SendEmbed is not a constructor
ty
but
SendEmbed? that's not a valid constructor
you mean MessageEmbed?
or RichEmbed in v11 but that's wack
You probably want to keep bot functions somewhere away from when you first initialize the bot object
do i type it like this?
client.on("message", message => {
if (message.content === "-bot") {
bot.SendEmbed()
ok
the bot didn't start
Was there an error?
no nothing came out
nvm
it was loading
it says
bot.SendEmbed()
^
ReferenceError: bot is not defined
Didn't you define it previously with const bot = new Discord ?
Make sure that's the right way to do that
oh i forgot
||idk discord.js tbh||
i need yt api
it says
const bot = new Discord
^
TypeError: Discord is not a constructor
yes
please read docs
what about this?
const bot = new Discord
^
TypeError: Discord is not a constructor
why only Discord
if you want the embed constructor, it's Discord.MessageEmbed(), assuming you're on v12
it's new Discord.Client()
is the code .SendEmbed or .MessageEmbed becuase is says
bot.SendEmbed()
^
TypeError: bot.SendEmbed is not a function
You're getting to the part where you have to read the docs
Your bot object will have multiple properties and functions
The docs will tell you what they are and what it can do
here's an examplejs const Discord = require("discord.js"); const embed = new Discord.MessageEmbed().setTitle("Title"); // read the rest in docs message.channel.send(embed);
Like send a message
Plz don't copy and paste that example lol
ok
can you require something twice in js?
aq!help
ii have a question
what is it
i saw something saying about octobor and verified bot dev badge and im wondering after octobor ends will verified bot dev badge be gone
they won't be giving the badges anymore
oh
good riddance I say
they will, apparently just not the early dev one
oh?
there's both early verified dev and verified dev?
Shiv are. u sure?
nani
nice, now I want both
I think they're going to increase the requirements if there is going to be a new badge
Since I'm not sure, I'll blame Discord for their poor phrasing
it still not working this is the code
const bot = new Discord.MessageEmbed()
client.on("message", message => {
if (message.content === "-bot") {
bot.SendEmbed()
.setAuthor(client.user.username, client.user.avatarURL)
.setColor("#00000")
.addField(
"✽ Bot Ping : ",
» ${Date.now() - client.createdTimestamp} + " ms",
true
)
.addField("Servers : ", » ${client.guilds.size}, true)
.addField("Channels : ", » ${client.channels.size} , true)
.addField("Users : ", » ${client.users.size} , true)
.addField("Bot Name : ", » ${client.user.tag} , true)
.addField("Bot Owner : ", » <@686573386289119232 , @742791852327174145 >, true)
.setImage("")
.setFooter(message.author.username, message.client.avatarURL);
message.channel.send(bot);
}
});
as far as i know, they won't be giving the badge to new verified devs and it'll be renamed to early verified bot developer
run(message, client, args) {
let argsC = message.content.split(" ").slice(1);
if (!argsC[0]) {
return message.channel.send("Please mention someone");
}
const search = argsC.slice(0)[0];
let {
member
} = message;
if (message.mentions.members.size > 0) {
member = message.mentions.members.first();
} else if (search) {
member = client.findersUtil.findMember(message.guild, search);
if (member.size === 0) {
return message.channel.send(`❌ No members found \`${search}\`!`);
} else if (member.size === 1) {
member = member.first();
} else {
return message.channel.send(client.findersUtil.formatMembers(client, member));
}
};
if (!
message.member.hasPermission('BAN_MEMBERS')) return message.channel.send("You dont have the permissions! You are missing the ``BAN_MEMBERS`` permissions");
if (member.hasPermission("MANAGE_GUILD")) return message.channel.send("Failed to ban the user! (Higher permissions)");
let reason = argsC.slice(1).join(' ');
if (!reason) reason = 'No reason';
member.ban({ reason: `${reason}` })
.then(message.channel.send(`**${member.user.username}** has been banned from ${message.guild.name}`))
const banEmbed = new MessageEmbed()
.setAuthor(`Member banned | Issuer: <${message.author.id}>`, message.author.avatarURL())
.setDescription(`User: ${message.mentions.members.first()}\nReason: ${reason}`)
.setFooter(`Contact a staff member if you thing it was a mistake`)
client.channels.cache.get("744906283756290048").send(banEmbed);
}
}
I have this code and if I set message in run after client the permissions won't work. But if I do message first then client is undefined...
client.on("message", message => { if (message.content === "-bot") { bot.SendEmbed() .setAuthor(client.user.username, client.user.avatarURL) .setColor("#00000") .addField( "✽ **Bot Ping** : ", » ${Date.now() - client.createdTimestamp}+ " ms", true ) .addField("**Servers** : ",» ${client.guilds.size}, true) .addField("**Channels** : ", » ${client.channels.size} , true) .addField("**Users** : ", » ${client.users.size} , true) .addField("**Bot Name** : ", » ${client.user.tag} , true) .addField("**Bot Owner** : ", » <@686573386289119232 , @742791852327174145 >, true) .setImage("") .setFooter(message.author.username, message.client.avatarURL); message.channel.send(bot); } });
where did you execute the function?
Me?
yes
message.channel.send(bot). Are you okay?

@fringe axle yes but where? in the message event?
Wait is send.Embed possible ???
no
no
@fringe axle yes but where? in the message event?
@pale vessel In permissions
no, you have to execute the function but where?
if (!
message.member.hasPermission('BAN_MEMBERS')) return message.channel.send("You dont have the permissions! You are missing the ``BAN_MEMBERS`` permissions");
Const embed = new discord.MessageEmbed
brain
const bot = new Discord.MessageEmbed() why
Oop
That's the full code. (Hastebin coming)
``` interesting use of whitespace lol
const bot = new Discord.MessageEmbed()why
@knotty steeple lul that's like doingconst tomato = new Lettuce()
i have my own command framework
good to know
i'm out, never used commando before
@pale vessel ;_;
ye
You did send.Embed
@sharp thicket
do i type bot.Send(Embed) ?
no
it gives this error
earlier it was working fine
but when i shifted to gala....
it gives this
bot.SendEmbed() wtf is this
code
New function.
what language
english
Then at the end say message.channel.send(VariableName)
i did npm i over 1k times
install ur modules
i did npm i over 1k times
@delicate shore try npm i --save please
Uh
excuse me what
seems like u didn't
Npm i module —save
How the fuck would that change anything
or just use yarn smh
also, read errors, don't just spam npm i lmao
its not —
It's iOS
It is lol
That makes that weird -
var bot = new Discord.MessageEmbed()
like this?
yes









