#development
1 messages · Page 961 of 1
it needs a ton of Ram
i have 16 😎
i ran into this issue with my bot too. but now ive got a dedicated database server additonal to the server where the bot is running on
woj
How would i check that the user trying to ban another user has permission ban_members?
Member.hasPermission('permission')
thank you
const link = search(args.join(' '), async function (err, res) {
var video = res.videos.slice(0, 1);
const link = video[0].url
return video[0].url;
});
console.log(link)
link seems to be undefined every time
console log video
that;s not the problem
I am going to make a modmail bot but I dont know how to host it and I dont have any money any suggestions?
that gives me the information eneeded
it's called debugging
the problem is returning the variable
What is the best would you say?
and glitch can be a bit spontaneous
you can always host locally
@honest perch what does that mean?
on your own network
oh lmao
glitch isn't even meant for bots
for example with a server, raspi or your pc
websockets to be specific
none of them are meant for bots
you could just host locally out of your editor and keep your computer on 24/7
No.
My parents would be mad.
you'd need excellent internet and a very good pc
I dont have a very good pc.
if u have them two, sure, locally host it
you dont need a very good pc
i run 3 bots and pihole and its doing fine
i mean, when i host my test bot, and my pc is having a heart attack, my bots ping is around 4000ms
otherwise its normal
Its a laptop.
what distro?
if a raspberry pi can handle a bot fine a pc definitely can
What do you mean what distro?
linux distro
?
Idk
ubuntu?
Idk what linux
🤦♂️
nice
Beacuse my grandpa gave me it.
LOL
bruh
how did he set it up
gnu/linux
how even d- im gonna stop lmao
maybe try with neofetch?
@digital ibex Beacuse he got it from the church and gave me it right as he got it
how did he set it up
@honest perch i have a laptop.
do you get a result if you type sudo apt-get
I dont have my laptop rn
Can i just check that this will be a good tutorial
https://www.w3schools.com/nodejs/nodejs_mongodb.asp
for Mongo
i rather use mongoose
w3school is good
you dont need mongoose unless you want schemas
i'll learn mongo first, then learn mongoose
schemas?
schemas
ah a syllogistic figure
Is it possible to put an iframe in a discord embed?
no
no
damn
what do you want to do
embed a yt video
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
this might work
hi! I wanted to know if there’s anything special that I should do if I wanna create a JSON file to read it in a js program. I tried to simply create a .json file and then use smth like jsonFile = require(‘./jsonFile.json’)But it doesn’t work : it says ‘Unexpected token [first letter after { ] at position 2`. Why? If that can help, I use SFTP.
this might work
@mossy vine ill check it out, thx!
btw I don’t think we can embed videos
a video, maybe but not sure about YouTube videos
well I just figured out why it didn’t work. I forgot the quote marks... 😓
for the value names
yeah that was what i suspected
thank you anyway
yeah but if u forget one quote then there goes ur entire document
const {MessageEmbed} = require('discord.js')
const api = require('covid19-api')
module.exports = {
name: "covid",
description: "get covid stats",
execute(client, message, args) {
let country = args.slice(0).join(" ")
try {
let data = api.getReportsByCountries(country)
console.log(data)
} catch(error) {
message.channel.send(error)
}
}
}```(node:11439) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'trim' of undefined
at Object.reportsByCountries (/Users/sadashivappakenchannavar/Desktop/discord.js-v12-youtube-tutorial/node_modules/covid19-api/src/api/api.js:107:73)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Promise.all (index 0)
at async PluginManager.getReportsByCountries (/Users/sadashivappakenchannavar/Desktop/discord.js-v12-youtube-tutorial/node_modules/covid19-api/src/api/PluginManager.js:12:17)
(node:11439) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:11439) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero
when i do !covid USA or something it returns this
thats an error coming from a lib youre using
const tempCases = $('div#maincounter-wrap').eq(0).text().split(':')[1].trim();
nah, lib error
update the library with npm or find a more reliable one
you can try submitting an issue here
and find a different library
you can fetch it urself
or you could just do an https request to the who api
axios?
https.get(url); or smthn like that
what the fuc
what
are you on something?
const apiFetch = (url) => new Promise(resolve => {
https.get(url, res => {
let data = ''
res.on('data', chunk => {
data += chunk
}),
res.on('end', () => {
resolve(JSON.parse(data));
console.log("Successfully connected to api!");
})
})
});```
from frosty?
woah
@hardy vector thats what I use
ah ok
can i install npm packages from replit?
wdym?
just call apiFetch(url) when u need
@willow marlin u developing on repl?
yes
just go to the package manager tab on the left
i cant afford a vps
just use vsc or something
get one from google cloud, they're free for a year
replit is a last resort if you dont have 300mb on ur computer
no cap
use glitch.com
glitch is bad
i used to use glitch
glitch insane
but their host got banned
glitch bad
I just use that for editing
repl it terrible for bot development, I just use it to test out short functions before implementing
yea
vsc is god tier
tru
technically
i dont like vsc personally
i find glitch better
@willow marlin give ur computer specs
use glitch
but repl really doesn't like d.js for some reason
then download the file
or maybe a 1GB for all the extensions
yes and use pm2
pm2 is literally jesus
use ubuntu
oml
or whatever its called
yes pm2 is jesus
lmfao
i have vsc
then why tf are you using replit
replit sucks
Id start using that instead, it's a lot easier and more convenient than repl
that was my first editor
glitch better
same, I used to dick around with c when I was bored at school with repl
that was my first editor
@autumn summit
atom isnt that good
lmao
replit is good for when ur bored at school
it has pretty colours
replit is shit
dude
indeed
chill
atom is good for json and stuff, it sucks for node
its not that bad
who codes with node nowadays?
why do you guys need crazy shit for javascript while i'm just using notepad++
use whatever ide u want, id just highly reccommend vsc
who codes with node nowadays?
@autumn summit a huge percentage of developers
why do you guys need crazy shit for javascript while i'm just using notepad++
real men use notepad so you are real man
I use node 😳
@mossy vine ik but literally every developer I code with uses python
also I'm a web dev so I have lots of background with js
because you code with python devs
Pyrhon is also amazing
who codes with node nowadays?
@autumn summit
people who don't care about performance
first programming language for me
@jagged gulch which corona api do you use
correct
havent touched it in forever tho
To create a database in MongoDB, start by creating a MongoClient object, then specify a connection URL with the correct ip address and the name of the database you want to create.
Wait where do i get a connection URL and ip adress and mongoclient object
@jagged gulch which corona api do you use
@hardy vector I don't. but look on the WHO website for their REST api
@willow marlin connection url is where mongodb is hosted
where do i get one
is it just me or does mongodb go super slow sometimes
for example if you are locally hosting it mongodb://localhost:27017/
ive had times where it took my bot 30 minutes to connect with mongodb
const MongoClient = require('mongodb').MongoClient;
const mongouri = encodeURI(`url`);
const mongoclient = new MongoClient(mongouri, { useNewUrlParser: true, useUnifiedTopology: true });
mongoclient.connect(err => {
const mongocollection = mongoclient.db("test").collection("devices");
console.log(`Connected to mongo DB`);
// perform actions on the collection object
mongoclient.close();
});```
Don't mongodb wrappers set that as default URL if none was given
fricking mongo so hard?
mate what
fuck I thought they had one
i dont understand the first step
mongo is the easiest db youre getting
To create a database in MongoDB, start by creating a MongoClient object, then specify a connection URL with the correct ip address and the name of the database you want to create.
yeah exactly
how do i create a mongoclient obj
watch any yt vid
@hardy vector https://github.com/javieraviles/covidAPI this one seems good
Do anyone know how to check if the bot is over a member while kicking/banning it?
Discord.js.
thats how I did it
NovelCovid is also good.
thanks maddie
they should make a discord.py help channel and a discord.js help channel
no
y
development help channel is good enough
ig
i got banned bc in the php discord lib channel i said who uses php for a discord bot
deserved
lol
i got muted in bfd because i said an admin didnt have a d*ck
it doesnt even support a websocket connection
oof
ok
well
ig i deserved
@jagged gulch the api you linked doesnt have the country flag
but i appreciate you helping
half of the internet is built on wordpress/joomla/some other cms
all of them are built on php
ghost is pretty cool
What is ghost?
I was looking at yearly VPS's and CRAP there expensive, Anyone know any cheap yearly vps's?
ghost is a nodejs cms
hi, i have js function auth(req, res, next) { console.log(req.user); if (req.user) { next(); console.log(`${req.user} is logged in`); } else { res.redirect('/login'); console.log(`user is not loged in`); } } any ideas why it spams next() and causing the browser to error?
it also spams the console
discord oauth2 with expressjs
show next function
next is an express function
wym? its just next()
oh
/dashboard
never used express before honestly
oh shit
im so stupid
thank u like a lot
that didn't make sense but ye, thanks :)
yep, i was checking my app.js file that whole time, what i was doing was redirecting it to /dashboard and if they're already logged in, redirect them to /dashboard again and it'd keep on repeating
does anyone know any good covid api's that include the countries flag as well as the stats
why do you need the flag
because flag = cool i guess
effort
yeah but like you can construct the flag yourself
they do though. i'm using one that provides flag but i forgot what it's called
take the country code and either send the flag emoji or get the flag from the twemoji repo from the appropriate unicode codepoints
why do you need the flag
@earnest phoenix bc makes the embed look cooler
heyy. im currently tring to use bitly's api. I tried this: ```js
if (msg.content.startsWith(PREFIX+'link ')) {
let bitlyKey = switchJSON.bitlyKey;
let linkStr = msg.content.substring(PREFIX.length+5)
let link = encodeURI(linkStr)
if (validURL(link)) {
// console.log(link)
let settings = {
method: 'POST',
headers: {
"Authorization": Bearer ${bitlyKey}
},
body: JSON.stringify({
long_url: link
})
}
fetch('https://api-ssl.bitly.com/v4/shorten', { settings })
.then(res => res.text())
.then(body => console.log(body))
}
}
But I don't understand why body returns :
Method Not Allowed
(using djs)
nope. I'm trying to shorten a URL, so I can't use GET
that wouldn't follow RESTful design, ^
was it even rest
that's what I thought, but this makes no sense
how do I fetch all the member IDs in a server
long_url should not be literally "string" I guess, but smth else
yes of course 😂
you do really are a true genius @tight plinth

