#development
1 messages · Page 1257 of 1
I don't know how to change iframe's css target
without js
get the element(s) from the iframe, then change their style
How would I have my bot send a message when someone boosts my server?
( Sorry if I am interrupting )
its my own website, but it's not showing css @umbral zealot
Why are you using iframes? Is this the 90's? 😛
Then edit the CSS in your website?
@earnest phoenix what language and library?
@cinder patio djs
my website looks right, but iframe llooks like just html
In your message event, if the message.type is USER_PREMIUM_GUILD_SUBSCRIPTION, then someone boosted your server
I am not sure how to get who boosted, though
discord doesn't provide that data
so there's no certainty that you can get it
however
^^
uh
am i blind or is there no booster data there
boost messages are one way to get who boosted
I think the author of the message is the one who boosted
oh
Polo is the booster.
Who else would be the author of a booster message?
you can't tell which role is the booster role as of right now iirc

yeah boost messages are one way however guilds can turn off boost messages
or you can check user flags
If they're on
@earnest phoenix
or see the list of boosters and check if the user is in them
it's finnicky, discord doesn't provide actual data about it
So. step 1, turn on booster messages. step 2, listen to messages system messages with the USER_PREMIUM_GUILD_SUBSCRIPTION type. 
yeah that's the only way as of right now (that works)
every other way isn't able to detect when a current booster reboosts
fun fact
the event for it exists
user accounts receive it
discord just doesn't send it to bots for whatever reason
i need to know that who is inviting members in my server with welcome message
how to set that ??
plzz help??
i need to know that who is inviting members in my server with welcome message
@earnest phoenix ...why?
there are better ways
because i want to know all the details of my server
from dapi
discord also doesn't send who invited the user
Yeah you can sort of track invites but not temporary ones, only permanent ones.
you can also track temp ones with enough dedication
dear discord api,
fuck you
sincerely,
invite manager bots
i need to know who has invited the user
these aren't accurate though
i sent you a screenshot above, read it
Best I can tell you is https://anidiots.guide/coding-guides/tracking-used-invites , venom. if you're using discord.js it might help
ok
But again this method is unreliable at best, and doesn't work at all if you let users make their own temporary invites
anyone have an idea any occasionally there will still be a gif preview in a message even after the link has been removed?
for example
does it appear for other people too
yeah
it's discord messing up then
i'd suggest using an embed and setting the image url to the loading gif
hmm yeah
Can I request a simple code?
what do you mean
@faint prism add a delay it might be like if a message gets deleted to fast it cant be remvoed and is god mode
I want a code ban discord.js 11
We can't just give you code, but we can help you on how to write it via if you have a question
also you should migrate to v12 soon.
@crisp meteor okay we wont stop you from coding it
client.on('message', message => {
if (!message.guild) return;
if (message.content.startsWith('!ban')) {
const user = message.mentions.users.first();
if (user) {
const member = message.guild.member(user);
if (member) {
member
.ban({
reason: 'They were bad!',
})
.then(() => {
message.reply(`Successfully banned ${user.tag}`);
})
.catch(err => {
message.reply('I was unable to ban the member');
console.error(err);
});
} else {
message.reply("That user isn't in this guild!");
}
} else {
message.reply("You didn't mention the user to ban!");
}
}
});```
Well can you help me convert it into a version 11 ?
use the docs
I could not xD
that sucks xD
Quasi complicated
https://i.callumdev.pw/0hp8d.png
Logs: "test is undefined" but I have a try{}catch{} that is not catching the error for some reason? I am sure my sm0ll brain is just being dumb? https://i.callumdev.pw/oj47y.png
is anyone particularly familiar with the mongoose module of node js
im trying to make a sort of xp leaderboard
and i am able to find and sort objects in the collection
but im not sure how to get just the level and create a leaderboard out of it
const leaderboard = await profiles
.find({ guildId: message.guild.id })
.sort({ level: -1, xp: -1 })
.limit(10);
console.log(leaderboard);
im finding the guild id and then sorting level and xp
and limiting it to 10
so it console logs a list of the top 10 levels
but obviously i dont wanan send the entire object
{
xp: 223,
level: 10,
_id: 5f676fbe165e2dce55b48144,
guildId: '750784696283299911',
guildName: 'example',
userId: '428555808117227520',
username: 'example#0001',
__v: 0
}
i wanna get just level and xp for each object
oh and username
and then format it into an embed
client.on("message", (message) => {
if(message.content === prefix+"ban") {
if (!message.guild.member(message.author).hasPermission('BAN_MEMBERS')) { return message.channel.send('You do not have the permission for ban users" !'); }
if (!message.guild.member(client.user).hasPermission('BAN_MEMBERS')) { return message.channel.send('I don\'t have the permission for ban users" !'); }
if (message.mentions.users.size === 0) { return message.channel.send('You need to ping a user !'); }
let banMember = message.guild.member(message.mentions.users.first());
if (!banMember) { return message.channel.send('User not found!'); }
banMember.ban().then((member) => {
message.channel.send(member.displayName + " has left the server")
message.channel.send(member.displayName + " has been successfully banned by " + message.author);
})
}
});```
He replies to me and writes "You need to ping a user !"
jesus christ
And when I choose the person to block, nothing is done
the formatting on that
bots have a gender
indeed, mine identifies as a Gender Ratelimiter Fluid
lmfao
how do you expect the mention collection to have something in it when you're telling it if the message content equals exactly to prefix+ban
cof cof strartswith
you can't order a cheeseburger and then complain that you didn't get fries because you only said you wanted a cheeseburger, no?
cof cof
no, shoo
😭
dunno mongo
@earnest phoenix Fix it , I didn't get you ):
im postgres supremacist
i'm not your slave, fix it yourself
its your code, if you want someone to work on it just pay them
wtf
¯_(ツ)_/¯
@crisp meteor your code is searching for exactly prefix + "ban" so it cant find the mention becuase to it there is no other content
i think
lemme give you a tip
😮
if you using embed description, its a string
thats cool
concat can merge strings
yeah
if you using fields
i just read it
Well this code works,
But when I write the prefix + kick
Don't say mention member
client.on("message", (message) => {
if(message.content === prefix+"kick") {
var member= message.mentions.members.first();
member.kick().then((member) => {
message.channel.send(":wave: " + member.displayName + " has been successfully kicked :point_right: ");
}).catch(() => {
message.channel.send("Access Denied");
});
}
});
O.o
Imagine not using a command handler
^^^^
Also var is safe to use in some cases, I looked it up a while back, it has to with scopes 
But if you write -kick @crisp meteor
var be like: scopes? whats that? never heard of
Works
var is good for iterations
No has to do with scopes I mean
Mhm
yo
why it writes to me
if(!msg.member.hasPermission("ADMINISTRATOR")){
return msg.channel.send(":x: | Вы должны быть администратором сервера что бы загрузить backup!");
}
error in hasPermission
Var is different in different languages. Most oop Lang's uses var more than Lang's like js
What is the error?
2020-09-20T17:05:04.926055+00:00 app[worker.1]: if(!msg.member.hasPermission("ADMINISTRATOR")){
2020-09-20T17:05:04.926056+00:00 app[worker.1]: ^
2020-09-20T17:05:04.926057+00:00 app[worker.1]:
2020-09-20T17:05:04.926057+00:00 app[worker.1]: TypeError: Cannot read property 'hasPermission' of null
if (!message.member.hasPermission("ADMINISTRATOR")) {
return message.channel.send(
":x: | Вы должны быть администратором сервера что бы загрузить backup!"
);
}
maybe?
hasPermission doesn't exist on member. Ahhhhhhhh I am guessing msg is type of Message, so that would make member be typeof GuildMember
Ok
mhm
?
so?
member is null
Oh right
so its likely a DM
check for member
I forgot that it complaining about it, and object it's is attached to
if member exist
nooo
could be banned member too i guess
nooo
@silent cloud why?
i'd rather not
bruh we dont need to be on the server
msg is message.
@silent cloud try console logging message.member
why
cant be arsed to go leave one or two server just for a 5 minute endeavor
would you just try
How does not declaring type of variables work in JS? Like not using 'let' 'var' or 'const'
it is too difficult
Nope
hmmm
oh, THAT
You can use comment blocks
let is mutable, so is var
But I have variable that doesn't have anything in front of it
const is constant, its value cannot change and will error once it attempts to be changed
thats global
Yes type doesn't matter in js
Yes

One thing in my RPG file
Yes type doesn't matter in js
JS has weak typing
@silent cloud did you try?
I mean when declaring it doesn't as it changes it's type based on value
damn i really do be the only one without green name 😭
Will it be multiplied?
no
yeah hence "weak typing" except JS wanted to get down and really take the crown
js is a butifouel oop lang

Nice
C# is the best oop in my opinion
Scratch best lang, no room for arguments

I'm starting to dislike oop
If you use scratch, there is something wrong with you
Unless your very young then maybe
C++ is best for OOP and DOP in my opinion, for FOP, well Haskell is best.
It's the sound of taking computer science
All of those "inconsistencies" can be explained
Cpp is the best, but as fair as beginner friendly c# is actually more friendly
Yeah they all can broken down to make sense, but imagine if you didn't have to live with most (if not, all) of those inconsistencies
even python doesn't allow you to do something like undefined = "hi"
but now new
Why would you?
Cpp is the best, but as fair as beginner friendly c# is actually more friendly
hmm yes, ||pointers||.
Me?
im do a backup bot
Yes
I wouldn't, but why would the language allow that?
how i can create json files with backup data
The C family is hell
Hail ECMAScript
in glitch it working, heroku not
idk man, but doesn't make them bad
@cinder patio can you explain this one?
Lol
out of all that other ones, i think this is the only one i dont particularly undertsand
Imo it does. It's just more holes that are just left there
lol
how i can create json files with backup data
@silent cloud WHY JSON DATABASE WHY WHY WHY WHY WHY LIKE FIVE WHYs WHY
yeah
just use a proper database
@silent cloud WHY JSON DATABASE WHY WHY WHY WHY WHY LIKE FIVE WHYs WHY
@earnest phoenix bcos it rly
It's a bool statment
howcome 0.5 + 0.1 does equal 0.6 then?
The C family is hell
Hail ECMAScript
Well....... C is a pointer ||hell||. C++ isn't so bad, C# is MS Java.
0.1 + 0.2 doesn't equal
0.3
@cinder patio because it equals3/10
most langs have that 0.1 + 0.2 floating math issue
i thought floats didnt work like that

Does anyone have the d.js link on how to make a command to set a certain channel for a specific command? Like "*setchannel Botspam #bot-spam"
You want to restrict a certain command to a specific channel, via a command
In a way yeah
You would have to use a database for that, just saying
Hmm
There isn't a discord.js tutorial on that
Ah dang
You can still try to create it yourself, though.
I'll try but I'm not exactly sure how to do it lol
You'll have to learn how to use databases first, and which database to use.
Any good recommendations for that?
Lol
postgres might be too advanced depending on what you going for tbh
you might wanna go mongo or quick
maybe even sqllite
Quick is the easiest to learn tbh
postgres
Lol
its basically storing data
Lel
you shape the data format
depending on the database it changes too
just get something thats ACID compliant
Got it
How do some bots trigger bypass too like when someone bypasses the n word the bot still automatically deletes it and warns u how come, is it possible?
HOW TO CONNECT DB AND HEROKU
heroku.connect(database)
repl.deleteAllCode(plusDatabase)
Hrmm im getting errors trying to install quick.db
Nvm figured out the issue
Actually take that back I didnt lmao
@quartz kindle
async function handleUserInput(msg) {
try {
const content = msg.content;
if(content.includes(myBotId)){
return;
}
const inputArgs = content.split(" ");
if(inputArgs.length > 0) {
const command = inputArgs[0].toLowerCase();
console.log(`Content: ${JSON.stringify(msg.content)}`);
if (command === COMMAND.PING.command && inputArgs.length === 1) {
msg.reply('pong');
return;
}
else if(command === COMMAND.SLAP.command) {
doActionToUser(msg, "slaps", inputArgs);
}
else if(command === COMMAND.KISS.command) {
doActionToUser(msg, "kisses", inputArgs);
}
else if(command === COMMAND.WITTYTODO.command) {
setTimeout(function() {
console.log('heavy command started');
wittyToDo(msg, inputArgs);
}, 2);
console.log('heavy command executed');
}
else if(command === COMMAND.HELP.command) {
msg.reply(helpText());
}
}
} catch (err) {
console.log("Error: " + err.stack);
msg.reply(helpText());
}
}
function startDiscord() {
client = new Discord.Client();
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});
client.on('message', async(msg) => {
const run = async () => {
handleUserInput(msg);
};
run();
});
client.login(token);
}
discord blocks the user requests
ah chat spam
if the previous user request didn't get a reply
I mean if the previous reply runs in background for 2 mins.. the next request keeps waiting
!slap should have gotten the reply instantly
{
"310418778423033858": {
"weeklyDonation": 90000
},
"388306694813384704": {
"weeklyDonation": 995001
},
"438518069091106816": {
"weeklyDonation": 20000
}
}
How can I sort this json file by weeklyDonation (most to least) of how can I get all of them from highest to lowest
js is single threaded
if your doing a task thats "blocking" other tasks, then its blocking those tasks
@quartz kindle
async function handleUserInput(msg) {
try {
const content = msg.content;
if(content.includes(myBotId)){
return;
}
const inputArgs = content.split(" ");
if(inputArgs.length > 0) {
const command = inputArgs[0].toLowerCase();console.log(`Content: ${JSON.stringify(msg.content)}`); if (command === COMMAND.PING.command && inputArgs.length === 1) { msg.reply('pong'); return; } else if(command === COMMAND.SLAP.command) { doActionToUser(msg, "slaps", inputArgs); } else if(command === COMMAND.KISS.command) { doActionToUser(msg, "kisses", inputArgs); } else if(command === COMMAND.WITTYTODO.command) { setTimeout(function() { console.log('heavy command started'); wittyToDo(msg, inputArgs); }, 2); console.log('heavy command executed'); } else if(command === COMMAND.HELP.command) { msg.reply(helpText()); } } } catch (err) { console.log("Error: " + err.stack); msg.reply(helpText()); }}
function startDiscord() {
client = new Discord.Client();client.on('ready', () => { console.log(`Logged in as ${client.user.tag}!`); }); client.on('message', async(msg) => { const run = async () => { handleUserInput(msg); }; run(); }); client.login(token);}
@grand path wath app for create bot???
please dont quote that
@prime narwhal don't get u
if your doing a task thats "blocking" other tasks, then its blocking those tasks
@solemn latch don't confuse threading with asynchronous work
you can use vsc
is he not complaining about tasks being blocked @earnest phoenix ?
@stark abyss stop using json as a db
i am using it for around 20 people
woo from what i can see they just said it's blocking
you still want me to stop?
u blaming JS now? come on..
yes, i do
discord is not receiving input
i don't understand
problem should be in discord library
what what
bruh
what application do you use to create bot's ???
discord portal ??
there isn't an "application"
its just programming, any decent code editor will do
cry what db do you recommend then
depends on what you want to do
small scale, i personally use sqlite
large scale, postgresql
i suck at db they are too complicated for me
there are also some nosql databases (that i haven't used) like mongo
i have spent so much time trying to learn how to use them but it never works for me
i tried mongodb
databases are generally much easier than json db's

your watch viniccius13???kkk

kk
discord.js is good application for create bot's???
sure
if you like js
but you dont make it in discordjs, discordjs is just a library
Code?
cmdNamd
did you mean to use cmdName?
lol
@faint prism add a delay it might be like if a message gets deleted to fast it cant be remvoed and is god mode
@solemn leaf I could probably delete instead of edit if an embed still exists
someone needs to make an image generator with google corrections @opal plank
and send it on every 5th message
Raidbots got nothing on us, recommendation bot is where its at
true spam
Did you mean 'true ham'?
i used to have a grammar nazi module on my bot
the first implementation of it i forgot to... make it ignore bots
so it just kept on correcting itself
i used to have a grammar nazi module on my bot
@earnest phoenix I love it
did you type the name of the variable wrong @prime narwhal
omg
process.on('uncaughtException', async (err) => {
let me = await bot.users.fetch("485987127809671168")
me.send({ files: [{ attachment: `${err}`, name: 'err.txt' }] });
}).on('unhandledRejection', async (err) => {
let me = await bot.users.fetch("485987127809671168")
me.send({ files: [{ attachment: `${err}`, name: 'err.txt' }] });
})
remember kids, always remove bots from your commandws
oh my
had to instantly kill the bot
lel
@solemn leaf i am well aware that you recieved help from Tim and someone else earlier today
not proud of you
no im not
I dont even need buff
huh?
it works still
not sure if attachments work like that
process.on('uncaughtException', async (err) => {
let me = await bot.users.fetch("485987127809671168")
me.send({ files: [{ attachment: `${err}`, name: 'err.txt' }] });
}).on('unhandledRejection', async (err) => {
let me = await bot.users.fetch("485987127809671168")
me.send({ files: [{ attachment: `${err}`, name: 'err.txt' }] });
})
try it
meh too lazy for that
might grab a beer and go code tbh
i gotta debug a library too and generate errors
how can i know which invite code the newly joined member used ?
🤔
dontasktoask
aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host discord.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)')]
wasnt even a question
what does this mean
that it cannot connect to discord.com
the error line was client.run('TOKEN')
also VSC is an editor
how to fix it
unrelated to whats outputting that
kk
Another question, why does it say: raise RuntimeError("PyNaCl library needed in order to use voice") RuntimeError: PyNaCl library needed in order to use voice
sql gang
also am an sql user
mongodb is quite good
I've not actually used MongoDB, but it's a fine choice. If you're still worried you could try it out and see what you like and don't like.
i'd say an 8, 0exe
how much do you guys rate mongodb?
@drifting wedge 8.314159/10
You won't usually see a difference in the database until whatever you're doing is getting very big. You should choice based on ease of use at first.
yeah djs
like canvas?
make a grey rectangle, put a white rectangle above it for the width you want
for example, a 100px wide grey rectangle, with another rectangle above it thats 87 pixels wide would be 87% full
oh
now we just grab a nice bottle, sit down, relax, and wait for the ratelimits to pour in
The attached emoji feels weird.
hey guys
await coro(*args, **kwargs)
TypeError: on_message() takes 0 positional arguments but 1 was given
import os
import discord, requests, itertools
from discord.ext import tasks
from dotenv import load_dotenv
from nike_module import get_nike_shoes, get_links
client = discord.Client()
NIKE_SNKRS_URL = 'https://www.nike.com/fr/launch'
channel = client.get_channel(742361041882841159)
s = requests.Session()
r = s.get(NIKE_SNKRS_URL)
@client.event
async def on_ready():
'''Event Handler: Handles the event when the client
has established a connection to Discord.'''
print(f'{client.user} has connected to Discord!')
@client.event
async def on_message():
'''Bot replies back with sneaker info when it sees a command.'''
@tasks.loop()
async def the_loop_ting():
if r.ok:
shoes = get_nike_shoes()
links = get_links()
bot_message = ''
for shoe, link in zip(shoes, links):
bot_message += shoe + '\n' + link + '\n\n'
bot_message += 'For more Nike Sneakers releases and info: ' + NIKE_SNKRS_URL
await channel.send(bot_message)
else:
await channel.send('We could not make contact with the Nike site. Our conclusion is that the Nike site is down. Please try again later!')
if __name__ == '__main__':
client.run('')
i tried the loop it
but it was showing me that error
any fixes?
on_message takes a single argument, message
You defined it with no parameters.
@eternal osprey
so i should do:
You can see on the docs: https://discordpy.readthedocs.io/en/latest/api.html#discord.on_message
on_message(message):
I have a quick.db question, If I wanted to make a custom prefix with quick.db would multiple files work, Like I make a command file (setprefix.js) and set my prefix to args 1 or 2 in that file, Would I still be able to define my prefix as whatever used in setprefix.js? like er
Setprefix.js
```db.set(prefix_${message.guild.id}, args[2]) //(<setprefix !)
if(db.prefix_${message.guild.id}, db.set(prefix_<)) //never used quick.db before, Im hoping this will set < to the prefix if no prefix is given or a prefix has never been set
return message.channel.send('No prefix given!');
index.js
```const prefix = db.get(`prefix_${message.guild.id}`) //get my prefix-
if(`db.prefix_${message.guild.id}`, db.set(`prefix_<`)) //idk if this should be in setprefix.js or here
how can i make canvas faster to send?
how do i let people able to change the prefix of my bot?
With a database
@earnest phoenix map your prefixes
NOT A JSON FILE
and database
I knowwwwww
then why u ask?
But wtf do i go to learn the code
calm down
RE
Depends what DB you wanna use MATE
huh ;-;
what db do you wanna use
not all database have the same thing
startup//
import all prefixes from database
map all prefixes with their guild ids
//message event
if message starts with (prefix map.get(guild) || standart prefix)
// command to add prefix
map.set(guild prefix)
database.set(guild, prefix)
thats the framework there mate
huh ;-;
those are the steps you need
That’s literally everything you need
^^
Alright
how you do that is up to you, you could use arrays to map your prefixes, or patch them onto guild along with d,js, you can do MANY things, you have plenty of paths to take. THe one i gave you is the simpliest one
But how do i even get into the database, all i did in command prompt was "Npm i quick.db" I dont knnow what to do from there
read the docs on quick db
Aight
check its examples
I simply cannot fathom the fact that i just removed my ratelimiter and there hasnt been a single ratelimit yet, like wtf Ross?
so no one has a clue on how i can make canvas send faster?
IS IT SOME QUICK BACKGROUND?!
@slender wagon some friends are porting their image generator to Rust, its much faster
though Rust is a language
up to you
¯_(ツ)_/¯
I give up on coding shit
so basically not use canvas?
not what i said
@earnest phoenix then you don't belong in this channel
yeah i'm using js
Rust is a completely different language
so if you use Rust to generate images like an API you can make it much quicker
thats what a couple of my friends have been doing
@earnest phoenix then you don't belong in this channel
@slender wagon Shut up, thats what u all are, clowns that clown on people that are new to something, and dont know how to be nice, the only people who ever helped me here was Erwin, and Mattew
but do u know a way to make canvas a bit faster?
nope
alright
@earnest phoenix this is the dev channel if u want drama feel free to go in dm's
Then dont be mean ¯_(ツ)_/¯
BRUH
this is one bucket load of shit
ngl
NOT A SINGLE RATELIMIT
aparently the library doesnt like ME limiting it
oof
just throw at it without a single fucking ms of dlay and it behaves
how can I get the name of a sent emoji?
ex: /emoji 
you must be kidding

