#development
1 messages · Page 1061 of 1
You can make ur own file formats btw
:o
I once made a custom coding language using nodeJS and used a .cd (chickendev) extension
Can anyone help me with discord.py/json prefix - I am so close for it to being done, just 1 tiny bug
@copper cradle Any idea? On how to edit or at least read it so I can generate custom .bkm files
@earnest phoenix code?
@client.event
async def on_guild_join(guild):
chane = [x for x in guild.text_channels if x.permissions_for(guild.me).send_messages][0]
await chane.send('Thanks for adding me!')
servers = "{:,}".format(len(client.guilds))
await client.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name=f"{servers} servers | n!prefix"))
with open('prefixes.json', 'r') as f:
prefixes=json.load(f)
prefixes[str(guild.id)] = defaultp
with open('prefixes.json', 'w') as f:
json.dump(prefixes, f, indent=4)
@client.event
async def on_guild_remove(guild):
servers = "{:,}".format(len(client.guilds))
await client.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name=f"{servers} servers | n!prefix"))
with open('prefixes.json', 'r') as f:
prefixes=json.load(f)
prefixes.pop(str(guild.id))
with open('prefixes.json', 'w') as f:
json.dump(prefixes, f, indent=4)```
It's not storing the default prefix automatically on join
Hmmm
You have to set the prefix first, which I would like it to by default store it in the json
Then on join set the prefix?
Hmm
@client.event
async def on_guild_join(guild):
chane = [x for x in guild.text_channels if x.permissions_for(guild.me).send_messages][0]
await chane.send('Thanks for adding me!')
servers = "{:,}".format(len(client.guilds))
await client.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name=f"{servers} servers | n!prefix"))
with open('prefixes.json', 'r') as f:
prefixes=json.load(f)
prefixes[str(guild.id)] = defaultp
with open('prefixes.json', 'w') as f:
json.dump(prefixes, f, indent=4)
look.. I am
Check if there's no prefix in the Json and make it !
BY DEFAULT, it's not storing the default PREFIX
Then don't
I want it to
Make the prefix a global const
You don't just quit when something fails
can someone help for me making a github page
Never githubbed
why is one of my file just grey and not like other with color
So no one knows how to edit a bkm file?
Or something dumb
i don't
fixed it

@client.event
async def on_guild_join(guild):
chane = [x for x in guild.text_channels if x.permissions_for(guild.me).send_messages][0]
await chane.send('Thanks for adding me!')
with open('prefixes.json', 'r') as f:
prefixes=json.load(f)
prefixes[str(guild.id)] = "!"
with open('prefixes.json', 'w') as f:
json.dump(prefixes, f, indent=4)```
working code
Had to define !