H e l 🅱️
yep @proven lantern
uh yeess you're right
thanks 👍
now I got this error 😓 ```
{"message":"INVALID_CONTENT_TYPE_HEADER"}
headers: {
"Authorization": `Bearer ${bitlyKey}`
},
i don't see what's wrong
add a content type header
?
"Content-Type": "application/json"
yeah
you already got the body right by stringifying it
what's that for, i actually never used it haha
well i gotta eat right now then see you later 👋
to declare what your app accepts back
ah i understand
Most likely will return a https://httpstatuses.com/415 if you don't send the correct data accept asks for
HTTP Status Code 415: The origin server is refusing to service the request because the payload is in a format not supported by this method on the target resource.
Ok stack underflow
what
what language
Client options
Discord.js
you can use members.fetch() if you really need all of them, otherwise just use the cache
Ok but how to ID
oh god
Learn it
sorry man
then how did you make a bot
Please
No
Not enough apparently
well clearly it's not
If you don't know how to use a map u don't
Is it possible to migrate MySQL db whilst saving character set collation so that when I reupload SQL table into the new db the current character wont become corrupted
And if yes, how to do it
What is your new db
Lol
I just wanna switch servers
Erm
did you try exporting it and see if it saved the collation?
No because I'm not making new tables
I can make it so like
I export, import it, (at this point after.import it becomes ?), Then use SQL statement to change the character encoding
hey that's mean i use MySQL too
But then it already became ?
and use postgres
MYSQL has legit no benefits over postgres
Postgres is just Faster in general, Better data types, open source for even more data types, and has native roll back
I had one when I chose between MySQL and postgres
Which was bigger than other positives
Hence I use MySQL
Just trying o figure this out
👏 Dont 👏 use 👏 mySQL 👏 smh
don't judge me
Tysm
mariadb
might as well use Postgres
better mysql
might as well use Postgres
True
i just dont like postgres
Why
i've never tried Postgres
the sql is slightly different
i'm too used to MySQL
yea no
Oh yeah
i use sqlite anyway
i mean if it ain't broke don't fix it

Or you can make a new db and use smth like a windows myslq db editor to manually copy paste the current db data, but it's annoying to do
Had some difficulty getting used to it when using postgres
it works up to 1tb 
But it's understandable
postgres easyyyyyy
I use Mongo😳
arrays
All i do when im doing postgres is make a load of functions
and send that to the DB on start

mongo setup was more complex than postgres
I just docker everything
so for me either way its just an image
and some env vars
if i need to connect to postgres its just db in the connection string and tell docker to link
Can I verify my bot even if it's ony in let's say 10 guilds?
with discord no
only 75 or more?
you need to get at least 75
yes
But they take soo freaking long to verify bots
and then while not verified the bot cannot join more guilds than 100
it can for now
for now
but once they fully implement it in october, then they'll limit u
implement what sry?
nice try xD
ok so
I saw your site
Everything is really cool and all, but how are you thinking of maintaining a bot without getting people to pay for it, being open source too
If you can make that, you are a god
donations and stuff, also opt-in ads
people wont understand what to do with source code
and Ive got enough cash to run it atm so I'm donating all current proceeds to the BLM movement to try and make an impact
people wont understand what to do with source code
some do though
and Ive got enough cash to run it atm so I'm donating all current proceeds to the BLM movement to try and make an impact
@jagged gulch noice
yeah, Im worried imma spawn a shit tonne of crappy clones of my bot
did you just bring that up
and my twitter aboutta get bombed with why unhandled promise rejection pls teach js
yeah, Im worried imma spawn a shit tonne of crappy clones of my bot
I'm worried that you'll need to spend a lot of money on hosting it, that's why I asked
then some will fork the bot or something. chances are they wouldnt pay anyways and even fi they would youre only losing out on a very small amount for the greater good of open sourcing code that people can learn from
yeah, this is both a learning experience for me and others
I'm worried that you'll need to spend a lot of money on hosting it, that's why I asked
@opaque seal I'm only paying for hosting for my own bot, and google gave me a free vps for the year so yeah
they're doing a free trial rn with 300 dollars worth of cloud credits
wheaaat
Can I get that too? Where can I look that up?
@slender thistle
Ive been trying to learn mongo but it hurts my head
it's not that hard once you get the hang of it
yeah im working on that
also
@opaque seal https://cloud.google.com/
no thats when it gets worse. when you somewhat understand what youre doing but need to do more complicated queries
fuck
but for the most part you wont need to
and even if you do, google is your best friend
There has to be a downsight with this google thing
WHo the heck gives away 300 dollars like that
its google, they can afford shit like that
pretty obvious since it's a VPS
you've gotta manage the VPS urself, its not like heroku
I'm using Vultr rn
Think it's the same
never heard of that but prolly
np mate
how long does the google cloud trial thing last for btw
1 year
12 mnth
cool
huh okay
thats like
It's a pretty long time
300/12 bucks per month
it also gives u access to the WHOLE suite, that includes firebase hosting for static sites
300/12 bucks per month
many bucks let's sat xd
i can't math
databases is where i start double taking everyth8ng
Im tryna build persistent cloud data for my bot, I'm debating whether i should use mongo or just fs with some json files on my vps
guess i'll just
mongo
Im tryna build persistent cloud data for my bot, I'm debating whether i should use mongo or just fs with some json files on my vps
no json please
yeah
idk it confuses me
I use that with js too
im dumb
what confuses you?
ive never done database work before, so I'm learning how mongo handles pushing and retrieving data
what confuses you?
?
what you meannn xd
mongo be like
save shit? .insertOne
find shit? .findOne
mainly the syntax
heres my totally epic take on mongo vs sql dbs
man i can write javascript instead of selling my soul and a kidney to satan and writing some broken english
It's like await client.yourdatabase.findOne(whichvalue: value, error, results =>
i need to store big arrays and stuff tho
it's prettyu much just asking for that and saving data
can it handle that?
it absolutely can
in like 2 lines of code
damn
Yeah
this is why you don't try to learn a db when ur hella sleep deprived lol
thats when I kinda gave up lol
Have you tried setting it up?
I have a cluster, kinda got it set up but when I pushed a test collection i didn't see anything
If you send the code we can take a look at it
const MongoClient = require('mongodb').MongoClient;
const mongouri = encodeURI(`mongodb+srv://<user>:${passwd}@cluster`);
const mongoclient = new MongoClient(mongouri, { useNewUrlParser: true, useUnifiedTopology: true });
mongoclient.connect(err => {
const mongocollection = mongoclient.db("test").collection("devices");
console.log(`Connected to mongo DB`);
// perform actions on the collection object
mongoclient.close();
});```
const mongocollection = mongoclient.db("test").collection("devices");
I've personally never done it like that
don't know if it works
literally just copy pasted it from the cluster setup site lmao
I'll send you mine
cheers
I have no idea why but all of a sudden I'm getting this error and my bot is crashing after a few hours https://srcb.in/73d2b44e33
so just redownload node? or how lol
npm update discord.js or smth like that for djs
this is also the only bot that is doing this...
for node I don't remember :/
node update should also do the trick for node
are you hosting them all together
yes
I also got an issue 😅 (it's about the bitly API as you may have read before) : I got this code that uses bitly's API with node-fetch to shorten a link : ```js
let bitlyKey = switchJSON.bitlyKey;
let linkStr = msg.content.substring(PREFIX.length+5)
let link = encodeURI(linkStr)
if (validURL(link)) {
let settings = {
method: 'POST',
headers: {
"Content-Type": "application/json",
"Authorization": Bearer ${bitlyKey}
},
body: JSON.stringify({
long_url: link
})
}
fetch('https://api-ssl.bitly.com/v4/shorten', settings )
.then(res => res.text())
.then(body => console.log(body))
}
But the response keeps being ```
{"message":"FORBIDDEN"}
Any idea of why and how to fix it?
you don't have access to that endpoint
Yes, got it, it's litterally written in the error. But this makes no sense : this is available to everyone, and it cannot be the ratelimit. Can this be because I'm not logged in? Because I haven't found any UNAUTHORIZED error response in their docs
can FORBIDDEN replace UNAUTHORIZED?
pff i'm lost
They are different error codes so I don't think so
yes
forbidden means you dont have the permission to do that
but it's up to the devs
i know what forbidden means, it means i'm logged in and i'm not permitted to do that, and I know the difference with the 401 code. But this is really weird, since this is a public feature. I'll read their docs again.
yeah do that, you might've made a bad endpoint request or smthn
it doesn't look like i've used a wrong endpoint, the endpoint isn't premium-only, and their docs about it are pretty short...
just to be sure: if someone uses bitly's API here : for the Authorization, is that the client secret I need to put? Is this the 'token' ?```js
"Authorization": "Bearer "+token
i think its access token
I only got the client id and the client secret
I found it!
It's a very weird way to use the API. The token is to use a user's account trough the bot. I don't think it has been made for bots, maybe for applications or interfaces or something.
or use a better api
let banEmbed = new Discord.MessageEmbed()
.setDescription("**Unmute**")
.setColor("#ff9900")
.addField("Muted User", `${tomute}`)
.addField("Muted User ID", `${tomute.id}`)
.addField("Mod", `<@${message.author.id}>`)
.addField("Mod ID", `${message.author.id}`)
.addField("Muted on", `${message.channel}`)
.addField("Duration", `${ms(ms(mutetime))}`) //here
.addField("Reason", mReason)
.addField("Date", `${message.createdAt}`);
code for ${ms(ms(mutetime))}?
also can you log ${ms(ms(mutetime))} to see if it actually has a value
where can i get help for coding stuff
you might be asking in the right place
where is the right place
here
ah ok
Everytime i try to run my main.py i get this fail message:
This are my Codes:
https://oliy.is-just-a.dev/8kq13_4144.png if there was only some sort of documentation you could use
you don't know how to create a ping command
well okay, check the docs they should have an example
What actually happens if my bot causes my system to reach 100% memory usage?
Does it just die? 🤔
you can check on google
im not sure because it hasn't happened to me, but i assume if you use something like pm2 it would auto restart
how can i get the a users username only from their id? so like, i've only got their id and how can i get their usernme
using eris
I do indeed use pm2, so if it just restarts that's fine ig ^^
Lost, you can probably get it from the cache or just fetch the whole member
oh, sorry, my bad. not using eris, only expressjs
any ideas about this? it's only doing it on one bot. Just started doing it 2 days ago and will crash after a while every time I restart it https://srcb.in/73d2b44e33
@true ravine you likely have a problem if ur bot maxes out ur memory
How much ram do u have?
in how many servers is the bot?
I run a music bot and it rarely goes over 70mbs of ram