Twitch is dumb, the moderation system is full of assholes, lol
Still
i hear something about rust
yes
Twitch
are we making fun of it?
oofers
what are you trying to do
and that is why i don't do that lol
i was helping the library to handle IRC JOIN connections by limiting it on my end
aparently the lib enjoys more that i just throw the joins at it without delay
and let it handle itself
rather than me trying to ratelimit it
lol
oh?
damn how can i draw the presence status in canvas
serenity as in the library?
yes
my code was here
you got told already to stop using json as a db and that structure is god awful
never mind
it's not even that bad
i am using for 10-20 members i am not learning db for that
i have spent so much time trying to learn db
you say that now but you're going to throw a fit when something corrupts
liek i said i am only using for around maximum of 20 users
it will still corrupt
and the only thing its gonna store is their id and a value
x2
NO
is the max
calm your 
omg i am not spending another 3 hours on this
it’s not hard
quick.db is so fucking easy a toddler could do it
quick.db is so fucking easy a toddler could do it
quick.db is so fucking easy a toddler could do it
UGH WILL YOU FUCK OFF DISCORD
ok
How good is quick.db? I'm trying MongoDB but it's complicated
quick.db’s ok ig but mongo always better
How is mongo better
more scale able
quick.db is really easy to use and understand, but it does make a local sqlite file where it stores its data. mongo is better as it is remote, and is more scale able.
I'm only working on like 20 user's inventory balance and serverinfo stuff
hi people anyone know why my bot is throwing this huge log https://i.callumdev.pw/rt4nq.png
the scroll u see, is as far as it goes
so ye.. big
Looks like you console.logged client
also that pfp
it could also be axios
I love it
dont use axios
it could be node-fetch or something
nah it aint
what is using http?
because it was called on the object
check for console.log things
if you don't use the body property of the response object then it will throw something like that
@misty sigil when was the last atMods
They're both going to be quite slow tbh if you're cloning
why are you cloning a value
Yeah lol
ic
That only applies to non-primitive types though I believe
Actually nvm, it's an array so i'm wrong
Yeah I was thinking of arguments to the method. In my opinion, just use the one you want. I'd go with the second one.
arguments ||when they are called parameters, but no one cares||
@opal plank ```ts
type ChannelMethod = 'a' | 'b' | 'c';
arguments ||
when they are called parameters, but no one cares||
@vernal rivet
parameters:
class MyClass (parameters)
arguments:
...
new MyClass(arguments)
...
they are still called parameters, at least what i was taught. formal and actual parameters
public class Person
{
private string Name {get; set;}
public Person(string name) // parameters
{
Name = name;
}
}
Person newPerson = new Person("Mike"); // argument
you do realized that arguments are still parameters, correct? formal parameters are what is being asked for. actual parameter is what is being passed in. you can fact check me, you can call it arguments, but i personally like actual parameters more, because that makes a shit ton more sense.
By convention most people consider parameter to be like variables.
It's just nice to have something to differentiate
that makes actually no sense.
What about it makes no sense?
that's just what I learned in college was the naming for it
formal and actual parameters, Formal parameters are what is being asked by the method, function, or constructor. Actual parameters are what value is being passed in. its the actual value that the method/function/constructor will use.
sounds a lot like an argument
You can call them this and that. In the end they both share the same meaning to both of you.
I'm okay with that
agree to disagree
what does this error mean
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
axios = require('axios').default; axios.get('https://www.youtube.com/results?search_query=owo+you%27re+so+warm').then(function (response) {
let str = require("util").inspect(response.data);
console.log(str)
let a = str.match(/\shref\=\"(\/watch\?v\=.*)\"/)[1];
let buf = new Buffer.from(`${a}`)
message.author.send({
files: [{
attachment: buf, name: 'answer.txt' }] })
})
Is it coming from message.author.send(...)?
I doubt it would come from util.inspect
No, a as a variable.
Also why are you scraping YouTube?
Why not use their public API?
Is the quota too low for what you're doing? Cache the result?
how can i find the source of a missing permissions error? happens every few hours
Handling promise errors is usually the best step else they can be vague.
axios = require('axios').default
const ytdl = require("ytdl-core");
axios.get('https://www.youtube.com/results?search_query=owo+you%27re+so+warm').then(function (response) {
let str = require("util").inspect(response.data);
console.log(str)
let a = str.match(/\shref\=\"(\/watch\?v\=.*)\"/)[1];
let buf = new Buffer.from(`${a}`)
message.author.send({ files: [{ attachment: buf, name: 'answer.txt' }] })
message.member.voice.channel.join().then(function (connection) {
connection.play(a);
})
})
so that should work
abort(TypeError: Cannot read property '1' of null). Build with -s ASSERTIONS=1 for more info.
Aki may I ask what you're trying to do specifically? You say the quota is too low because you're only allowed to get 100 songs globally, yet you're trying to parse raw HTML and sending it as an attachment. What do you think a is supposed to be? A URL?
And scraping is not always the best option. Say if YouTube blocks your IP because of it.
That's just not how it works at all. You're sort of trying to attach a website's HTML content
then how does it work
How do you want it to work. What do you want a to be? It needs to be something attachable, like an image buffer or a buffer for file content.
Buffer.from() doesnt need the new
cannot read property 1 of null means no matches were found on str.match()
@sudden geyser ****
It should return that
<a id="thumbnail" class="yt-simple-endpoint inline-block style-scope ytd-thumbnail" aria-hidden="true" tabindex="-1" rel="null" href="/watch?v=h6DNdop6pD8">
<yt-img-shadow ftl-eligible="" class="style-scope ytd-thumbnail no-transition" style="background-color: transparent;" loaded=""><!--css-build:shady--><img id="img" class="style-scope yt-img-shadow" alt="" src="https://i.ytimg.com/vi/h6DNdop6pD8/hqdefault.jpg?sqp=-oaymwEZCPYBEIoBSFXyq4qpAwsIARUAAIhCGAFwAQ==&rs=AOn4CLCaooz9RwRH1ZvNTTjtLuQabZHtqQ" width="246"></yt-img-shadow>
from that
it did work>?
If I would add the API to my bot before it's verified will it work or will it bring up an error?
?
@tough bramble you need to be verified to get an api key
Tim coulg you help 
Cool! Just wanted to check haha
If I would add the API to my bot before it's verified will it work or will it bring up an error?
@tough bramble dbl api?
Yeah
would you even have a token for their API if you weren't approved?
No, Tim just explained this
I'm not keeping up
db.get(...) returned null and you tried to call .join("\n") on it. @earnest phoenix
@faint prism No worries lmao
I don't know if .get(...) can even return an array, but you should check what you're doing.
do you guys know any very cheap hosting site ?
Check what you're doing. Does .get() have the capability of returning an array? Why is badges null? Should you do an if condition to see if it's null beforehand?
var myobj = {guildID: message.guild.id, muteRole: muteRole.id}
const db = await MongoClient.connect(url, { useUnifiedTopology: true }).catch(console.error);
const dbo = db.db("mydb");
const collection = await dbo.createCollection("serverSettings").catch(console.error);
dbo.collection("serverSettings").insertOne(myobj, function(err, res) {
if (err) throw err;
console.log("1 document inserted");
db.close();
dbo.collection("serverSettings").findOne({}, function(err, result) {
if (err) throw err;
console.log(result.name);
db.close();
});
})
MongoError: connection pool closed
I am no expert with mongo but I am pretty sure that you shouldnt be nesting functions like this.
You are probably closing the connection while trying to access it 
oof
yeah, immediately after the first db.close(); comes a dbo.collection(..., and at that point the connection is definitely closed
cough cough ||sqlite has that exact problem, but it's called database locked||
i want it to be
guildID: {
muteRole: muteRoleID
}
but its currently ```json
{
_id: 5f67f494c3a3d361248cafc7,
guildID: '753764342071164990',
muteRole: '756763721061105715'
}
let guildID = message.guild.id;
var myobj = {guildID: { muteRole: muteRole.id}};
is that right?
what is he doing with guildID? and how is he indexing it?
its my first time using a database :(
well u dont want that, ur just creating another object which is useless
i want to access the guilds muterole
what ur doing is { objectid: id { objectid: id, guildID: guildid, muteRole: roleid }}
what u need to do is <Schema>.muteRole
what would myObj be then?
what
idk :(
do you know what key-value pairs are?
yes
i think
like
"player": {
"highscore": 5000,
"kills": 20
}
or something like that
im not sure
yes
key is a string, and the value is any. but the problem is that you can't use a variable to define a key, but you can have a key define a value. this is what lost was talking about. the guildID key, is not the object, its a property name. but there are ways of using an object to be used as the property name
ok how
ive got a big group called serverSettings
and i want eachproperty name to be a guild id
unless thats dumb
read this, it will explain how to do it.
if using the myCar thing,
would it be dbo.collection("serverSettings").insertOne(myCar, function(err, res) {
yes
I've wondered how js can tell the difference between err and res. in other languages it's the order you provide the arguments
i would assume its either based on types, or its that order 
mmm types yeah
JS doesn't really know the type as it's all done at runtime.
You can pass anything to it really.
So it's up to you as the programmer to check what type it is.
i mean you can, but you can define types in the program 
But you can't really have JS do it for you like how other languages allow or force you to set the type of a variable/parameter
no, but you still can do it, and if the program is well documented, and the have the type/param tag in the block comment it will declare the type for you
The tags (JSDoc) isn't really part of JavaScript. It's like Python's types module. You can set the type to be an int but it doesn't actually force it to be a type int. It's to guide the programmer but not the program.

396983037264658433,20000 how can i delete , and insert space between
so 396983037264658433 20000
can someone just tell me please
oh
ok ty
replace replaces all occurrences
So I am working on V4 of my bot
It's nothing of the former glory of V3 of my bot so far
The first command I am working on is my ban command
It is working, in fact it is the only command working in V4 (Help screens are a pain to autogenerate, so I will probably port V3s. Procrastinating on that)
Anyways, my (working) ban command has 3 TODO statements.
I want V4 of my bot to have the best ban command (:
(That is probably unrealistic)
One message removed from a suspended account.
It’s not that unrealistic to want that
The best ban command should obviously have things such as mod logs and timed ban
Maybe a web dashboard that people can ban users from (that's probably overboard)
It should optionally notify the user that they were banned, and for what reason
And I don't know what else competition is doing to snazz their ban commands
Is there a way to get the tag of the person who has the most "xp" in quick.db?
@still merlin why the ! ?
Typo, I’m on my ipad
I was about to comment thats typescript only syntax lol
you can use ‘db.get()’
@still merlin should i like get all the people and compare them and get the person with the most xp?
I’ve never used quick.db before, So that depends on what you choose. Maybe just try and get a xp level
check docs
quickdb doesn’t have a feature like that iirc
it wouldn't be a useful db if u couldnt query, they do have that
alr, thanks
const db = require("quick.db");
const used = new Map();
const duration = require("humanize-duration")
module.exports = {
name: 'work',
description: "flip a coin!",
execute(message){
if(message.author.id == 542278740537769985){
if (used.has(message.author.id)) {
const remaining = Duration(cooldown - date.now(), { units: ['h', 'm'], round: true})
message.channel.send(`You have worked recently! Please wait ${remaining} before working again.`).catch((err) => message.channel.send(`Uh oh! AN Error!\n \`\`\`js ${err} \`\`\``))
} else {
const bal = new db.table(`${message.author.id}mybal`);
db.add(`${message.author.id}mybal`, 2)
message.channel.send("you got **2** bowbucks for working").catch((err) => message.channel.send(`Uh oh! AN Error! \n \`\`\`js ${err} \`\`\``))
used.set(message.author.id, Date.now() + 1000 * 60)
setTimeout(() => { used.delete(message.author.id), 1000 * 60})
}
}}
}
it does this
wasnt me
Hmmm is there a way i can get the event type without re-typing it?
I found soemthing called youtube-search
its a npm
that is like youtube api
with out quotas
don't think so
Why wouldn’t a variable work I mean you probably tried it but just wondering
const db = require("quick.db");
const used = new Map();
const duration = require("humanize-duration")
module.exports = {
name: 'work',
description: "flip a coin!",
execute(message){
if(message.author.id == 542278740537769985){
if (used.has(message.author.id)) {
const remaining = duration(cooldown - date.now(), { units: ['h', 'm'], round: true})
message.channel.send(`You have worked recently! Please wait ${remaining} before working again.`).catch((err) => message.channel.send(`Uh oh! AN Error!\n \`\`\`js ${err} \`\`\``))
} else {
const bal = new db.table(`${message.author.id}mybal`);
db.add(`${message.author.id}mybal`, 2)
message.channel.send("you got **2** bowbucks for working").catch((err) => message.channel.send(`Uh oh! AN Error! \n \`\`\`js ${err} \`\`\``))
used.set(message.author.id, Date.now() + 1000 * 60)
setTimeout(() => { used.delete(message.author.id), 1000 * 60})
}
}}
}
^ it gives this:
anyone help?
?
sounds sketchy
ip grabbers too
.
its legit called
yt-search
and it can grab my ip
its illegal to do anything bad to it so
i wont call out a package out of the blue like that, its just really sketchy that its doing that
i guess you could try puppeteer and scrape it tbf
erwin could you help me?
no
what if I said pretty please
i'd say im still dissapointed in you
I dont need code
for going out on my back and asking around for the last bit of help you needed for the code before
you got 90% off me and then went on ask around the last 10
Ill leave nested functions
huh?
how can I get v out of an fucntion?
why would u get v out of a function?
bcs
videos.forEach(function (v) {
})
I dont need anything
in this
I just need v
and putting the script in it is nesting
you donkus
stop using the wrong thing then
use a proper loop
out of all the loops you have in your toolbelt you choose what is arguably the worst/most inefficient loop
@earnest phoenix you can put ur bot in any botlist, just dont advertise it here
read #502193464054644737
what do I use then
check js loops
loop in this context means an iterator, not something that'll keep repeating
const db = require("quick.db");
const used = new Map();
const duration = require("humanize-duration")
module.exports = {
name: 'work',
description: "flip a coin!",
execute(message){
if(message.author.id == 542278740537769985){
if (used.has(message.author.id)) {
const remaining = duration(cooldown - date.now(), { units: ['h', 'm'], round: true})
message.channel.send(`You have worked recently! Please wait ${remaining} before working again.`).catch((err) => message.channel.send(`Uh oh! AN Error!\n\`\`\`js${err} \`\`\``))
} else {
const bal = new db.table(`${message.author.id}mybal`);
db.add(`${message.author.id}mybal`, 2)
message.channel.send("you got **2** bowbucks for working").catch((err) => message.channel.send(`Uh oh! AN Error! \n \`\`\`js ${err} \`\`\``))
used.set(message.author.id, Date.now() + 1000 * 60)
setTimeout(() => { used.delete(message.author.id), 1000 * 60})
}
}}
}
^^^^^
Can we code in Mobile ?
@warm portal yes, but it will be horribly hard