does any one have good !help template
Lang?
?
What language
js
discord.js
Template:
So nobody knows how to open .bkm files?
im newbie
let help = new Discord.MessageEmbed()
Hi, so I want after the bot sends a message it will send Do you want to buy a house? then wait for an answer the proceed from there :
message.channel.send(`Do you want to buy a house?`).then(message => {
const yes = require("./yes.json")
if (message.content === `yes`|| `Yes`||`${prefix}yes`||`${prefix}Yes`){
const yes = require("./yes.json")
message.channel.send(yes.yes[Math.floor(Math.random() * yes.yes.length)])
} else {
if (message.content === `no` || `No` || `${prefix}no` || `${prefix}No`) {
message.channel.send(`Place_Holder `)
}
}```
I tried using a binary converter and the first line becomes this —wûü¶KProfile1\``3- the rest stay the same
Well it doesn't rlly stay the same
It likes make it weird?
This is the file
So is there just no way to open .bkm files?
Thank you for your inquiry.
We do not support editing the mouse's firmware or using another software to adjust the settings such as the color.
This is to ensure that the mouse features and functionality will be affected.
Thanks!
Stay Glorious,
Sad
Sad
It sucks
As corsair supports it
And even has an API
And now I can't sync them 😦
I was ultimatly gonna make an alexa skill to change all my LED's to a set "profile"
@tulip ledge How İ can make my bot's add İ Want To verified it
You what
why the fuck do u tag me for this
Euhm @pure lion I basically just read the file and ran some if statements to check keywords etc
there should be a no tagging rule
🤔
i have had to disable adding people and pms for this server
and had to mute it
this is by far the worst community as far as people abusing tags/pms/role tags that ive ever been in
at tim X))))))))
Who can help me with MongoDB (Java)?
Where do you need help
I found the code again @pure lion
@tulip ledge i wanna see how it's structured, I'll probably look up a tutorial for a c++ interpreter
Ok it works now
is there a way to delete a message from specific user like ?delete user 5
in javascript
STUUR "Hello"
stuur means send in dutch
It also works with variables
DEF dice = "Dice"
STUUR dice
@quartz kindle Do u know a way to do it?
you'd need to either figure it out from the file, or reverse engineer the software that created the file
I don't know how to reverse engineer
Ok so
Is there anything I can do with this?
In the cfg file I found this
This might be helpful
Is there anyone here who has worked with Tornado and Discord.py before?
<tc_chiji1>PUBG - Topressure Special Keys</tc_chiji1>
<tc_chiji2>Fire speed</tc_chiji2>
<tc_chiji3>PUBG - Exit Press Gun Key</tc_chiji3>
<tc_chiji4>Exit topressure options</tc_chiji4>
<tc_chiji5>Red point mirror</tc_chiji5>
<tc_chiji6>Three hair topressure</tc_chiji6>
<tc_chiji7>A key must be specified as the exit gun mode key</tc_chiji7>
<tc_chiji8>4X</tc_chiji8>
<tc_chiji9>Topressure amplitude</tc_chiji9>
<tc_chiji10>Exit topressure mode when press key again</tc_chiji10>
<tc_chiji11>Specify other keys as exit topressure mode key</tc_chiji11>
<tc_chiji12>Basic</tc_chiji12>
<tc_chiji13>Shooting List</tc_chiji13>
<tc_chiji14>Press button </tc_chiji14>
<tc_chiji15>Default</tc_chiji15>
<tc_chiji16>Amplitude</tc_chiji16>
<tc_chiji17>Office Mode</tc_chiji17>
<tc_chiji18>Topressure color indicator</tc_chiji18>
<tc_chiji19>Game Mode</tc_chiji19>
<tc_chiji20>Press key number has reached the maximum value</tc_chiji20>
a piece of it
Profiles?
how do you apply those leds to your mouse?
I think I have a virus
do you open the app, and click some button on it?
Yeah, in-order to change the LEDs you require to open the app.
I dont know what happened
I tried to install something a couple minutes ago to read bkm files
And all of a sudden my pc is slow af
And it should
I have an i9-9900k and 16GB rams
It shouldn't be slow
i9 is a bit overkill?
whats using high ram/cpu
It's called Setup_File_Magic
When I do ctrl shift escape it goes fast again
When I close it
It goes slow again
I think its a trojan
What's a good way to make a documentation for my bot/website without html, css or something
ok fuck it im making an interpreter for hode hh, who wants to vc 
@earnest phoenix use markdown
gggg
I deleted the trojan
Like why would u make your trojan go to Program Files
And why the fuck would u call it Setup_Magic_Malw
because trojan
anyway im gonna make a new file extension called .hh, and its going to be an interpreter aksdlkadghdshkgflskhfgs idk what im saying cd can you dm
@quartz kindle (sorry for ping) do you know a way to do it?
nope
rip
Would it be smart to edit some values here?
LedOffVal=0
LedOpt1=1,1,0,1,0,0
LedOpt2=5,1,0,0,0,0
LedOpt3=3,1,0,0,0,7,255,0,0, 0,0,255, 0,255,0, 0,255,255, 255,0,255, 255,255,0, 255,255,255
LedOpt4=2,0,1,0,0,1
LedOpt5=10,1,0,0,0,1
LedOpt6=4,1,1,0,0,0
LedOpt7=7,1,1,0,0,2
LedOpt8=9,1,1,0,0,0
LedOpt9=0,0,0,0,0,0
Its in the Cfg.ini file
Change them see what happens.
Would it be smart?
You've got a backup of the data, you'll be fine.
Ok
i bet they are LedOpts
I don't think it's changing anything
You could learn to write it's mem.
i bet they are colros
?
Write to the mouse's onboard memory.
How
Idk.
I just tried something
Theres a set
Of possible DPI's
I bet this also is something
ClientConnectorCertificateError(
aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host discordapp.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)')]
Can someone help me with this issue that I get when running python3 main.py on a mac? Please ping me if you have a solution 🙂
Did you run the cert file?
I'm just gonna stop I'm not gonna try anymore
What's the max a bot can purge without API abusing?
@tulip ledge how do you apply the settings?
wdym
do you have to open the program and click on some apply button?
then you change the settings there, and apply, does your cfg file also change?
@warm marsh
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/certifi-2020.6.20.dist-info'
Consider using the `--user` option or check the permissions.
I get this error when I do
But I ran
python3 -m pip install --upgrade certifi
Instead
Its technically the same command I think, but it worked?
But the SSL error still pops up
im brainfarting hard rn
so the cfg doesnt actually do anyting
It opens OemDv or something
if you close the program, and randomize the cfg values, and open it again, does anything change at all?
that program is not oemdrv?
When opening my program it opens OemDrv
Reeeeee
shouldnt promises be returned before the code continues?
or async functions
Oh and I found the file that manages the text
aaaarg fucking callbacks
I can change this
the code continues if there is no await keyword
.then?
i could but thats an index
i cant chain the whole thing inside
(could, but prob not the best)
well yeah
i might throw it into a JSON file tbh
making the whole index async cuz of this will be a pain
you might be able to add a callback if you dont want to put it all in a .then
@cunning gorge you get Certificate error whenever you start the bot?
@proud condor yes
im on a mac
so should i download interet explorer
Hmm wait
Nah
I have windows and i used internet explorer for this
But I've seen a solution for mac
here's the issue
Lol
tChannel.awaitMessages(f, {max:1})
.then(async c => console.log(await tickets.set(`tickets.${msg.guild.id}.${msg.author.id}`, {
type: 'sale',
questions: [c.first().content],
userID: msg.author.id,
channel: tChannel.id
})))
tChannel.send(salesQ2embed)
i want the collector to collect the message and then send it but its not waiting
oh yes pls tell me a solution, i havnt figured this out for 2 days now
Iv seen the download internet explorer thing solution but ye the mac...
@cunning gorge try this https://github.com/Rapptz/discord.py/issues/423
@opal plank you cant return inside a callback, not even in an async function. what you need is to wrap the callback into a promise and return the promise
Yea I ran the install certificate command
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/certifi-2020.6.20.dist-info'
Consider using the `--user` option or check the permissions.
I get this error when I do
But I ran
python3 -m pip install --upgrade certifi
Instead
Its technically the same command I think, but it worked?
But the SSL error still pops up
And some people have been telling me to use sudo with the command, however, I also get the error that my account isnt in the sudeors file....
@cunning gorge Then idk, sorry mate
@proud condor its okay thx for trying
c:
tChannel.awaitMessages(f, {max:1})
.then(async c => console.log(await tickets.set(`tickets.${msg.guild.id}.${msg.author.id}`, {
type: 'sale',
questions: [c.first().content],
userID: msg.author.id,
channel: tChannel.id
})))
tChannel.send(salesQ2embed)
i want it to send the message upon collected
but its not waiting
okay
How can I put all the messages in 1 only instead of 5?
god i wish my bot was here rn (bin the file)
tim, how would i get the collected messages then?
the promise returns them
let promise = tChannel.awaitMessages(...) // this returns a promise
// promise is a Promise
// there are two ways to get data out of a promise
let data = await promise
console.log(data);
// this forces the code to wait for the promise, and returns the value to the current scope
// or
promise.then(data => console.log(data))
// this doesnt force the code to wait, the code will continue normally, and when the promise arrives, a new code starts inside the callback, and the value is given there
ping me if you help me with the above
@earnest phoenix https://hasteb.in
its a website for you to paste your code in, and it gives you a link to post your code
instead of sending a text file with your code
aaa
😎
I need everything in a message so that the API abuse is not prohibited
an embed can only have 25 fields
if you have more than 25 fields, you need more messages, or use description instead of fields
or paginate
and I can not do it by categories?
yes, if you have a lot of commands, maybe make pages with categories
there are 89 commands ._.XD
seems complicated
lul THAT seems complicated?
that's the easiest 'n cheapest way of pagination
Can i make the bot send you a file with the commands?
Any good nsfw api ideas for discord.js?
Any good nsfw api ideas for discord.js?
@torpid sail not the right place to ask ig
Can i make the bot send you a file with the commands?
@earnest phoenix don't
Where do I ask
idk, like, you CAN ask here
I need a new nsfw api for nsfw commands in discord.js so xD
but very few people would actually be able to help with that
easiest nsfw api would be phub itself
phub 😳
How can I make that this code throw an error when the stack size gets too large instead of having it crash the V8 context?
async function loop_generator () {
return function () {
return loop.apply(null, arguments);
}
}
async function loop (c) {
print(c);
(await loop_generator())(c + 1);
};
loop(0);
about ur lastest question, sending a file with commands would result in one of 4 outcomes:
1 - nothing, the user didn't give "send files" perm to the bot
2 - nothing, the user don't trust the bot enough to even open the file
3 - confusion, the text file doesn't have any visual formatting
4 - success, the user reads and understand how each command work
@earnest phoenix
xD
CANVAS
cuz fuck quality
quantized png > jpg
bot do respect the 8mb limit right?
yep
you can build an infographic
wowowo 89 comands in a photo???
aight
wowowo 89 comands in a photo???
@earnest phoenix what about zerotwo that have 700+ lol
just zip the commands folder into a .rar and send them
@earnest phoenix what about zerotwo that have 700+ lol
._.xd
better yet, send a .exe file that installs the instructions on their pc
mine has 145
oh speaking of canvas
so specialized that it's like throwing a rock and splitting an atom in half
would you say a bot that works in 3 different IRC's is specialized?
simultaneously, i must add
when i do filltext it doesnt change the text per running of the command
the first person to use it has their tag on the canvas, then everyone else who uses the command gets the first users tag
dude apples are so fucking good
DUDE IKR
lmao
u still haven't solved it Dice?
send the code again
lmao
can u send me the code to like bin a file? I wanna make an app where I can just do like bin <file> in the cmd line and it'll bin it would be pretty usefull
lmao
I just ate half a sticker
@tulip ledge you'll awake the [S T I C K Y F I N G E R S] stand that way
@pure lion you need to create the canvas inside the command
otherwise you're always reusing the same canvas
reusing the canvas is good for performance, but if you dont manually clear it, it will have leftover data from previous commands
afihasdfhasjldhfaslkdhjfasjklfh im laughing at myself
but if you reuse the canvas AND have async functions in it, then 2 commands executed at the same time will both write on the same canvas at once and create a mess
lmao
anyone know why my second instance of VSC doesnt format objects like in the left?
it always does like the right
nah, theres an option to make objects display like that with a debugger
but i cant find it
oh
asking if someone knows which option it is, im pretty sure its on launch.json
let episodes = []
chars.episode.forEach(async (episode) => {
const {body} = await request.get(episode)
episodes.push(body.name)
});
console.log(episodes)
why does this array return empty? im so confused
@low orbit what error did it return when you used it?
@fervent goblet Make it a promise
The console.log is executed before the body.name is being pushed
@low orbit What do you mean doesn't work
Theres alot of thigns that might not work
so put an await before it?
hi
I prefer using for
Yes
When?
I restarted pc and I have a diff error now
O?
your code is trying to open a file that it cant from thr looks of it
yeah I'm just not gonna use canvas
the*
H m
I'm just gonna use canvas then
I need help to make a private DM so if they cant send them it will send them a error
.catch()
let episodes = [] chars.episode.forEach(async (episode) => { const {body} = await request.get(episode) episodes.push(body.name) }); console.log(episodes)why does this array return empty? im so confused
@fervent goblet
let episodes = [ ];
await Promise.all(
chars.episodes.map(
async episode =>
episodes.push( ( await requests.get( episode ) ).body )
)
);
console.log( episodes );
spoon-feeding is amazing isn't it
map supports async functions?
Does anyone know why I get this everytime I satrt my bot? Didn't happen to me before... Bot is still working good tho
0|zbot | size: 0,
0|zbot | timeout: 0,
0|zbot | [Symbol(Body internals)]: {
0|zbot | body: PassThrough {
0|zbot | _readableState: [ReadableState],
0|zbot | readable: true,
0|zbot | _events: [Object: null prototype],
0|zbot | _eventsCount: 2,
0|zbot | _maxListeners: undefined,
0|zbot | _writableState: [WritableState],
0|zbot | writable: false,
0|zbot | allowHalfOpen: true,
0|zbot | _transformState: [Object],
0|zbot | [Symbol(kCapture)]: false
0|zbot | },
0|zbot | disturbed: false,
0|zbot | error: null
0|zbot | },
0|zbot | [Symbol(Response internals)]: {
0|zbot | url: 'https://discordapp.com/api/v7/gateway/bot',
0|zbot | status: 429,
0|zbot | statusText: 'Too Many Requests',
0|zbot | headers: Headers { [Symbol(map)]: [Object: null prototype] },
0|zbot | counter: 0
0|zbot | }
0|zbot | }```
Just happens at startup
Did you reach the 1000 limit or something for the day
So if you want to asynchronously iterate over something, but wait until they're all finished before proceeding, use Promise.all and an async function in map
1000 limit for what? @sudden geyser
You can only login 1000 times a day before getting blocked
Yeah ur just getting ratelimited
Don't understand the issue here, I'm getting rate limited but not limited?
As I said, bot is still working good, isn't it supposed to be blocked from login if it is limited?
The 1000 I was thinking about would reset your token and email you, so that's probably not the issue here.
since ur getting ratelimited on login it'll mostly likely just take longer to start up
Nah, not getting longer either
@paper phoenix thanks
This issue is not bothering me, but just wanted to solve it so my logs don't get spammed
how do you people count how many messages your bot sees
And I can prevent any future issues related to this
- 1 on the msg event?
how to export embed?
const {RichEmbed} = require('discord.js')
var config = {
ball : async(bot) => {
let helpembed = new RichEmbed()
.setTitle("Page d'help de la commande `8ball`")
.setDescription(`> > **Information**
> Envoie une réponse a votre question
> > **Utilisation**
> !8ball [question]
> > **Exemple**
> !8ball comment vas-tu ?`)
.setColor("#10B1C1")
.setThumbnail(bot.user.displayAvatarURL)
.setFooter(`© ` + bot.user.username, bot.user.displayAvatarURL)
return helpembed
}
}
module.exports = config```
```js
if(!args[0]) return message.channel.send(EmbedExport.ball(bot))``` 
huh
Hey I am sending a user a DM
bot.users.cache.get(`524002223181660167`).send("Hi");
It does send, but in my console it gives
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of undefined
Like it works but throws that, should I be concerned?
user = message.mentions[0]
if user:
await message.channel.send(user.id)
else :
await message.channel.send(message.author.id)```
help
What's going on with that code
that doesn't seem very python at all
It does
@earnest phoenix Does that error out when you don't mention anyone?
I'm on phone too 
lol
for (character of MyString)
MySecondString += character + " "
MySecondString.Trim()
There's also the option of using a for loop and only adding the space if the index isn't equal to string.length - 1
@earnest phoenix use an if for message.mentions
Because you are trying to access the first element of an empty list
bonjour
i need help with spotify command
i have everything else but i need something like this
@earnest phoenix use an
iffor message.mentions
@slender thistle what?
if message.mentions will check if the list is empty
So you first check if a list has ANY elements before trying to access one
No
Literally just message.mentions
if message.mentions:
How i can add login with discord to my bot site?
preparing for my next discord bot made in Go, set up a unique mc like permission system with node and now im working on API for website
Guys I wish I could get a free code that I want as my birthdays present from u :/
How i can add login with discord to my bot site?
nvm
https://discord.com/api/oauth2/authorize?client_id=695075574946725979&redirect_uri=https%3A%2F%2Fibot.cloud.libraryofcode.org&response_type=code&scope=identify
i got it
# will work
my_list = [1,2]
if my_list:
var = "yes"
# will not work because my_list is empty
my_list = []
if my_list:
var = "yes" ```
@autumn aspen birthday isn't an excuse to be spoonfed
I wish tho :/
How i can add login with discord to my bot site?
just learn how to code
nvm i got it
Riku it's hopeless
Yup, spamming your question won't help anyone, including you
@zinc condor sry
when i ask questions its mostly about the api part itself
i need help with spotify command
i have everything else but i need something like this
altho im kinda writing my own library so
thats a given
if you are on javascript or Golang use the canvas library @still badge
ok ty
you can find documentation online on how to do it
ty
hello would someone like to code an entire bot for me send me the script give me all the credit and realize this is a joke?
why does this: bot.users.resolve('[my user id here]').dmChannel (discord.js v12) return null? the bot was able to send a message to me
pretty basic math @hearty wind
right but im saying whats the code to check reactions.
and how is it constantly updating?
You can help me guys?
shouldn't it be something like
user.dmChannel```
bot.users.resolve('[my user id here]') gives the user object just fine, but its dmChannel property is null
How i add to my html site login with discord?
dmChannel doesnt have to exist, right?
i think you need to fetch it to get the whole object
?
strange, tried that and i still get null
user.createDM()
const channel = await user.createDM()
channel.send('')
i cant find the python command.
would be in the docs
🤔
i fixed thie before
i didnt think DmChannel has to exist.
if it doesnt exist, a DM hasnt been sent between the two users before
i thought
How i add to my html site login with discord?
@low shard oauth
@low shard i told you, stop asking and start looking around, google and problem solve yourself
ok im confused.
if its just javascript then you should find some libs or info online
@solemn latch tnx
my bot only has two commands !poll and !update when people type !c4 why does it even bother checking.
im prepared for him to ask the same question later because discord official api docs are too hard 
it just says command not found.. because it's part of a different bot.

@hearty wind for some reason bots get all messages and not just messages with the prefix
i found the oauth stuff really well explained
yeah its well explained when you actually have dev experience,
i assume someone asking the same question over and over without response is a sign of a new script kiddie who has yet to figure out the fundamentals and is just looking at examples @solemn latch
@hearty wind you have to filter the messages yourself
await message.edit(content="newcontent")
this is the command to edit... now i need to figure out... how to count the emojis and constantly edit.
is it something with async to constantly edit?
as the emojis build up?
there are reaction events, or a reaction collector
@low shard https://discordjs.guide/oauth2
way easier guide if you don't get the api docs
🤔
you can use wasm :^)
fair enough
@sick cloud um, i would think that he might be talking about backend too since oauth needs callbacks
🤔
its not all frontend
you can do callbacks on front end
backend doesnt have to be js
just saying
you need to callback to the internal api and have it send back some sort of token to keep in cookie storage
that determines auth i think
C# backend 
i hear about blazor actually
sounds nice for large projects but id rather stick with vue
Ope
And thats what we call spaghetti
np
btw just to make sure where do i put the async
hope this isnt a dumb question
but yeah
message.channel.send()
alright ty
client.on('guildCreate', (guild) => {
const message = require('discord.js')
const embed01 = new MessageEmbed()
.setAuthor(guild.me.displayName, client.user.displayAvatarURL())
.setTitle(':wave: Hello! :wave:')
.setColor(0xA1ee33)
.setDescription(`Hello! And thank you for adding me to your server! Here is a bit about me:`)
.addField('My Purpose: ', "To continue to bring legitimacy to all roleplay servers! Making in game chat easier to use!")
.addField('My Owner: ', "I am developed and coded by Fuzzy Wilson, with love and hate in discord.js@12.2.0.")
.addField("Getting Started: ", "To start, please use my /news command to find out what has happened lately! After you can use /help to get started on other things.")
.setFooter(copyright.copyright);
const embed02 = new MessageEmbed()
.setAuthor(guild.me.displayName, client.user.displayAvatarURL())
.setTitle(":wave: Server joined! :wave:")
.setColor(0xA1ee33)
.setDescription("I have been added to a discord server!")
.addField('Server count: ', client.guilds.cache.size)
.addField("Server Name: ", guild.name)
.addField('Server Owner: ', `@${guild.ownerID}`)
.setFooter(copyright.copyright);
message.channel.send(embed01)
.then(
client.channels.cache.get('682406158363131982').send(embed02)
)
});```
This is currently what I have in my index, but I do get an error when I try to get this to work.
```js
(node:72) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'send' of undefined
at Client.<anonymous> (C:\Users\dargc\Desktop\Coding\TheFluffBot\index.js:80:18)
at Client.emit (events.js:322:22)```
Trying to get my bot to send a message when its added to a server.
Isnt it message.embed
Sure it can be either.
@stable nimbus you need to choose a channel
There's no message, let alone message.channel
All I want it to do is send a message to the first one that it can send to, before the bot role comes into play, like a general chat, but popular channel doesn't exist anymore.
A for loop with a return once a channel with permissions has been found
Need more help because I'm still basic bitch level of what I've learned
Have any guides that might be able to help me out?
Don't know any, but the general logic is to access something along guild.textChannels (if there's such property), use channel.permissionsFor(guild.me) and get the permission to send messages from there
Okay.
I suggest searching the documentation because I highly doubt the methods I mentioned actually exist
Okay, thank you, that was a lot more helpful that the official server.
does anyone have an invite to the discord api server
If you're looking for Discord API: https://discord.gg/discord-api
wot
how to export a function and use it as it has parameters?
i have this function
function getRandomNumber(start, range) {
let getRandom = Math.floor(Math.random() * range + start);
while (getRandom > range) {
getRandom = Math.floor(Math.random() * range + start);
}
return getRandom;
}
that i need for many other files
module.exports?
can someone explain to me/direct me to some resources on how to use forEach() in an arry in nodejs?
actually scratch that
fuck that website
here
proper docs
I want to pull a stat from an API that appears in each array of JSON
But I dont know where to start
@gritty bolt https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach
for each bad btw
whats better?
for () while(), use proper loops
ok thx
Im using the League API specifically so would this work if I want to pull the gameId from each of these?
"matches": [
{
"platformId": "NA1",
"gameId": 3493499599,
"champion": 82,
"queue": 400,
"season": 13,
"timestamp": 1594693066874,
"role": "SOLO",
"lane": "TOP"
},
{
"platformId": "NA1",
"gameId": 3492570676,
"champion": 82,
"queue": 400,
"season": 13,
"timestamp": 1594604322875,
"role": "DUO",
"lane": "TOP"
},```
array.map() would be better in this case
how does that work?
well, still depends on what you want to do
I want to pull the gameId from a giant list of those
array.map() is good if you want to transform the array of objects into an array of gameIds
Each time yes
so a for loop is better
can you link me to some info on that?
for of will also work well in this case
which would be easier?
for of is easier to use
does that require a hasOwnProperty check?
ok thanks
i love their descriptions ```Summary
Sharp minds might have noticed that all higher-order functions can actually be written with for...of inside blocks instead.
In my opinion, intent can usually be better expressed with higher-order functions than with loops.
Use forEach if you’re experienced enough and absolutely know what you’re doing.
If you’re returning something in a forEach callback, you don’t know what you’re doing.
If you’re chaining forEach after map or filter, you don’t know what you’re doing; reduce is an ambiguous case, you most likely don’t know what you’re doing.
If you’re using an async callback function, you most likely don’t know what you’re doing (see rationale).```
hasOwnProperty would be in for in when looping over object keys
and even then, only needed if its a complex or non-standard object
i use reduce to define booleans. instead of doing let x = false; if(y){ x = true }
i never use let
wat
wat
let is bad
troll is good
the bait
i mean
const is a signal that the identifier won’t be reassigned.
let is a signal that the variable may be reassigned, such as a counter in a loop, or a value swap in an algorithm. It also signals that the variable will be used only in the block it’s defined in, which is not always the entire containing function.
i use let everywhere because its shorter than const
const validTeams = teamSizes.reduce((acc, val) => val && acc, true);
hello
How do I make my prefix non case-sensitive
^
ah yes
or be a dick and set everything to uppercase, just to see the world burn
i use toUpperCase lmao
some people just like to see the world burn
OR BE A DICK AND SET EVERYTHING TO UPPERCASE, JUST TO SEE THE WORLD BURN (like this?)
i bet you use snake_case too
nope
XMLHttpRequest or XmlHttpRequest?
its still got on my bucket list to make a code so atrocious it'd put a developer into a coma
might add toUpperCase() on that
its troll code
already triggered
Ln10
why is bot defined with let?
https://github.com/DiscordBotList/Luca/blob/master/bot.js#L10
me too
@opal plank
never use let ever
what?
dude
@proven lantern const is a signal that the identifier won’t be reassigned.
let is a signal that the variable may be reassigned, such as a counter in a loop, or a value swap in an algorithm. It also signals that the variable will be used only in the block it’s defined in, which is not always the entire containing function.
In functional programming, you can’t modify a variable after it’s been initialized. You just can’t. You can create new variables just fine – but you can’t modify existing variables, and this really helps to maintain state throughout the runtime of a program. Once you create a variable and set its value, you can have full confidence knowing that the value of that variable will never change.
i dont need js to babysit me, i use let because its shorter to write
what about the optimizations that come with const
use the goddamn variables when they are suppose to be used ffs

better yet
dont even declare them
just slap this
done
no declaration
global scope is sad
no let vs const vs var war
lol
not that basic
but like, getting xp for a user for each guild the user is in, along with basic info about that guild(name, id, icon)
that kinda stuff
so I have this function I wanna export
module.exports = {
randomNum = function getRandomNumber(start, range){
let getRandom = Math.floor(Math.random() * range + start);
while (getRandom > range) {
getRandom = Math.floor(Math.random() * range + start);
}
return getRandom;
}
}
I think I did that part right, but how do I use it then?
const { getRandomNumber } = require(./../../function);
()=>{}
where?
oh, nm

are you using node or react?


node node
react does exports differently than node
it doesn't
export default
okay I am not interested in that

react uses that
randomNum: function getRandomNumber(start, range){
let getRandom = Math.floor(Math.random() * range + start);
while (getRandom > range) {
getRandom = Math.floor(Math.random() * range + start);
}
return getRandom;
}
}```
= => :
?
randomNum = function => randomNum: function
okay well then how would i use it in different file?
const { getRandomNumber } = require(./../../function);
const { randomNum } = require('./path/to/file')
i am so lost
first why are u doing randomNum: function
getRandomNumber is the function
randomNum is the key
oh
if you're only exporting a single function, you dont need to wrap it in an object
oh
you can export an anonymous function directly
module.exports = function(start,range) {}
you can change the function to a arrow function too. you're not using this so you should be fine
yes
are you sure you have the license to use uni sans lol @earnest phoenix
module.exports = (start,range) => {}
no
DMCA takedown incoming
it qas on google for free
was*
uni sans is not free
it was on google?
you need a license to use it
google-fonts
these are some confusing times
google fonts have a good license
thx for wasting time tho
you can use those
inspect and look for padding or margin
someone here bored with twitch account by any chance?
need an extra hand(account)
built in to the browser
the margin is on the html element for some reason
put margin: 0 0 on the html element
Who uses em for margin calculations?
remove the space
cool
overflow: none works but i'd be looking into why it's there first
ads
we can't see it until it's approved
remove width and height from container
body { height: 100vh}
I did
hacks
it still didn't do anything
learn css, tbh
looks fine here
add that to the body
it's not working
lol its just F5 for me
element style is when you add css directly to the inspector, to test it live
Not always
overflow: hidden;
}```
@earnest phoenix hit F5 or ctrl + F5 on your kbd
Some css works fine but sometimes needs hard refresh
it's already fixed
dont add that width and height, he has some margins and paddings somewhere, those widths and heights will cause overflow, and hiding overflow with hidden its not ideal lol
doing what? what are you trying to fix?
the gap...
use flex layout
what gap?
i see nothing wrong lmfao
you mean you want to center the entire thing verically?
thats a totally different thing
we thought you were talking about something else lol
thats vertical centering
for vertical centering you need to control the height
how
but its more complicated than that
for example height: calc(100vh - 37px) (37px being the header height)
just for having the correct height on main
then you need to calc the height difference to make the block appear in the middle
or use flexbox, but even with flexbox it will not be perfectly centered because of the header and because your item has a huge empty space above it
?