Although it isn’t in many guilds atm
I'm in 560 guilds with around 80k users
What kinda bot is it
It's a delivery bot, so nothing actually intensive
Wym by delivery bot?
You order food and it sends you a picture of the food
I think he means some kind of mailing system
O damn
lol
pictures can be resource intensive depending on how you process them. 1gb of ram seems low for 560 guilds.
There’s gotta b something up with your code then, optimize maybe? If it’s just simple command, then dm then that shouldn’t be that intensive
But yeah u might need more ram for that many guilds
Does someone here know if you can host a discord bot on a server with only ipv6 address?
There’s gotta b something up with your code then, optimize maybe? If it’s just simple command, then dm then that shouldn’t be that intensive
@jagged gulch My bot is the first js I've ever written (properly - excluding online tutorials) so my code is probably trash
RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number.
@earnest phoenix you gave an invalid bitfield
you probably did a permission check
and you misspelled the permission's name to check
MANAGE_ROLES_OR_PERMISSIONS
Fixed
Thanks
@jagged gulch My bot is the first js I've ever written (properly - excluding online tutorials) so my code is probably trash
@true ravine that’s how I started off too. Best thing to do is go back to ur code and slim stuff down, or get more ram if u can
I’d use google vps cause they have a really good free trial, 12 months and 300 dollars worth of credits
Np
guys why is my bot making 3 of the same message when i only entered the command once?
code?
can you post the code?
the part that sends the message 3 times
if it only sends once in the code they probably made the mistake I used to make all the time and ran 3 instances of the bot
hopefully without token
does it happen for all the commands, or just one of them?
all of them
Then it is probably as nwunder says, you started the bot more then once.
if it only sends once in the code they probably made the mistake I used to make all the time and ran 3 instances of the bot
where do you run the bot? Home pc or vps?
i run it on a vm linux
type that in the console. If you changed the process name of your bot to something other then 'python', use that instead
or pkill -9 -f path/to/my_script.py
can you explain how to make premium for a bot? and what needs to be added to the database
sorry
its just that i use an online coding platform
cuz i don't have the rescources to host the bot
its called repl.it
I don't know how that host works. srry
It's not even meant to be a host
its just that i don't have the resources
ya have to keep a computer running
so i didn't do that
you can get a vps for as low as 2$ a month.
i make $0/month
i'm like 12
i can't just run a computer
and i make no money
and this is free
yikes
glitch.com is a decent free host, but it only works for js. I don't know any good ones for py
ok
hi, so
i have https://discordapp.com/users/475371795185139712/, how can i get my username from that using javascript
@dusk pendant You can take a look here https://support.glitch.com/t/how-to-use-python-on-glitch/11201/4
its okay
repl.it doesnt cause that issue by itself
whatever issue is causing it will also be present in any other host
the issue is most likely in the code
take a look in his code then, I didn't find anything
you want to get a user object directly from the api?
yeah
I suggest using a discord library like discord.py or discord.js
its the only way i can get it
you need to make a GET request with any http library
and put your token in the authorization header
what token would it be?
you need to make a GET request with any http library
yes, but then it's one command and the library handles the rest
like the bots token
oki, thank u
you can test it with reqbin
If ur doing oauth you can use the access token and get the profile over other ways
im confused
are you doing oauth?
so for example
a user goes to you website, and you want them to login with discord
then get their username?
yeah. i've got the login bit sorted out, but all im storing in the db is the users id and other stuff, they're not unique tho
once they login, you get their access token
you use this token instead of your bot's token to get their info from the api
using the me endpoint
send http requests?
i haven't really worked with api's, and when i do use them, i just do ```js
const something = await fetch('api url');
const thing = something.thing;
what would the url be?
i need help with my ban command
it bans people and wokr'sbut
works
but
it can ban someone that has a higher role than the person who is rying to ban
yk what i mean??
is http just a set of instructions on how to send data through a tcp socket
any python coder which could help me with my bot
Is there a way to implement a logical or on a case (discord.js)
if you need help with something you can just ask here
@pure lion a || b
Tried
logical or is literally ||
I did
case 'a' || 'b':
can anybdy help me??
where is the error?
O shirt
switch (shit) {
case 'a':
case 'b':
console.log('cool shit')
break
}```
Ohhhhhhhhh
@pearl igloo Where @property async def is
thats the script
it can ban people higher role than the banning user
ok
@pearl igloo Where
@property async defis
@slender thistle
Show me your on_message function
How do i see what platform is user is useing such as mobile, pc, web
:readthedocs:
how do i make an automatic response command by javascript?
@dark steeple here
msg.channel.send("Sorry")
}```
If i do no
It would respond sorry
thx
str.replace(/*/gi, 'remove bold text');
any solutions to replace * ?
yes
escape the asterisk
you replace *
"SyntaxError: Invalid regular expression: /*/: Nothing to repeat"
lmao
You didnt escape it
- in regex is a quantifier
You need to escape it to actually match a *
but
it doesn't work
I mean I use a function to replace it
cleanBio (text) {
return typeof text === 'string' ? text.replace(/`/g, String.fromCharCode(8203)).replace(/@/g, String.fromCharCode(8203)).replace(/\*\*/, String.fromCharCode(8203)) : text;
}
How can i make that if anyone write in a chat, a message that it shows the message in my terminal with the users name in python with discord.py?
How can i get a developer role
I run my bot and it works without any problems. It responds to the commands I sent without any problems but after 6 minutes, the bot stops responding to commands and closes it to the console.
In addition, I run the same files in different bots and the bot has been running for 15 hours now.
@shy light happened to me might be something else thar happened idk
Just ignore it, happened to me today but nothing bad happened. Not even duplicate messages.
how can i update my coins that i aleardy had in my database
I think it is like the bot decided ro shutdown then restart again
@twilit prairie wdym
like my coins i have is 100 i want to update my coins
I don't get it but ok.
Who now, how i can make a coin system?
Using a database
I have a question. How could my bot create a channel that updates his name in an intervall. And how could I get this channel everytime my bot is ready ? Please tag for help :) Thank u
@shy turret, I couldn't understand anything
Are you running 2 bots on 1 process?
does anyone know how i can make a coin system?
@shy turret, yes
yay
Then you can get the coin, possibly parseFloat() then add etc
@pearl igloo using a database
@shy turret wym?
A database
where can i find it?
but how?
Could there be anything from discor?
@shy light might be something in the code
If you use try catch and dont catch the error, you might want to catch the error if there is any
@shy turret, I am running a different bot with the same files but I did not get a problem bot has been open for 17 hours now.
Different process?
Well, it might have been a one time error or mistake your computer or node made
Maybe due to overuse of ram or cpu
@shy turret Could it be because of too many pings, sometimes the bot sees 10k pings.
@digital ibex, let me try it
@shy turret ?
How could i get a spefic voicechannel by name on every server my bot is on ?
can someone helpme (discord.js) i am big noob and bery bery tired plej help
case 'presence':
let uwu = msg.author.presence.activities.find(Activity => Activity.name)
let state = msg.author.presence.activities.find(Activity => Activity.state)
let type = msg.author.presence.activities.find(Activity => Activity.type)
if (type != 'CUSTOM_STATUS') {
msg.channel.send(`${msg.author.username} is currently doing stuff in ${uwu}`)
} else if (type = 'CUSTOM_STATUS') {
msg.channel.send(`${msg.author.username}'s status is ${state.toString()}`)
}
break;
its not working properly if someone has a custom status
how can I do a gif in a embed with discord.js
.setImage
.setImage("GIF_URL")
anyone can help whit this https://gyazo.com/e4dde8369d653c4a0cafbaae6eead57b?token=466a11deff2305f128f18fd62a56ad97
Send a sourcebin
Of the code
Lets me explain first
Actually
Do you have ffmpeg as an environment variable
yes
when my bot i playing a song and i use disconnect from discord not like a command
Yh
then when i do play it dosent connect again but it adds it to the queue
if i do # skip it crashes
and give me this
Destroy the queue when it disconnects
i will try that
soo how do i do that 😄
Well I can't spoonfeed
¯\_(ツ)_/¯
I use Lavalink and Erela.js, I recommend that
i use discord.js
this is the play
How do i see the amount of members on a guild?
^
Just .memberCount?
No
Soo?
Bruh i asked for help not for just a .memberCount
?
Is there anyway to make this code instead of sending messages with the next number it edits the current message?https://hatebin.com/jclpcrgyos
.edit
Bruh i asked for help not for just a .memberCount
@cosmic girder also what else would you be using instead of .memberCount
how I can a random gif do in a embed?
@earnest phoenix i understand that but i asked for HELP, i got a message with a cmd ive never seend
Its not spoon feeding its explaining
How do i see the amount of members on a guild?
That was your help
.memberCount
Yh exactly
Ik thats why i asked whats aprt of itt
Yh learn the basics
Nah dip The One And Only Sherlock ik the basics is it bad tht im asking for help
sorry I'm kinda dumb, I know that one of the ways to edit a message is using this .then(msg => { msg.edit but how can I trigger it without the ".then"?
You defo don't know the basics
yeah
If you can't find out what is before .memberCount
Uh i really do tho now answer my question is it bad that im asking for help
sorry I'm kinda dumb, I know that one of the ways to edit a message is using this .then(msg => { msg.edit but how can I trigger it
without the ".then"?
I really don't know how
BUT HOW
Mihz happy one year older day
JDSADSA
Define msg first
I did.
Smh


