#development
1 messages · Page 1817 of 1
does anyone know why this does set the level to the right thing but doesnt reset xp to 0?
pretty sure they need to be in the same object
can someone code me few sentences fre
atm you're passing them as seperate parameters
i did but i couldnt find but thx
No? We won’t spoonfeed you, but you can ask for help with some code you have.
kid
bot.on('guildMemberAdd', function(member){
member.send("welcome");
});
will this send new members a dm?
yeah?
Yes
wow
Unless they block your bot
Also use lambdas it looks nicer (you don’t have to, just seems better)
eh idk whats lambdas
You just put client.login(“token”)
Lambdas are these: =>
what will the lambdas do
For example, instead of writing out this, you can write something more like
bot.on(“guildMemberAdd”, (member) => {
// code
});
It’s the same thing as what you wrote, it’s just nicer-looking
(Also I apologize for the formatting, I’m on mobile atm)
Yeah that’s just whatever code you want to have run whenever your guildMemberAdd event triggers
bot.on(“guildMemberAdd”, (member) => {
member.send("welcome");
});
Perfect!
is that will send a dm to new users who join
ok
i forgot how to use vs code
oh
alr i know
new file
client.login(“token”)
bot.on(“guildMemberAdd”, (member) => {
member.send("welcome");
});
@wheat mesa
would it be like that
is repl a good website to host a small website
hey
is this correct
client.login(“token”)
bot.on(“guildMemberAdd”, (member) => {
member.send("welcome");
});
self bots are agents TOS
oh
Yeah...
but i can still use
so...
on my risk
but discord has a good chance of catching u
None of us here could help you with it if it's a selfbot
they literally have anti cheat for discord
ye
I recently joined @vercel. I used lots of time to reduce the build times of web apps and I'm going to improve it of next js. I love the motto, "Make the web faster".
123
but is this for token
client.login(“token”)
bot.on(“guildMemberAdd”, (member) => {
member.send("welcome");
});
creator of swc
By selfbot, you mean automating your own account, correct?
Okay yeah, I was just making sure that you didn't mean like "self bot" as in, a bot that you create yourself
It's not illegal per se, just against discord's ToS and they can terminate your account at any point
ok
but is this how to make a token
client.login(“token”)
bot.on(“guildMemberAdd”, (member) => {
member.send("welcome");
});
@wheat mesa
hellloo
not helping 😮
Why did you ping him?
wrd lmfao
Don't think I can help you with that, now that I know it might be used for a selfbot
okay now you wastem y fucking time to find another person who will help
i said i didnt know its ilegal and ill uise a bot
but noo you still wont help
Because you can say something and do something else.
fuck u
I'd rather not risk it, even though I'm pretty sure that's not even how you create a selfbot.
bro bake out of here and go to a crappy dev server
Did they not disable user tokens in djs?
I'm not sure, I've never tried
I don't really know much about selfbotting, I just know it's against ToS
it matters what version
What a gamer
v11 has selfbotting chances but v12 they removed it and bruhhill’s code looked like v12
I mean, you'd think that they would remove that functionality even in older versions to prevent that sort of thing
self bots are cool as a concept, but it's good that they're not allowed
I have a bot and the Help is done. The help looks sloppy. Can someone come and fix it?
We can help you if you have issues, but no one is going to write all your code for you 🙂
yeah but I don’t think you can downgrade to diff versions (from what I know)
Fair enough
Hello. 👋
I have a command handler, you input values to the properties of name: to name the command, description: to give description to a command, and etc.
I sometimes don't want commands but events whereas if someone said, for example, Idiot, it would react with a reaction, or reply with a message.
I've tried searching for videos like those.. can't seem to find. I want to do it in my message event.. but that would be too unorganised.
.. kind-of lost, ideas?
can you install youtube-dl and ffmpeg on heroku
Anyone knows how to fix? Casting it as TextChannel also returns an error
why don't u retrieve the textchannel instead of a raw channel?
this.client.channels.cache.get("858264225105575937")
also, looks like you have deprecated stuff up there
is the channel in the same guild as the command's channel?
or isnt that a command?
how did you cast it?
(<TextChannel> channel).send(...)
I just realised it's because the channel is undefined
which is weird
because I basically had the same code in js
and it worked
cache maybe?
I guess
channels should always be cached
if you use normal discord.js
fetching wont make a difference
you said you casted it, but the code you showed doesnt have the casting
can you show the code with casting and the error warning?
Hello. 👋
I'm having this code.
Inventory.updateMany({}, { $unset: { test: ??? }}).exec();
```It removes the test property in **MongoDB**.. but how can I remove a property that is inside an array of objects and this array is called `lmao`
filter the array ig
How, though?
well, you need to fetch -> filter -> save
don't think you can do it in a single command
That sucks..
in sql it'd be possible 
God damn… who could think of a server in your garage would be a dust “collector” 
At first.. I thought I wanted to do that.. but sadly I wasn't.
Well.. I'm removing that property from 500 documents.. :((((
.. but I realised it's 13 anyways.
😂
Imma do it manually.
Edit: 13 document - 10 = 3.
Would say that’s a fucking good result
that is surprisingly clean
Is this your PC?
.. or is that not a PC.
Now the dust got blown out into the garage waiting for being suck into the system again
lmao
Nope a server
close enough
Yeah just with the difference the hardware is like 10x more expensive
But fair enough as the most components are running 24/7 the last decade without any issues so far
this randomly popped into my mind but how does top.gg know if the bot the users that are submitting are actually owned by them and not someone else?
It doesn't
so does that mean i can take someone else's bot and submit it as mine?
technically, yes
Yes but good luck if you get confronted about it
woa
but like, if you can prove the bot is actually yours I guess the fake author will probably be banned and the ownership transferred to you
i see
lmao imagine if i uploaded dank memer as my bot and the vote revenue goes to my wallet
can someone tell me what is wrong in this?
async def whois(ctx, member: discord.Member):
roles = [role for role in member.roles]
roles = []
for role in member.roles:
roles.append(role)
whoemb = discord.Embed(color=member.color, timestamp=ctx.message.created_at)
whoemb.set_author(name=f"User Info - {member}")
whoemb.set_thumbnail(url=member.avatar_url)
whoemb.set_footer(text=f"Requested by {ctx.author}", icon_url=ctx.author.avatar_url)
whoemb.add_field(name="ID:", value=member.id)
whoemb.add_field(name="Guild name:", value=member.display_name)
whoemb.add_field(name="Created at:", value=member.created_at.strftime("%a, %#d %B %Y, %I:%M %p UTC"))
whoemb.add_field(name="Joined at:", value=member.joined_at.strftime("%a, %#d %B %Y, %I:%M %p UTC"))
whoemb.add_field(name="Roles:)", value=" ".join([role.mention for role in roles]))
whoemb.add_field(name="Top role:", value=member.top_role.memtion)
await ctx.send(embed=whoemb)```
let nextLevel = profileData.level * 300;
let newLevel = profileData.level + 1;
if(nextLevel <= profileData.xp) {
let secondResponse = await profileModel.findOneAndUpdate({
userID: message.author.id,
}, update, {level: newLevel, xp: 0});
if(secondResponse) message.reply(`Congratulations, you are now level ${newLevel}`);
if(!secondResponse) {
message.reply(`OOPS, I tried to update your level but it failed, developers have been noticed.`);
console.log(`Failed to updated ${message.author.tag}\`s level. They are currently level ${profiledata.level} with ${profiledata.xp} xp.`)
}```
expected vs actual result?
?
what is expected to happen vs what did happen
well its supposed to be a user info command but it says that an error occured when ever i try it
ok, show the error
?
@lyric mountain they made a typo in their code lol
yeah
oh, ok
discord keeps giving the developers badge?
no
and how has your xd
does someone know why this only updates the level and doesnt reset the xp
.__.
before it retired
i got it years ago
ok
thx
Tim do u know how to use mongoose
no
i did, several times, didnt help
still does the exact same thing
do you know whats wrong?
res.json(OBJECT)
?
so statsJSON.toString ?
.json() also helps with serializiation of the JSON content for HTTP requests
which is extremely important
non-serialized JSON be like 🤢
oh alright thanks
do you know why it still does exactly the same?
does anyone know any good JS minifer scripts that either obfuscate or 1-line minify the HTML contents of a webpage?
If you're looking for something like an express middleware, there's one called express-minify which automatically minifies any cdn requested from your website.
It uses uglifyjs for JS which supports, well making JS ugly aka obfuscating
transform the js into jsfuck, profit
that would increase your load time lmao
but it'd be obfuscated 😎 👉 👉
trying to not hit performance too terribly
your html is technically 1 line in the first place
you knew what i meant cf8 
why not just let CF handle it?
do they have an option for minification/obfuscation like that though?
cf caches a helluva of stuff
I will not let ChillFish8 handle it
But ChillFish8 is really useful
I was trying to make the boot logo round but it's just in the preview, what should I do to fix it?
and sometimes when I restart the page it stays as it was before
here it appears that I modified the tag
´-´
.entity-header__details img {
border-top: 6px;
}
.entity-header__image {
border-top: 6px;
}
I put this css
Making it round requires to use the border-radius property
ahhh
Don’t forget to append !important to the rule to enforce it
border-radius: 999px !important;
I didn't even see it, it was supposed to be that, I accidentally put it kkkk
OK thanks
And use a CSS border generator to get the right properties for Mozilla and webkit devices
Should be something like:
-webkit-border-radius: …
-moz-border-radius: …
border-radius: …
@old umbra
when I load the boot from my bot it doesn't load what do I do for it to load the auteration I made instead of it taking the one I did before?
like I just changed the logo but when I go to see the bot page it doesn't load
he sometimes takes the previous change
Thanks
border-radius: 50% is better to use. I mean, a size big enough to make 999px not work as intended would never really be reached, but 50% is guaranteed to work all of the time no matter how big your element gets.
Yes, a good note
I'm 1000% nit-picking 😅 but just a note 😉

I can deal with critics as long as you criticize somebody else not me

sarcasm warning
I put 100px and it looks good
Percentage is the better choice as he said
beautiful haha
but it still doesn't update the site
Huh topgg got a new design?!
Not even aware of that
CTRL + F5 to clear the cache
Or SHIFT + F5
(depends on the browser)
yeah, shift+f5 + some luck
will not
ahhh
it resets the page but it doesn't change to new designer
😭
can someone give me a one or two sentence description of what a restful API is?
Bruh literally noone can help me
a google away
that doesnt tell me shit
also a google away
mf i know how google works
then use it
this is a useful article
you don't have to go beyond headers and paths
I got it, its more of a philosophy about how to design than like specific implementation
it pretty much means being able to access/execute it any time from anywhere without any precondition or setup, as everything is self contained
did i ever show you how a certain satellite tracking api works?
lmao
enlighten me
it uses cookies
you have to make a request first, store the cookie, and send all other requests with the cookie. the cookie lasts for 2 hours, after which you have to get a new one
the first request needs to send username and password to get the cookie
then
their routes are like this
that's so unnecessarily complex
it's basically reinventing CSRF tokens
whoever designed that must've been on crack
Wtf
@drowsy crag
const { MessageMenu, MessageMenuOption } = require('discord-buttons');
let menuOption1 = new MessageMenuOption()
.setLabel('Fusion I')
.setEmoji('1️⃣')
.setValue('f1');
UnhandledPromiseRejectionWarning: TypeError: MessageMenuOption is not a constructor
What am I doing wrong here 
Using discord-buttons
too embarrassed to show
I added a menu in addition to the help menu of my bot, but when I go to that menu, it throws the help menu before it, even though I set aliases, I couldn't fix it. What is the problem?
@ripe prairie
thanks
anyone can explain me my bot not coming online in same code i put other bot token and this is only why ?
come on, you can read mind, can you
Mind reading is not included in your current plan.
Would you like to purchase it for just $49,99 per month?
Plus the one time setup fee of $420.00
ok so I am trying to make some reaction thing with the reactions from my server but the filter won't detect them. any idea what am I doing wrong ?
if(pistol >= 1){msg.react('')}
if(mac10 >= 1){msg.react('')}
if(ak47 >= 1){msg.react('')}
if(m4a4 >= 1){msg.react('')}
msg.edit('',craftembed[message.author.id])
const filter = (reaction, user) => {
return ['','','', ''].includes(reaction.emoji.name) && user.id === message.author.id;
};
msg.awaitReactions(filter, { max: 1, time: 120000, errors: ['time'] })
.then(collected => {
const reaction = collected.first();
craftitems[message.author.id].push(reaction.emoji.name)
message.channel.send(craftitems[message.author.id])
msg.delete()
RefreshCrafting()
reaction.emoji.name returns the emoji name (e.g. ak47) so your filter won't pass
Use reaction.emoji.toString(), that returns the mention (e.g. <:name:id>)
I wish I can publish this without the fear of 429 from YT
shame YouTube doesn't let people stream content through a 3rd party with no ad revenue for free isn't it
ip rotators op.
the API is too much rate limited
well you're not supposed to be using it anyways lol
actually no you can
just not for that
@quiet sedge this guy answered you
yt music enters the chat
i wonder why people dont use REAL music services like spotify or musixmatch which do allow music streaming through their api
are you too broke to buy an api key?
yooo, im trying to get the bot to react to a message that it has just sent out from a list but it doesnt seem to be doing so :/ am i doing something wrong?
channel.send(sendingmessage).then(r => {
for (x in reaction) {
r.react(reaction[x])
}
})
Why not vr
@pale vesselHi, what perms does a bot need to detect members voting for a server?
if the bot dev is using webhooks then it doesn't need perms?
Yes
what if he is not using webhooks, what to do?
oh alright, I will tell them so. Thanks for your help.
Okay, one more thing please.. what perms to track invites?
alright, thank u:)
@opaque fern adding that perm didn't make it work
I'm not the dev, but we are trying to track invites by members to others
like.. ppl inviting their friends or so to our server
so we want to track how many invites does each has/makes
just asked him.
You mean animated emojis and stuff?
@wary forge nope gif s like this
I wouldn't tell my users what the bot was built with tbh
embed.set_image(url="direct link") in discord.py
@wary forge but I want to add it in a specific one command oy on help
So I will add it in help.js?
I don't know about discord.js but in discord.py you can just add an image to your embed using
embed.set_image(url="direct link")
@wary forge but I need js
I guess it's .setImage
Hello.
When is the best time to start rewriting my bot? .. when V13 is stable or from now?
From now, if you wait v13 to release, you be waiting eternity
^
How does this work?
Just started learning coding in js and wanted to ask what is the console.Log() actually do and whats it used for in actual code cuz i understood the other stuff except this one.
ty stara ruro
console is the primary output for js, where you can see your results, for example the browser console, the windows cmd, the linux terminal, etc
console.log writes stuff to the console so you can see them
ty stara ruro
ty stara ruro
ty stara ruro
ty stara ruro
ty stara ruro
ty stara ruro
ty stara ruro
ty stara ruro
ty stara ruro
ty stara ruro
ty stara ruroty stara ruro
ty stara ruro
ty stara ruro
ty stara ruro
Ic Thank you lots btw i didn't understand a single word above 
ty stara ruro
dafuq
ty stara ruroty stara ruro
ty stara ruro
ty stara ruro
ty stara ruro
ty stara ruro
ty stara ruro
v
ty stara ruro
ty stara ruro
@round cove
Spamer?
kurwa

xd
@flat pelican
please ban me
XD
maj englisz iz fanstastik
sigh
how are you learning js?
-m @steady shell Spamming & asking to get banned | 1 month
🤐 Muted Ezdrass ツ#7206 (@steady shell)
Code academy beginners courses
the console is the rightmost window
where you see the output of your code
Ic ok thanks now it makes sense
console.log writes the output in the console, without it nothing will appear there
Ic
I don't think those comments are accurate to what it does
ye lul
why does it show like this?
Else if doesn’t belong to a try catch statement
did you mean if (role) {
muteRole = role;
}
?
now yes.
theres only
try, catch and finally 
I thought theres also if-...
try means to try a code
catch means if there was an error it will catch it instead breaking the whole code
and finally means if the code succeeded or not it will run the code 
try {
l()
} catch(e) {
console.log(e) //l is not a function
} finally {
console.log("i run no matter what happens")
}
thats in if statement much more different than the try catch one
an*
np
this is not the OwO bot support server
okey
he said (on_events) not sure what is that, u know?
speaking to me?
Yup
I have no clue, u want me to ask him?
Sure
@slender thistleYea it's python. he said
do u know what perms to give a bot to track server invites?
Manage Guild gives perms to view server invites iirc
I wonder if it fine if I just use github page for bot webpage
yes
u mean Manage Server?
Yeah
Used it for mine, why not?
Update disbut to latest
It was latest 4.0.0 but yeah it got solved when I reimported the package

But thanks for reply
Np 🤔
Here it says the bot has no authorization, but what permission does the bot need?
what are you trying to do?
I'm trying to start the radio, the bot has the authority to enter the room, it has all the authority related to the room, but the log record says it has no authority, it works when I give the bot administrator permission, but I don't understand what permission it actually wants.
where did you give permission to it? role or channel?
channel
it cant join the channel or cant talk?
and it can play normal songs but for some reason the radio can't play it either
not authorized to the audio channel
hm, if it can play normal but not radio then idk
is there any difference in the code for both?
Yes there is
could you show it?
Because the ability to play normal music is thanks to artificial intelligence, but the radio broadcasts directly from the site.
Of course
What should I fix next year, what authority does it need?
I mean, what's the difference between both normal and radio code
that's only the radio code
The above also makes use of the normal music code, and the radio code is the difference between the above code and the usage.
So I'm using keyv as my databse "handler" (mysql) and I'd like to gain all the data with one query. Keyv does not have a method that does that from what I know. Does anyone have an idea how to? Do I just make a custom function to connect to the db and query all data? Or is there a better way?
Sorry, I can't share the other code.
well, that's as far as we can go then, you need to compare both codes and see what you're doing differently
in all cases, MANAGE_CHANNEL perm should prevent any channel-related issues
also don't be so obcessed over copyrighting a section of code
It's ok so the bot can't resolve 'MANAGE_CHANNEL'. Thanks ❤️
nonono, that probably isn't the actual issue, but manage_channel will allow free access to the channel for the bot
like, no mute or contraints preventing the bot from talking or joining it
I've had a lot of trouble in the past for similar reasons, so I'm sensitive about it.
that code is just a basic embed menu, even if you didn't show I'm pretty sure it's common out there
protect your complexier code, not the basic stuff
also I see a ton of references there, so without them that code is anti-copypaste-proof
what?
what "all data"?
like, all rows from all tables?
Is discord.js v13 out?
I mean, I asked because the bot can't tell users the error it is getting on the radio command Normally it works fine when I allow it, but there is a problem with the test servers.
all rows from a certain table
To download the v13 Dev Version: npm i discordjs/discord.js
SELECT * FROM table
json syntax
you cant have ```js
{
const answers = []
}
but ```js
{
answers: []
}
but the file is with the extention .js..
json = javascript object notation
if you return something that is inside brackets it's expected to be a json or a function
why not a json tho?
folder's name is jsons
didn't notice that lul
and.... ? I mean its just a folder name I did.. I thought that like it thinks that when the folder is named JSON
he doesn't mean that
Just to know for the futer.
it's just ironic that the folder is named "jsons" and you don't want to return a json
but anyway
why not return a json?
you'd need to export a function or an object
alr.
you cant use const inside an object literal
The only good thing about js is json
I don't know any good thing :/ I write in .py instead =p
@torn mesa what is legal ways? It is not copyrighted and you don't own that right when you write "depends on copyrights" . Also you can't file a report because someone is using code you posted to discord chat
how do you get the length of args ? like the PER CHARACTER limit
trying to put a character limit on my owoify command 
current code is https://github.com/thefirstmine/thefirstbot/blob/master/commands/fun/owoify.js
"per character" limit?
Imagine copyrighting your shit code

you mean total char limit?
Probably will want to get length from the actual message content, would be easier than getting it from args
That was not directed towards you
i see, sorry for assuming
what the fuck is "legal ways will be applied!"
why would you put your code on github if you plan it to be closed source 
idk, probably just want to scare people not to try stealing the code
You can be open source and not license code for being used for others.
^
posting it to discord channel
Technically speaking some code is free to use even if you write it.
For example the code above(in the file, not GitHub) all seems to just be discordjs methods, a court probably wouldn't consider it stolen even if you did take it without a license.
that's what I meant here
The same way small parts of songs cannot be copyrighted.
yeah unless you used a specific length of a song
say more than a minute
just how it works in yt tho i swear the copyright system there is really busted, but not the right channel to discuss it
Oh I'm not talking like free use. I mean like basic cords cannot be copyrighted.
A small jingle absolutely can be copyrighted
i see
twitch be like:
- me playing without any music, only game sounds
- an egg car passes on my street
- YoU cAnT uSe CoPyRiGhTeD sOuNdS, tHe ViDeO wIlL bE mUtEd FoR 1 HoUr
true although lets move to general for that
Very twitch like
inb4 we get
by mods
const config = require("./config.json");
const client = new Discord.Client();
const prefix = config.prefix;
client.on('message', function (message) {
if (
message.content.toLowerCase().startsWith(prefix + 'djrole')
) {
if (!message.member.hasPermission('MANAGE_MESSAGES'))
return message.channel.send("You cant use this command since you're missing `Admin` role");
let role = message.guild.roles.cache.find(r => r.name === "Vodify DJ");
let member = message.mentions.members.first();
member.roles.add(role).catch(console.error);
const user = message.author;
const djrole_embed = new Discord.MessageEmbed()
.setTitle('Vodify DJ Role:')
.addField('Role Added To:', `**[${member}]**`)
.addField('Added by:', `**[${user}]**`)
.setThumbnail('https://imgur.com/O8y9v9b.jpg')
.setAuthor('Vodify Developer', client.user.displayAvatarURL())
.setColor('PURPLE')
.setFooter('Vodify Moderator', 'https://imgur.com/iX6h2rZ.gif');
message.channel.send(djrole_embed);
}
});
client.login(config.token);```
can i pass a class as another class constructor arg?
ye ig
Anyone wanna help me. Its all working perfectly fine. But when I only type !djrole it cause errors
saying roles is not defined
idk how to do the catch error thingy
hmm im doing it rn and i dunno why the first class didn't seem to work
this is the constructor
constructor(agent) {
this.Agent = agent;
}
tyty
I only pointed to the probable error cause
then i call it
const { data } = await this.Agent.get("home");
and it says Cannot read property 'Agent' of undefined
where is that const?
its like
class Name {
async Here(){}
}
...that doesn't answer my question
its like
class Name {
async Home(){
///Here im sorry
const { data } = await this.Agent.get("home");
}
}
that wont work
because the constructor isn't called yet when you try to set the property
class Name {
const a = this.args; // args doesnt exist here yet
constructor(args) {
this.args = args;
}
function getA() {
return this.args; // it does exist here tho
}
}
when i use the class i do it like this first
const Base = new Controller(Agent);
whats wrong with your class wtf
umm wait a sec
// Define a class
class Name {
/*
* args
*/
a = this.args
/*
* Create the class
* @param {any} args
*/
constructor (args) {
// Assign args = args
this.args = args
}
/*
* Return a which is args
* @returns {any} args
*/
getA () {
// Return a
return this.a
}
}```
there you go
I fixed it for you
thanks I prefer the verbose way
still the same error!!?
added more coments
its like this rn
class Controller {
Agent = this.arg;
constructor(agent) {
this.arg = agent;
}
async Home(){
const { data } = await this.Agent.get("home");
}
}
getA is supposed to return this.args tho
whytho
it's an example of where the variable would be valid
a wouldn't be able to receive this.args outside of the constructor
class Controller {
Agent
constructor (options) {
this.Agent = options.agent
}
async home () {
const { data } = await this.Agent.get('home')
}
}``` I would do it like this
but getA would be able to return this.args because it exists after creating the object
yeah
see? that's what I was talking about
Agent = this.arg is impossible
is this typescript?
not outside the constructor
does try catch change this variable?
defining shit outside of the constructor doesn't work?
cause that was called inside a try catch
it does, but not in this case
prealocating props outside the constructor is a typescript thing
doesnt exist in js
oh what
Agent is undefined
this.arg is agent
it works for static stuff tho, right?
the error is "Cannot read property 'Agent' of undefined"
ok js is dumb wtf
so "this" is the one that undefined
hey guys anyone know something about paypal integration?
// js
class Bla {
constructor(arg) {
this.arg = arg;
}
}
// ts
class Bla {
arg: string;
constructor(arg: string) {
this.arg = arg;
}
}
in node.js
// better ts
class Bla {
constructor(public readonly arg) {}
}```
yeah it was like this at first
I think
then dont
"this" is undefined
with what code?
do i have to return "this" on the constructor?
no
no
you can iirc?
both
show code, so many codes were posted idk which is which
you can return something else from a constructor, if you dont it will return this by default
isnt it nonstandard to return anything else tho?
class Controller {
constructor(agent) {
this.Agent = agent;
}
async Home(){
console.log(this);
try {
console.log(this);
const { data } = await this.Agent.get("home");
} catch (e) {....}
}
}
both log show undefined
how did you run that code?
How
anyone know where this message is? #starboard message
How can this be undefined
const Controller = require("./client/controller");
///....defining the Agent
const Base = new Controller(Agent);
then Base.Home()?
yeah
you might have a circular dependency
What's up with the excessive PascalCase here tho
why the fuck is it on starboard?
Unexpected indent is a nightmare for me
it is funny
(ask Tim, he starred too)
oh this guy
his final message before mute was that
iz yuor english fantastik?
whats difference between compiling to commonjs and esnext
Lles
english only please
ok that one gets a star
esnext will have all the new js features
commonjs will add polyfils instead
im using ts btw
is there any more performance or something like that
not really
compiling to old targets will produce bigger code
so you get a bigger js file
other than that, old code can even be faster than new code
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));```
nice shitcode
more readable than the average javascript "developer"'s code
There's no declaration doe
isnt activity thing is declaring a variable?
you don't have to do that.
Btw just pass them when instantiating the Client object rather than changing it in on_ready so that it's sent when identifying
I realized, something was wrong with my host.

well this is awkward
Jokes on you I still use on_ready 
is this d.py?
read👏the👏docs
i'm trying to make a command to remove member ids from a file
here is the code:
@client.command()
async def removeban(ctx, user: discord.Member=None):
with open('banned.json', 'r') as f:
users = json.load(f)
users.pop(str(user.id))
with open('banned.json', 'w') as f:
json.dump(users, f)
but i get this error " 'int' object has no attribute 'pop' "
any way to fix this? (python)
Ok and? (Apparently the error was already there and I did not see it)
change {member} by {member.name} in print
How is there an about the bot on bots (like About Me)? PokeTwo has it…
@earnest phoenix
what u want do
line 16 change
await client.send(your message)
or
channel = client.get_channel(channelid)
I will change in line 16?
wait
channel = client.get_channel(your_channel_id)
await channel.send(your message here)
No change rip
Hello I am new to discord.js bot coding and I would like to know how to announce that a person has voted for the bot on top.gg if you can mp me
google -> @top.gg/sdk
it's everything you'll need
``import got from 'got';
^^^^^^
SyntaxError: Cannot use import statement outside a module``
How do i fix this?:```js
const Discord = require("discord.js");
const client = new Discord.Client();
const auth = require("./config.json");
const fs = require("fs");
import got from 'got';```
Use require()
🩴
i can use the require method when trying to start the bot on my pc
but as soon as i use the bot on my vps it says that it needs to be imported
Ugh
What was the actual error
Well unless your version supports using imports then import wont work
this
"Cannot"
What is your node version
Did you ignore that word
v12.18.3
Mmm update
You are old
iirc 14+ or 15+ is the current stable
and iirc they support import syntax
Also that's not a VPS, that's fucking heroku
Try upgrading your node version
okay will try updating node
Yes it should, but they still should update node
v12 is quite old
It could also be an issue with that specific version of v12
require could of been broken idk
it's really strange as the package works with require when i run it from vsc
but as soon as i put it on heroku or my vps, it just gives the import needed error
No way lol
Yea, I doubt it but 
I can't be bothered to look up if there was an issue with it
how do i update node.js through vsc?
oki
If you are on your local machine
you just gotta download the latest installer for the stable verison
however it is still strange that it gives me that module error
eventhough i can run it perfectly fine from my pc
I don't really know tbh
I just know a common issue is a version issue
Beyond that im am useless on this topic
@earnest phoenix Hey, sorry for the tag but can you help with this error I am getting when I select something in a MessageMenu?
UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown interaction
bot.on('clickMenu', async menu => {
await menu.clicker.fetch();
const user = menu.clicker.user.id;
if (user != message.author.id) {
return menu.reply.send("Test0", true);
} else if (menu.values[0] == "1") {
return await menu.reply.send("Test1", true);
} else if (menu.values[0] == "2") {
return await menu.reply.send("Test2", true);
}
})
Edit: The thing is working btw, just getting that error in console.
eh wtf?
I’m in phone I think it doesn’t work
@commands.command()
async def rank(self, ctx):
stats = levelling.find_one({"id" : ctx.author.id})
if stats is None:
embed = discord.Embed(description="You haven't sent any messages yet.")
await ctx.send(embed=embed)
else:
xp = stats["xp"]
lvl = 0
rank = 0
while True:
if xp == ((50*(lvl**2))+(50*(lvl-1))):
break
lvl += 1
xp -= ((50*(lvl-1))+(50*(lvl-1)))
boxes = int((xp/(200*((1/2) * lvl)))*20)
rankings = levelling.find().sort("xp",-1)
for x in rankings:
rank += 1
if stats["id"] == x["id"]:
break
embed = discord.Embed(title="{}'s level stats".format(ctx.author.name))
embed.add_field(name="Name", value=ctx.author.mention, inline=True)
embed.add_field(name="XP", value=f"{xp}/{int(200*((1/2)*lvl))}", inline=True)
embed.add_field(name="Rank", value=f"{rank}/{ctx.guild.member_count}", inline=True)
embed.add_field(name="Progress bar [lvl]", value=boxes * ":blue_square:" + (20-boxes) * ":white_large_square:", inline=True)
await ctx.send(embed=embed)
@commands.Cog.listener()
async def on_message(self, message):
stats = levelling.find_one({"id" : message.author.id})
if not message.author.bot:
if stats is None:
newuser = {"id" : message.author.id, "xp" : 100}
levelling.insert_one(newuser)
else:
xp = stats["xp"] + 5
levelling.update_one({"id" : message.author.id},{"$set":{"xp" : xp}})
lvl = 0
while True:
if xp == ((50*(lvl**2))+(50*(lvl-1))):
break
lvl += 1
xp -= ((50*(lvl-1))+(50*(lvl-1)))
if xp == 0:
await message.channel.send(f"Well done {message.author.mention}! You leveled up to **level: {lvl}** and earned 100$!")
cursor.execute("SELECT * FROM users WHERE tag = ?", (message.author.id,))
result = cursor.fetchall()
if len(result) > 0:
for row in result:
pass
cursor.execute("UPDATE users SET money = ? WHERE tag = ?", (row[2] + 100, message.author.id))
storage.commit()
else:
cursor.execute("INSERT INTO users (tag, job, money) VALUES (?, 'no_one', ?)", (message.author.id, 100))
storage.commit()
It doesn’t work but doesn’t give errors, any suggestion?
if xp == ((50*(lvl**2))+(50*(lvl-1))):
break
lvl += 1
this part looks like it could miss and then loop forever
I got it from a yt tutorial
start adding logging to each line and see where it stops logging
Access to XMLHttpRequest at '(mylinkwashere)' from origin 'http://localhost:4200' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Why does this happen in magix ide?
well, welcome to cors
you need to whitelist your origin
cors basically block any request coming from another origin
this is to protect your service from injections and other "hacks" that can manipulate without you allowing
<add name="Access-Control-Allow-Origin" value="http://localhost:4200/" /> this is teh code
the*
I have already allowed it right
so how would it still block my requests
the other way around
do it on the server
cors is almost the WORST thing to deal with
only losing to CSRF errors
wait what
ye, allow cors on the server
how would i do that then
as i am using magix ide
so that like automatically does that iirc
"how to fix CORS policy error on XXXX lib"
@lyric mountain
Is it just me… ?
Try to send a random URL with a port please in here
that is a valid url btw
It’s working now
what was happening?
?
Using non-numeric chars as port will add it as query argument automatically
(http://example.com:port/)
(http://example.com:port/)
Ahh my bad I see
also adding quotation after a link is impossible
Discord just rewrites the URL if the port isn’t a valid numeric value
Even sending an invalid URL should be my decision and not be rewritten 🤦♂️
Trashcord
that's cool but, did you ever try to write `` inside ``?
As in just let it fail
literally impossible because escaping ` is impossible
so you either escape all or escape none
code913
lmao thats how you remember him
the alternatives are harsh
define decent?
could be $3 a month, could be $300 a month to thousands a month.
it really depend on your bot size, how much overhead you want, the library your bot uses, and functionality.
I've heard DigitalOcean is good, not sure though.
Their basic plan is $5 a month
Pretty good imo
Digital ocean is very expensive for what you get
is it possible to change the page title? I would like to change the ft and in the title put "Julinha | Top.GG"
cant u just rename the bot?
no bro I just wanted to change the business
to stay the way I like it, you know
to match the page too
Well, sadly you can't rename the page since that's a metadata defined on the <head> of the page
You can't override it
ohhhhh ok
The only thing you can change is the css, everything else is fixed
I understood
What do you recommend/use?
OK thank you
I rec contabo
Haven't bothered with a VPS yet, but that's the next step so I've been looking around for advice on which ones to look at.
Great support, great price and after the service rework, no problems so far
I use Hetzner
contabo gives you the biggest stats for the price by far
damn that's cheap asf for what you get from it
Ye
everything else is not even close, which makes you question the validity of it
however most people confirm that they are indeed for real
Tbf, contabo site used to look like a scam site lul
ye
But indeed, legit business
I highly doubt this would happen, but would they charge for going over the 32tb limit, or do they just block off your connection until the next cycle?
I never ever got even close to it
32TB is a massive amount
Put massive in that
Unless you're running a piratebay site reaching that is physically impossible
the logical conclusion is that their hardware is older/slower, thats the only explanation for such cheap prices
but the raw stats offset it
Used to be, they reworked all the stuff
They used to have hdd and ssd plans
Hdd were the old and oversold stuff
ye overselling and steal is also a thing
But well, for $2 you couldn't expect more
Nowadays it's everything much more stable
I'll consider this as an option, honestly looks great for hosting a bot
For now I'll stick with my free host until my bot grows in size.
i never actually tried them but heard great things
some people did run some benchmarks on them per my request and my theory was kinda confirmed
but it varies from instance to instance
I'm some people

Stupid question, but what's the difference between vCPU cores and just normal CPU cores?
nothing
Oh okay good
well...
the first one explicitly says its logical cores
the second one makes you think for a while if they mean logical or physical
a vcpu is like you having 1 core of an 8 core cpu available, right?
but 99% of the people mean logical cores
The only way to get actual cores is buying a dedi
an 4 physical core cpu with hyperthreading has 8 logical/virtual cores
Also if I were to buy that, would it be worth paying the slightly extra fee per month for a US server, or not since it's only a discord bot?
well the closer you are to discord the better in terms of your ping to the api
would be important if you're doing music
US ping to discord is 20-40ms, Europe ping to discord is 80-120
Alright
no, discord has localized servers for audio
oh fair enough, ive not dealt with music much
I'll probably look into paying the extra for a US server if I need to
But I doubt it'll make a huge difference
yeah
GalaxyGate seems like a good option too
anyone know any good hosting sites?
I'll also have to figure out what steps I need to take to host a bot on a linux server. Never worked with linux before, so not sure what differences there might be in the setup
what lang
Paid or free?
Really, really different if you're used to interfaces
But I say in 2-3 days you get natural with it
free ones are real?
It's just that the first time is really scary
You have all the power to royally fck everything up
But keep calm and explore it
000webhost 
Always remember, stay away from chmod 777 -R /
ooooo
Don't ever try it
Ik




