#development
1 messages · Page 716 of 1
@sage bobcat and all he has is a phone
One message removed from a suspended account.
code:
app.get("/f/:image", function(req, res){
res.sendFile("/app/uploads/"+req.params.image)
})
url:
http://bot.wearebounce.net/f/eDwGhm6d.png
Why is the url not embeding the image on discord?
Discord only embeds ssl secured sites now iirc
i have a question, how can you make if someone doesn't have a role it will send an error, and if the user has a role it will send the correct message? (i use js)
yes ok, I am the dumb idiot that forgot to add the s after http on the sharex config
@celest spear what lib
js
How do I finish the bot?
One message removed from a suspended account.
bruh
while(operator != 'q'){
printf("\ninput an operator and a number(optional): ");
scan_data(&operator, &operand);
if(operator != 'q'){
do_NextOp(operator, operand, &accumulator);
printf("Result so far is: %lf\n", accumulator);
}
else
printf("Final result is: %lf\n", accumulator);
}
return 0;
should i use a while(0) and a break instead ?
if (operator == 'q')
break;
in other words, is there a prettier way to essentially do this
while(!done)
{
check(done);
if(!done)
do_stuff();
else
do_other_stuff();
}
to avoid checking "!done" twice ?
if the user or bot says it?
@eternal topaz What do you mean "finish the bot"?
if the bot is saying it twice use if message.author.bot
What does command is not defined mean?
command is not defined
then it doesn't know what command means lol
Exactly as it says
try console logging it
It'll say undefined if it is undefined
@dusky marsh if the command isn't defined then simple
you haven't either defined it or used module.exports (if you use a command handler)
does anyone know how to do webscraping with a bot? Like, if I (as admin perm) type a link in a command, I want it to pull data from the html of that site.
Which library do you use?
discord.js
i need help about the review of my bot
I used to do that with my bot
I don't anymore, but cheerio is helpful for that
the npm module
does anyone know how to do webscraping with a bot? Like, if I (as admin perm) type a link in a command, I want it to pull data from the html of that site.
quite literally make a GET request to the website
around 2000 guilds
By 2500 guilds I'm pretty sure you can't login with your discord bot's token
how do we get the Bot Developer role?
"You do not need to worry about sharding until your bot hits around 2,400 guilds. YOU MUST SHARD before you hit 2,500 guilds, however." - discord.js an idiots guide
I think you get one when you have your bot verified on top.gg @earnest phoenix
ty
This should work as passing a authorization for http requests right?
Idk if anyone else uses AWS but if anyone does any help with this would be great 
@earnest phoenix you get the developer role when you have a bot that is approved
okay thanks
how do i create a message embed in jda? i'm more familiar with js and ik {} is an array initializer but how is it done lulw
you can make a bot in js if you are more familiar with that
in java you create an array with []
new String[5]
"You do not need to worry about sharding until your bot hits around 2,400 guilds. YOU MUST SHARD before you hit 2,500 guilds, however." - discord.js an idiots guide
you should shard at around 2000 because realistically looking you're going to have a huge influx of guilds if you're at that amount
discord recommends sharding at 1500
when you get to 2400 without sharding it is time to worry a lot
I got HTTP auth working. Don't pay attention to my question.
@valid frigate use EmbedBuilder
How would i append a new value to a json variable in python?
eg:
start: key:["1",2"]
end: key:["1","2","3"]
Ive been trying, and i would get it like key:"["1","2"],"3"]
Like lets's say i wanted to add a authorization key to something. I already have a pre-set one, and i want to add a new one to it.
data = json.load(jsonFile)
tmp = data["key"]
data["key"] = tmp.append("3")```
that should work?
lemme try
though i tried append before and it was giving me a NoneType for the json variable
and without the dict it would be the same
wait
am i dumb
ok ok so basically
i want to send a message & an embed to go with it in jda but don't see any methods that allow that
within the same message™
text="a" embed=embed
ez
at least for py
you can send a embed and a text message at the same time i believe
neko... try check if old is a NoneType before appending cause that may be the issue
i would think it is .sendMessage(String messagecontent, MessageEmbed embed) but apparently not
not sure why the old would do that but ye..
I don't think a json variable would count as a NoneType
do i have to str() it or dict() it?
<class 'NoneType'>
welp
it seems old is a nonetype
Does anybody know why bot.nickname remains null even after setting its nickname?
using discord.js btw
Because it's trying to get the nickname of the bot in the user itself.
it needs to be in the server
like
hmm
id is the guild id
ok
dont know why it remains null
@lament meteor if i make it list() it gets split into each character.
dict() returns the same error (NoneType)
and str doesn't have a append option
wait
insert() hmm
oh
i figured out my dumb mistake
old is a string-like variable
data["a"] is the one i want to use
You all know im dumb sometimes
or not, same error after using data["a"]
startarg = serverprefix + 'edit'
args = message.content.slice(startarg.length).split(' ');
why is args[0] nothing?
@shy turret you didn't add any commandline arguements
Oh wait is this python?
Nvm lol i can't really help there >-<
what does the whole array return
(got help from the discord api server i fixed it)
What was the issue?
@shy turret you should uh use
\ +\
the way how you are getting arguments aren't too much stable
@cunning goblet i already fixed it
make sure your bot follows the rules so it gets accepted on the first attempt https://canary.discordapp.com/channels/264445053596991498/280067058417401856/393847758865301507
also next time i suggest you ask dbl related questions in #general
What’s the best way to redirect back to custom url after the user has logged in through discord? The url looks like https://customurlhere.com/appeal?key=74627483
Any ideas? I was think about headers but not sure if that’s the best way to do it.
@sudden geyser Sorry for the ping, just wanted to thank you for the help, though .find() didnt work it led me to instead using a more sensible way of just catching the new channel with client.on(channelcreated) either way you helped me a lot
no problem (although I forgot about this message)
I need help, currently I am running a bot in node/discord.js and I am looking into setting up PayPal webhooks in the bot but this guide is helpful but confusing at the same time https://developer.paypal.com/docs/api/quickstart/create-webhook/#
Any help is appreciated
this looks rather straightforward, can you elaborate on where you're confused
to be clear, those docs explain the flow for using paypal's api module which you can probably just grab off npm to create an outgoing webhook, so paypal will send a request to the URL you provide, that means you'll need to set up an express server or some equivalent to receive that request
so for example the url they have in example one what would that be changed with or does it remain the same
you want it to go to your bot so you're gonna need an express server on the bot
Okay
Thanks 😁
@peak bloom essentially what I want it to do is something like this where when someone donates/pays me through PayPal tho bot will post in a channel of my choice user has donated $123
So I'm honestly not even sure if this is the right guide for what I am trying to do
Discord webhooks accept data payload different from usual ones
Not sure if PayPal supports Discord webhooks 
I'm not sure either
you would need to host a webserver to handle that and send requests to Discord webhook yourself
Alright I'll do that then, thanks for your guys's help

this question requires an opinion, but would this be a decent way to set up a base command class for a command in jda? i was thinking about combining the name and description parameters into one class, but need advice on structuring
// unimportant packages lul
package cc.vysion.jdabot.main.commands;
import net.dv8tion.jda.api.JDA;
public class Command {
protected String name;
protected String description;
protected JDA jda;
protected CommandContext commandContext;
Command(String name, String description, JDA jda, CommandContext commandContext) {
this.name = name;
this.description = description;
this.jda = jda;
this.commandContext = commandContext;
}
protected void run() {
this.commandContext.message.getChannel().sendMessage(String.format("The command `%s` is not set up!", this.name)).queue();
}
}
would ping august but hes asleep
lul
oh yeah and run() can be overridden so that too
how to get message content by message id
@cerulean salmon can you provide a little more info on what you're trying to do. like a code snippet or something, to understand the question better
Somebody van help me to create a webbiild
don't have a van sorry
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Somebody can help me to make a webbuild
probably not
is message.member.id and message.author.id the same ?
One message removed from a suspended account.
I use it to get the ID of a user that wrote a message on a server
but it spits out errors on DMs and for DMs I read to use author
But it seems author seems to work in servers too, at least what google says
they are both the same yes
okay, yeah author is better to use, as it allows dm and server
you only need to use member if you're going to do operations on the member object, like manage roles, nicknames, kick/ban, etc
ah nice, thanks
any1 hosting on repl ?
@earnest phoenix repl, glitch, and heroku were never meant for good bot hosting
but they work
People say communism works too, doesn't mean its healthy @earnest phoenix
they arent't meant to work
lmao
(for bots)
you're actively going against those services' TOS if you host a discord bot and keep it up by pinging the webserver
what other free alternatives are there ?
self-hosting
don't trust my internet to reliably host a bot
find some free money
and get a vps
is digital ocean a vps
think they offer free credits through github student pack
hmm
which one of these should i use ? https://education.github.com/pack
aws ?
if heroku, glitch and repl aren't meant for bot hosting, then why is the vps setup the longest and most difficult one https://www.writebots.com/discord-bot-hosting/
a glitch moderator technically promoted usage of uptimerobot
don't blame your incompetence on it being difficult
also on that website it still says vps is recommended lmao
hosting a bot is equivalent of downloading a program and running it
linux is more common in hosting
so a lot of people use linux distros for their bots
which doesn't even require you to have some knowledge with linux already, just common sense
also
i love how uh
uptimerobot was against the glitch tos
but
a moderator literally promoted usage of it
in the shitty discord-botkit tutorial
i love how almost all bot tutorials encourage running a debug version of your bot in prod
don't blame your incompetence on it being difficult what kind of logic is that
seems like solid logic to me
a vps isnt that hard to set up
it is relative to other hosting solutions
npm install --save discord.js
node index.js```
and you are running a simple bot on a new linux vps in less than 2 minutes
setting up a bot on a vps doesn't take 2 minutes
what the guy above just said takes 2 minutes
setting up a bot on a vps doesn't take 2 minutes
it takes one 🙃
thats assuming you have more than 63 brain cells
that's rude
just calling ppl stupid for thinking setting up a vps is difficult compared to other hosting services
it was a joke
because some people are used to everything being setup for them (like you)
and not helpful
most people get scared when they need to input commands in a console
so linux is scary
linux is only scary if you are scared to learn it brain tap
rm -rf / is scary indeed
thats the scariest command
is it a bad thing that stuff is streamlined and user friendly through ui's ?
yes
you're not a baby
"haha buttons 🤤 "
dark console with white text 😱
dark console with dark text ❤
black
there's no errors if you can't see them
cant argue with that logic
do you guys berate ppl every time they don't program their bots in assembly either ?
yes
yeah
send voltage signals to your cpu like a real programmer does it
we also use keyboard with only 2 buttons, a 0 and a 1
why go out of your way to have consoles if the same can be achieved with buttons and an ui that's more userfriendly and not as intimidating for ppl just getting into bot programming
consoles are more powerful and easier to make than an entire ui
text > ui
there are drag and drop programming languages, they are just not very flexible
and i dont think there are discord libraries for those languages
scratch is a great site
lol
tons of kids learn to program through it
scratch isnt really programming
why not
its a good way to learn how programs work
its technical lego blocks on a computer
i think it's a great tool to teach ppl programming and the logic behind it
it teaches about the logic behind programs, but it isnt very flexible
think of it like painting
UIs are equal to secondary/tertiary colors while full access consoles are equal to primary colors.
you can mix primaries to get any other sublevel, but no matter what you do you cannot get primary colors from another iteration (secondary/tertiary)
so after using that its time to step up to something else
cry has the biggest brain
scratch is a code generator
but a lot of the time you don't need all of the features that requires a console or w/e
with a canvas for a preview
but a lot of the time you don't need all of the features that requires a console or w/e
other way around
UIs are more bloated than consoles
as they wrap the console around
discord bots in scratch are possible (through extensions) but you won't ever learn anything
expect how to drop a block and connect more to it
from a resource perspective sure
github desktop is less powerful than git on the command line
making it more heavy
and useless in the long run
discord will you send my message
but not from the perspective of user experience
one is easier to understand sure, but it doesnt have all the features of git
making it more heavy
half of the shit that has a gui in linux
you don't always need all of the features
Is it my net or is Discord's api lagging?
especially for beginners
emits command line stuff
in the background
@grizzled jackal discord api is lagging
@earnest phoenix if your a beginner then heres my first suggestion
- don't trust tutorials
and second
make other stuff first
you don't always need all of the features
yes, sure, but that's not a counterargument as to why UIs are absolutely trash
alot of UIs use api/command line utilites
why hasn't windows made a ui version of their command line????
How to display API ping?
start a stopwatch/timer, send a message to discord, wait for it to get back to you, stop the stopwatch/timer and you have the ping
it's how you measure REST ping
comparing message timestamps is not accurate
you don't always need all of the features
i still don't see this as a counterargument
also zerp: if you used the command line, alot of more features could be accessed
which could help you do certain things
Thanks discord
you're going to be working with CLIs sooner or later, would it be at home or at a job, if it's at a job and it's your first time you're going to regret you went around clicking buttons instead of making it yourself and possibly making it more performant than the thing you were originally going to use
Well, sending images is fine
Me 2
at the worst pinging my bot took 1+ minute
when kids are taught to learn how to ride a bike aren't they usually given training wheels and guidance ?
those two are not comparable
Some people can't connect to discord
you can't break your bones from working in a console
You can
as another note, that argument is completely invalid as there are a ton of resources and documentation online which offer introduction to linux envs
aren't the majority of tutorials on discord bot hosting
focused around glitch, repl and heroku ?
how is that relevant to what i just said lmao
those places are also bad to host on, but its good for training
zerp, exactly what you just said is because of influx tech illiterate people doing programming when they shouldn't
which in the end promotes very bad practice just for dumb people to have it their way
imo that's just gatekeeping
if you don't think ppl should be programming
My bot use glitch (because free vps sucks) and it works fine
First 500 people will get 2 months of Skillshare free: https://skl.sh/polymatter4 Patreon: https://patreon.com/polymatter Twitter: https://twitter.com/polyma...
how isn't that just straight up gatekeeping
watch the video looool
why don't you sum it up for me instead
the fun in programming is getting to resolve logical problems your way, if you can't logically resolve problems quickly or just can't do logical thinking, it is not fit for you
same as medical practice isn't for everyone
i'm not asking you to read any articles or watch videos that supports my stance
i told you to watch the video because it explains the point i'm trying to get across without typing out a novel
if you're not letting people learn, no one is fit for anything
"Im not asking you to show me anything that doesnt agree with what I say, but vaccinating is bad"
not everyone should be a programmer, just like not everyone should be a doctor
if anybody wants to be a programmer or a doctor they should have the resources to learn how to
they do
sure, they have the resources
you keep ignoring the fact that it's just not fit for everyone
and when kids learn to bike they sometimes need training wheels to make the process easier
same like singing, someone might want to be a singer and a performer but simply can't be such because of sheer sound of their voice
yeah but singing can be taught just like logical thinking to a certain degree. you wont be an expert, but wont be the worst either
true
true
you'll know techniques but some people don't have a voice fit for singing alone
same is applied to literally any other skill
You dont become a good programmer from using drag and drop programming languages,
Just like a doctor won't be good from playing the board game Operation
does that mean ppl shouldn't pursue physics because they wont surpass Einstein
where did i mention you have to sound like whitney houston to be a good singer, that's not a point anyone here said
i feel like most beginners jump into programming with the wrong mindset
drag and drop programming is a tool to introduce ppl to programming same as the game Operation might ignite a spark in kids to be interested in medicine
I agree that its a tool to introduce people, but after that its time to move on to more difficult things
and with that usually comes linux and consoles
drag and drop is a toy
but who are any of us to say when that time is
it's meant to be fun to toy around with
it can be appealing to anyone
its a fun toy to play around with, but dont expect to make a discord bot with it
certain people simply won't be able to see a problem and come up with a solution on the spot and write it
cough, dbm
pretty much lol
doesn't mean they should quit pursuing programming, as cyber said logical thinking can be taught along many other skills
I just looked at BDM and it looks very basic and doesnt have much options
as long as people who use it know the limitations it works
I can agree with Zerp when it comes to an extend of doing it as a hobby but not when it comes in terms of professionally doing it as a job
TypeError: Cannot read property 'send' of undefined
at got.then.response (/app/c/meme.js:17:25)
const Discord = require('discord.js');
module.exports.run = async (message) => {
const embed = new Discord.RichEmbed();
got('https://www.reddit.com/r/dankmemes/random/.json').then(response => {
let content = JSON.parse(response.body);
let permalink = content[0].data.children[0].data.permalink;
let memeUrl = `https://reddit.com${permalink}`;
let memeImage = content[0].data.children[0].data.url;
let memeTitle = content[0].data.children[0].data.title;
let memeUpvotes = content[0].data.children[0].data.ups;
let memeDownvotes = content[0].data.children[0].data.downs;
let memeNumComments = content[0].data.children[0].data.num_comments;
embed.addField(`${memeTitle}`, `[View thread](${memeUrl})`);
embed.setImage(memeImage);
embed.setFooter(`👍 ${memeUpvotes} 👎 ${memeDownvotes} 💬 ${memeNumComments}`);
message.channel.send(embed)
.then(sent => console.log(`Sent a reply to ${sent.author.username}`))
console.log('Bot responded with: ' + memeImage);
}).catch(console.error);
}
module.exports.help = {
name: "memes",
aliases: []
}```
help
what is up with you people using then in an async method
discord.js
I am doing a show-avatar function and want to send the avatar as file instead of a link, to make it look better. But when the user has a non-animated avatar, the file gets send as 72c691b5eb0ce0b48f4d0a01186fff5e.pngsize2048 something like this. Can I prevent this size2048 part ?
I am using a simple: message.channel.send({files: [taggedUser.avatarURL]});
simply... don't download the file
i don't get why you need to download it
put it in an embed if you don't want to send a link
k thx
who can help me with digitalocean
first you should say what your problem is
idk how to host bot
with it
i alr bought
which language are you using
bitvise said that password wrong
right
pyhon
have you set up ssh
yup
no
lol
yesn't I guess
when i try go in bitvise it says
that my password or username incorect
follow this article https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys-on-ubuntu-1604
tried
bruh
to generate keys on windows you can use putty
another article https://www.digitalocean.com/docs/droplets/how-to/add-ssh-keys/
tried
it says that my password or name incorrect
in digitalocean i changed
its ok
but bitvise says incorrect
logins to websites are NOT your root logins (if the hoster doesn't suck balls)
he probably didn't even read the mails he got after buying the server
TimeWind, maybe your login or password is wrong
maybe could you help how to run it
haha
@fickle anvil
srrrrrrrrrrrr
is that signs of a self bot I see
@fickle anvil
no
sorry for the ping
TimeWind, there are good tutorials online on how to use digital ocean
read the mails you got, read the linked tutorials. they tell you the core of what you need to know. There is nothing we can help you more
and before running a bot, learn how to use a server. If you already fail on reading a simple mail, running a server is NOT something you should do. Servers are highly complicated structures and if you misconfigure it, it can be used to do illegal things and since it is your server you can be blamed for what it does and that can lead to hefty fines.
then its time to find a tutorial on how to run your bot on a linux server
i am wrote all commands in one js file
now its really hard to manage
but i saw some people created many js file for particular group of commands
thats really good to manage commands
i am new
pls tell me how can i do it
how do i get the bot's uptime in days hours and minutes
log the time when your bot starts and calculate the uptime from that
save the epoch second that the bot starts up in a variable, and when you need uptime just compare the current epoch second to that saved epoch second
and calculate the diff
im sure there is a date library that does it all for you
all you need to do is declare the variables
i'm trying to make a stats command
mhm
which says the bot's uptime
yep
what spider said should help you ^^
is there a way to get it when the cmd is ran?
you are the programmer who will make that command
Main class:
var date = asdf //global
...
In command:
mainClass.date //the date that the bot started up
whateverLibrary.getCurrentDate // the current date down to the second
see edited msg
but im sure there might be a library that can do it for you
yes
you need to get the global variable
when the command is run
and then generate the current date
in the command
writing it yourself is probably easier than getting a library
ok i found something
bot.uptime gives the bot uptime in ms
how do i convert it to days hours and minutes?
im sure you could do the math yourself
though I'm sure there is a function to change it to a date
i'm bad at maths do you know the formula?
you can either look for a library or just do some basic divisions
i know the way to do it in java
same here, i mostly use java
...

seconds = (time/1000)%60
minutes = (time/60000)%60
hours = (time/3600000)%24
days = time/86400000
i use modulus so you dont get 1 hour and 3600 seconds
if you're using js, you can just do js new Date(client.uptime)
then you can extract whatever you want from the Date object
but the date class might say that your bot is up for 1970 years 😛
^
time 0 is usually 1-1-1970, but i dont know JS
yup, im playing league and not thinking
looks like that gives the time the bot started
Yes, this one does
also useful for a status message
yeah
tim 
how to get the bot's memory/ram usage?
assuming it's js you can access it via process
i can?
Just make up a number, no one will question if it's real 🤔
yeah because my bot having 60zb of memory usage isn't suspicious at all
I'd believe it xD
not funny didnt laugh
You don't have to
actually
@cursive gale it's in the os module https://nodejs.org/api/os.html
for starters you can look at the methods os.totalmem() and os.freemem()
hmm so i can subtract os.totalmem() - os.freemem() right @valid frigate
I think that counts all the memory used by the OS and applications
But I'm not sure
yeah
wot
To delete a message
yes
Ty
bill wurtz?
ahhh
Does someone use Lavalink?
Discord.JS NODE-GYP Error
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok ```
Can anyone help me with this 🤦♀️
I tried googling it and from what I was told it's saying that node 12.3.0 isn't compatible with gyp version 5.0.5 @sick cloud but I have 6.0.0 gyp so 🤷♀️
It was working fine untill I started trying to embed messages in my kick command, that's when it started acting up I have reverted the changes as well but still no fix
when does that error appear? when you try to install something?
Trying to boot up
It started as a "node version missing from package" error when I added the node version it turned to this @quartz kindle
added the node version to where? to package.json?
Why this doesn't set the attach?
const attach = new Discord.Attachment(canvas.toBuffer(), 'ship.png');
let _msg = await message.channel.send("Calculating..")
let e = new Discord.RichEmbed()
.setAuthor("Ship")
.setColor([4, 154, 181])
.setDescription(`**${u.username}** + **${user.username}** = **${parseInt(love)}%**`
+ "\n\n[" + love_level + "] " + msg)
.attachFile(attach)
.setImage(`attachment://ship.png`)```
"node": "12.13.0"
},``` @quartz kindle
can you show your full package.json? is this for a module or your entire bot?
where are you hosting your bot?
@quartz kindle https://pastebin.com/qW8gjPed it's for my entire bot when loading the node modules from the package it stops at gyp and errors and I host on Vulture VPS
and that error happens when you run your bot? like node . or node yourfile.js?
Yes
is there anything else to that error?
Yeah I actually was copying it to pastebin want me to send it here?
sure
you said you were running on a vulture vps?
why is there a ton of heroku written all over the place?
Yeah my bad this bot is Heroku hosted not Vulture
Got it confused with another bot I'm working on 🤦♀️
so basically, heroku uses an automated build system thingy, and its failing to build several of your dependencies
you have a shit ton of dependencies, are you sure you need all of them? you should probably clean them up and remove anything that you're not using.
aside from that, some of those dependencies might not be compatible with node 12
so try setting your engines to node 11 or node 10
you also dont need node-gyp installed locally, since npm uses its own version
Alright I'll run through and clean them up and play with the version..
And oh I didn't know that 🤦♀️
@quartz kindle removing gyp and changing node version to 10 fixed it
Thank you 😁
Do you possibly know any good Databases?
That's the only real reason this bot is Heroku right now cause I'm looking for a db for him before I change it over to my vps
depends on the job
For right now just simple managing users, tracking usage ect
for a small bot that runs on a single machine: sqlite
for a large bot that runs on multiple machines: postgre/mysql/mongo
for a fast memory database to share data across processes: redis
anything that isn't json works
i use json files to store my users because hardly anyone uses my bot B)
i use json because im too lazy to move all the data over to sqlite lul
but will do it eventually
hmm?
100,000 rows is nothing
if you're making a row for each user, this server alone has 70k
._.
my bot adds around 150k rows to my sqlite db every day
so better is a bunch of json files?
no lol
oof
why would json be better?
if you create a record for every user and you want the bot in this server then probably dont use json
100k rows in a single json file would make it quite big, and if anything goes wrong you lose all of it
100k rows in separate json files will ruin your disk
ah
i had one of my bots corrupt an sqlite db 😦
luckily it also makes a backup of the sqlite file every couple hours, so not much was lost
phew
how did it corrupt lol
i should just get a server one day
i think the bot crashed hard during a DB write
or pay for a vps ._.
i could not open the sqlite db anymore so i didnt really look into it much and just swapped the backup into place
(if js) are you using node-sqlite3 or better-sqlite3?
well, the if didnt pass, so you can ignore the line and continue
I'm still running sqlite-jdbc-3.23.1 while the newest version is 3.28.0
🤷
maybe there were some bugs that have been fixed by now
hue
what is the async branch?
just using all commands async?
iirc async is the old branch, the new branch is called rewrite
so basically, just the old python lib
it isn't really rewrite anymore, more like latest
and yeah, async was the name for 0.16.12 version of discord.py
One message removed from a suspended account.
How can i check if the Guild has an Animated Icon?
if so, how can i set the format from png to gif?
One message removed from a suspended account.
remove the extension and check if the guild icon starts with a_
iirc
removing the extension will allow it to automatically switch up the format based on whether it is animated or not
oh
did someone say their bots got corrupt in sqlite?
smh sqlite is not for multi-threads
and has a limit
sqlite getting corrupted in a single threaed process seems highly unlikely
just use an actual database esketitit
sqlite can get corrupted in multiple ways
Anything can get corrupted if you try hard enough
alot of online dbs barely will ever corrupt
hello
I lock all reads and writes to the sqlite DB, but there was a bug in my bot when it happened 😄
Discord.js : how to delete image attachments as they are sent in a specific channel, but log the image attachment link?
this is my code that isn't working:
if(message.channel.name === "picTesting") {
if(message.attachments.size > 0) {
if(message.attachments.every(attachIsImage)) {
let Attachments = (message.attachments).array()
Attachments.forEach(function(attachment) {
console.log(attachment)
attachment.delete();
});
}
}
}
it wont allow me to send attachments (doesn't pull up the upload page), and i cant figure out how to get the upload link if i do
wait. i think i got it
Once you delete the message, the attachment link is deleted too
So logging the link after deletingthe message is pointless
It would only still exist because of cache after seletion, but not long
In case you have that cached for some reason.
so i figured out how to log it, but using attachment.delete() is resulting in an error
my console says:```UnhandledPromiseRejectionWarning: TypeError: attachment.delete is not a function
nvm i got iut
had to use message.delete()
and i still got the url
oh ur right
it doesnt load
@amber fractal So here is what I am trying to do: I have a currency system set up, and when someone sends an image (particularly a meme) in a server, it will delete it and save the url. Then, the message user will get a dm with a unique generated id for the image, and can use a command to sell the meme to another person (+more which isnt relevant).
The thing i need to get is an image url for the sent image, but also delete the image in chat
Is there any way to do this?
Can anybody tell me how to add the RGB effect to my bot page?
- you don't
- people aren't going to spoonfeed you
okay then. ill find a way to do this myself
Pretty sure they were talking to me @tacit stag LOL
@west raptor alright 👍 thought I would ask first but google offers the option to inspect pages for a reason 😂😂
i thought april was talking to me lol
@tacit stag sorry I was talking to @past flower
all good my b
like, one solution i see to my problem isnt good at all: writing the image using fs to my system
after a while, this is a lot of data
you don't need to write the image to your fs
you can just keep the image url in memory or in a database if you need it to persist between restarts
after deleting the image, the url is unavailable, so im looking into databases
👍
I just transfered this from windows to ubuntu and now its being annoying
^^^^^
SyntaxError: missing ) after argument list
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:549:28)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.runMain (module.js:611:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:160:9)
it worked just fine on windows
async message works too
yes but
you have a missing ) somewhere else in your code @junior summit
without () it's just ugly
then present it as a way to make the code more readable, not as a fix
nwm
its not my code
it was node not install properly
XD
but i did update it
thanks
do anyone know how to remove that and make it to like embed background color at discord.js?
use setColor on your embed
what color to make it like discord background
side note: setting it to discord dark theme background color will not hide it in light theme
#36393F
just use a transparent color :wesmart:
@earnest phoenix is that actually possible
oh
hello is it possible to connect several token on the same script with discord.js?
Technically if you have a process manager you can, but I just copy the folders when I need to make another bot
okay thanks
I had someone join my discord and they it was blank they can't see anything but its not blank when I view it
Ok, so I updated this and made some modifications. Can I get some reviews on this website (not the library yet, just the website) - https://perustarknetbsd.thedrone7.repl.co/
A library to make oauth requests to discord. It is easy to use and implement in your app.
does anybody know why
double accumulator = 0.0, operand = -1;
accumulator = accumulator / operand;
printf("%lf", accumulator); // returns -0.000000
long double accumulator1 = 0.0, operand1 = -1;
accumulator1 = accumulator1 / operand1;
printf("%lf", accumulator1); // returns 0.000000
js math ™
that's c @knotty steeple
my guess is floating point imprecisions, but it does look weird
from googling around a bit, it seems long doubles are unstable and act weirdly sometimes, depending on compiler and system architecture
That's weird
also, it says the format specifier for long doubles should be %Lf not %lf
so you can also try that
One message removed from a suspended account.
One message removed from a suspended account.
^
You could use regex instead of forEach
If you care to optimize the code later on
It can get conplicated tho
Or you can just do
prefix = prefixes.find(x=>message.startsWith(x))
or if(prefixes.some(x => message.startsWith(x))) { //continue }
Or those 
if (!new RegExp(prefixes.join('|').replace(/[^|]/gi, i => `\\${i}`), 'i').test(message.content)) { return }

better yet, return the prefix you're using 
const prefixes = ['.', ',', '--'];
const [usedPrefix] = message.content.match(new RegExp(prefixes.join('|').replace(/[^|]/gi, i => `\\${i}`), 'i')) || [false]
if (!usedPrefix) { return }
console.log(usedPrefix)
(may be overkill)
ken coming in clutch
how does that perform compared to native array methods?
try it out in jsben.ch or something xd
im gonna test them
prefixes.some() is the fastest to check for a valid prefix
prefixes.find() is the fastest to check and return the prefix
the difference between the two is very small
prefixes.forEach() is a little slower, but not by much
the regexes tho, are abysmally slow
roughly 3-4x slower
as expected
I don't see why people love regex so much, its almost always difficult to read and there are very few usecases where it is fast
imagine regex in brainfuck...
you'd probably have to write your own implementation of regex
in brainfuck
then use it, in brainfuck
im sure people who love brainfuck would love doing that too
lol
perfect example of "why? because we can"
My brain starts melting just looking at that
I have seen some weird powerpoint videos, so i might have seen it
brainfuck is a brainfuck
Hey :3 do you know how to mix’ member.guild.add with an message.embed ?
!serverinfo
you can test your commands in #commands and #265156322012561408
minimod
I need someone with Administrator permissions on this server to disable some announcement stuff on my bot so it's not pinging everyone when it updates
just eval and disable it?
My bot has a config command and I didn't think to allow myself to use it anywhere
And I don't have eval for security reasons lol
It's probably a good idea to allow myself to override any server's configuration anyway (for tech support and stuff), I'll do that
My bot always accepts my commands as admin commands
For things like changing the prefix
@digital tangle we aren't going to be doing that, but bots cant ping everyone anyways so
-nicetry @real helm
@real helm
Hey, any bots that have common prefixes are now blocked from reading any channel. Nice try spamming your dms though.
Is there way to see how much memory a class is using? NodeJS
@split hazel sorry for the late response you can use process.memoryUsage().heapUsed
For example (process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2) will show the bots memory usage
I know but I want to view a specific classes size in memory
I need to debug what's using most of my memory
Ahh classic memory leaks
🤔 I have never personally heard of a way to do that maybe someone else here has but for now you could try these
@split hazel
https://www.google.com/amp/s/auth0.com/blog/amp/four-types-of-leaks-in-your-javascript-code-and-how-to-get-rid-of-them/
How tf do you get a guild owner's name with discordjs?
This shit is evading me and idk why
Guild#owner#user#username
Ty, I'll try it
just the notation I chose
@pliant needle to get guild owner of the guild the command was executed in u have to use
message.guild.owner.user.username
Tyvm!
Don't forget to check if the message is not a DM
and that might not work if the owner isn't cached?
ew
Hello !
Can you explain me what is it ?
(node:14572) UnhandledPromiseRejectionWarning: FetchError: request to https://discordapp.com/api/v7/channels/636978183802978314 failed, reason: read ECONNRESET
at RequestHandler.execute (C:\Bot\Juva\node_modules\discord.js\src\rest\RequestHandler.js:106:9)
at process._tickCallback (internal/process/next_tick.js:68:7)
your posting to the wrong api endpoint
its v6
not v7
discord.js is wrong wtf
So how to can i repare that ?
fs.unlinkSync("data\\" + message.author.id + "\\data\\game\\" + args1.toString(), function (err) {
if (err) throw err;
});
ignore the fact im not using a json and why isn't this working?
{ Error: ENOENT: no such file or directory, unlink 'data\276497792526974996\data\game\hi'
at Object.unlinkSync (fs.js:951:3)
at Client.client.on (/app/server.js:467:16)
at Client.emit (events.js:189:13)
at MessageCreateAction.handle (/rbd/pnpm-volume/0a3b8ae4-0db1-462d-ba19-27eb814e819b/node_modules/.github.com/discordjs/discord.js/16db92ede8dc164346eca8482ea008cb21032c7b/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (/rbd/pnpm-volume/0a3b8ae4-0db1-462d-ba19-27eb814e819b/node_modules/.github.com/discordjs/discord.js/16db92ede8dc164346eca8482ea008cb21032c7b/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (/rbd/pnpm-volume/0a3b8ae4-0db1-462d-ba19-27eb814e819b/node_modules/.github.com/discordjs/discord.js/16db92ede8dc164346eca8482ea008cb21032c7b/node_modules/discord.js/src/client/websocket/WebSocketManager.js:391:31)
at WebSocketShard.onPacket (/rbd/pnpm-volume/0a3b8ae4-0db1-462d-ba19-27eb814e819b/node_modules/.github.com/discordjs/discord.js/16db92ede8dc164346eca8482ea008cb21032c7b/node_modules/discord.js/src/client/websocket/WebSocketShard.js:423:22)
at WebSocketShard.onMessage (/rbd/pnpm-volume/0a3b8ae4-0db1-462d-ba19-27eb814e819b/node_modules/.github.com/discordjs/discord.js/16db92ede8dc164346eca8482ea008cb21032c7b/node_modules/discord.js/src/client/websocket/WebSocketShard.js:279:10)
at WebSocket.onMessage (/rbd/pnpm-volume/0a3b8ae4-0db1-462d-ba19-27eb814e819b/node_modules/.registry.npmjs.org/ws/6.2.1/node_modules/ws/lib/event-target.js:120:16)
at WebSocket.emit (events.js:189:13)
errno: -2,
syscall: 'unlink',
code: 'ENOENT',
path: 'data\\276497792526974996\\data\\game\\hi' }
the file does exist
this is in the code if (fs.existsSync("data//" + message.author.id + "//data//game//" + args1.toString())) { and it passwed it
how can ı?
can you what
Number of users
ignore the fact im not using a json and why isn't this working?
you generally shouldn't be using files//IO as a database anyways
in which library, claord
Number of servers & Number of users
library is discord.js
Servers: <Client>.guilds.size
Users: <Client>.users.size
This is only for cached users and servers iirc
{ Error: EPERM: operation not permitted, unlink 'data\276497792526974996\data\game\hi'
at Object.unlinkSync (fs.js:951:3)
at Client.client.on (C:\Users\hidingrealname\Desktop\DiscordBotNameIgnoreMe\bot.js:459:16)
at Client.emit (events.js:189:13)
at MessageCreateAction.handle (C:\Users\hidingrealname\Desktop\DiscordBotNameIgnoreMe\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\hidingrealname\Desktop\DiscordBotNameIgnoreMe\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (C:\Users\hidingrealname\Desktop\DiscordBotNameIgnoreMe\node_modules\discord.js\src\client\websocket\WebSocketManager.js:391:31)
at WebSocketShard.onPacket (C:\Users\hidingrealname\Desktop\DiscordBotNameIgnoreMe\node_modules\discord.js\src\client\websocket\WebSocketShard.js:423:22)
at WebSocketShard.onMessage (C:\Users\hidingrealname\Desktop\DiscordBotNameIgnoreMe\node_modules\discord.js\src\client\websocket\WebSocketShard.js:279:10)
at WebSocket.onMessage (C:\Users\hidingrealname\Desktop\DiscordBotNameIgnoreMe\node_modules\ws\lib\event-target.js:120:16)
at WebSocket.emit (events.js:189:13)
errno: -4048,
syscall: 'unlink',
code: 'EPERM',
path: 'data\\276497792526974996\\data\\game\\hi' }
I decided to self-host and i got this
wait i got a idea
where were you hosting before
glitch xD
xD sryz
I use it because multiple people can code at once
@peak bloom
{ Error: EISDIR: illegal operation on a directory, unlink './/data//276497792526974996//data//game//hi'
rip me
still a error
Has anyone figured out yet how to set the custom status for a bot ?
You cant
I mean it's not that big of a deal
But it's a nice thing to have
Solving all those weird statuses "Playing type !help for help"
custom statuses for bots are not a good idea at all
it would be massively abused
Like?
tricking users into clicking a phish link, putting them under a misconception, presence spam etc
keep in mind user accounts are limited to 100 guilds so the damage is limited, bots can be added to an x amount of guilds
yes
Wdym by “custom”
which is how users distinct presence between custom status
custom status
custom
you can customize it
if you remove that line, new users will not know if that's a title that's promoted by discord etc.
hence why bots are limited to only normal presence
Well you can but also not 🤔
what
Let me try to find the code lol
Got a question. How can i display the servers my bot is in? I see the "Servers this bot is in" but i dont know what ID i need to put in. Do i need to add some code to my bot?
What's the best timeout for playing statuses? Once every?
Got a question. How can i display the servers my bot is in? I see the "Servers this bot is in" but i dont know what ID i need to put in. Do i need to add some code to my bot?
which library
Are you sure Discord does not support custom statusses for bots, or is it just the libraries that don't support it yet?
What's the best timeout for playing statuses? Once every?
safest bet that respects ratelimit is 1/15
Are you sure Discord does not support custom statusses for bots, or is it just the libraries that don't support it yet?
test it out yourself
im too lazy 😛
Lol
@earnest phoenix .net
custom statuses are basically rich presence under the hood
@earnest phoenix .net
yes but which lib
That's what I meant 🤦♀️ rich presence just changes every x amount of time
@blissful scaffold discord.js server
ty @summer torrent
np
Yeah sorry i meant rich presence so like streaming blah blah blah
@mellow crown Discord.net c#
@woeful patrol nah it still works I just wanted to know the best timeout before it changes to another presence
hm
@past flower what is your library
bots can use playing, watching, listening and streaming as their status @woeful patrol
Node
discord.js?
Ya
if you're using discord.net, DiscordSocketClient#Guilds and use Count on it @heady snow
yes, that is what i said ^^
client.user.setActivity("Blah blah blah", twitch link);
@earnest phoenix ok thanks
@past flower
One sec I'll show you guys how I have it set up
no one was talking about streaming statuses
Not that
🔹TRYHXRD🔹Today at 12:26 AM
@woeful patrol nah it still works I just wanted to know the best timeout before it changes to another presence
let activities = [
{
name:`${activity1} in ${client.guilds.size} Servers`,
options:{
type:`${type1}`
}
},
{
name:`${activity2} for ${client.users.size} Users`,
options:{
type:`${type2}`
}
},
{
name: `${activity3} in ${client.channels.size} Channels`,
options:{
type:`${type3}`
}
},
{
name: `${activity4} ${client.users.size} Users`,
options:{
type: `${type4}`
}
}
]
let i = 0;
console.log(`${client.user.username} has started, with ${client.users.size} users, in ${client.channels.size} channels of ${client.guilds.size} guilds.`);
timers.setInterval(() => {
i = i == activities.length ? 0 : i
client.user.setActivity(activities[i].name, activities[i].options)
i++
}, time1)
});
@woeful patrol see at the end it awaits a time I set in the config
Right now it's set to 120000 ms
ah
changing the bot status should NEVER be faster than once every 12 seconds, but best would be to update the status no more than once every 2 minutes @woeful patrol
After that time it will change the stream name
Custom status is not rich presence...
So I was just trying to figure out the best time to set to avoid API limits
@earnest phoenix And how do i display it on the top gg site?
@heady snow what
@blissful scaffold sweet thanks I have it set to 2 minutes so I should be good
And how do i display it on the top gg site?
make a request to the api
use HttpClient to make requests to it
please for your own sake don't use the library that's there
it's horrible and it's so slow
ok thanks again
i wonder if you can resubmit a better library to the docs
because veld's code is just shit
its veld what do you expect
@west spoke not the other veld lol
map the roles
hm
if d.js
(assuming sorry if wrong)
is js yes
em is it possible to get real time uptime on website where the time is constantly updating?
so like u know the bot has an uptime i wanna try post the bot uptime to the website where it updates real time


the lib already does it for you
why is modulus being used there

