#development

1 messages · Page 716 of 1

earnest phoenix
#

(sarcasm)

blissful scaffold
#

@sage bobcat and all he has is a phone

sage bobcat
#

One message removed from a suspended account.

snow urchin
amber fractal
#

Discord only embeds ssl secured sites now iirc

celest spear
#

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)

snow urchin
#

yes ok, I am the dumb idiot that forgot to add the s after http on the sharex config

amber fractal
#

@celest spear what lib

celest spear
#

js

amber fractal
eternal topaz
#

How do I finish the bot?

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

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 ?

little hamlet
#

if the user or bot says it?

earnest phoenix
#

?

#

this is just a general example

little hamlet
#

@eternal topaz What do you mean "finish the bot"?

#

if the bot is saying it twice use if message.author.bot

ocean rampart
#

What does command is not defined mean?

dusky marsh
#

command is not defined

grizzled jackal
#

then it doesn't know what command means lol

dusky marsh
#

Exactly as it says

grizzled jackal
#

try console logging it

dusky marsh
#

It'll say undefined if it is undefined

tranquil drum
#

lmao

#

check how the command variable is set

cunning goblet
#

@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)

tacit stag
#

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.

summer torrent
#

Which library do you use?

tacit stag
#

discord.js

lucid silo
#

i need help about the review of my bot

earnest phoenix
#

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

summer torrent
cunning oxide
#

when should i start sharding

#

realistically

#

@ what amount

#

of users / guilds?

vernal willow
#

around 2000 guilds

#

By 2500 guilds I'm pretty sure you can't login with your discord bot's token

earnest phoenix
#

how do we get the Bot Developer role?

tacit stag
#

"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

vernal willow
cunning oxide
#

ty

west spoke
#

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 GWprytrFoxxolay

blissful scaffold
#

@earnest phoenix you get the developer role when you have a bot that is approved

earnest phoenix
#

okay thanks

valid frigate
#

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

blissful scaffold
#

you can make a bot in js if you are more familiar with that

#

in java you create an array with []

#

new String[5]

earnest phoenix
#

"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

quartz kindle
#

discord recommends sharding at 1500

blissful scaffold
#

when you get to 2400 without sharding it is time to worry a lot

west spoke
#

I got HTTP auth working. Don't pay attention to my question.

tranquil drum
#

@valid frigate use EmbedBuilder

west spoke
#

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.

lament meteor
#
data = json.load(jsonFile)

tmp = data["key"]
data["key"] = tmp.append("3")```
#

that should work?

west spoke
#

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

valid frigate
#

ok ok so basically

west spoke
#

Yeah i already have the rest defined.

valid frigate
#

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™

west spoke
#

text="a" embed=embed

#

ez

#

at least for py

#

you can send a embed and a text message at the same time i believe

lament meteor
#

neko... try check if old is a NoneType before appending cause that may be the issue

valid frigate
#

i would think it is .sendMessage(String messagecontent, MessageEmbed embed) but apparently not

lament meteor
#

not sure why the old would do that but ye..

west spoke
#

thats what it is

valid frigate
#

hmm

#

finna ping dep LULW

west spoke
#

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

celest spindle
#

Does anybody know why bot.nickname remains null even after setting its nickname?

#

using discord.js btw

west spoke
#

Because it's trying to get the nickname of the bot in the user itself.

#

it needs to be in the server

#

like

celest spindle
west spoke
#

hmm

celest spindle
#

id is the guild id

west spoke
#

ok

celest spindle
#

dont know why it remains null

west spoke
#

@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"]

shy turret
#
      startarg = serverprefix + 'edit'
      args = message.content.slice(startarg.length).split(' ');

why is args[0] nothing?

cold harness
#

@shy turret you didn't add any commandline arguements

shy turret
#

wdym

#

this is in a client.on('message', async message => { function

cold harness
#

Oh wait is this python?

shy turret
#

js

#

nodejs

cold harness
#

Nvm lol i can't really help there >-<

shy turret
#

oh lol rip me

#

args itself is working

#

args[0] isnt

earnest phoenix
#

what does the whole array return

shy turret
#

(got help from the discord api server i fixed it)

grizzled jackal
#

What was the issue?

cunning goblet
#

@shy turret you should uh use

#

\ +\

#

the way how you are getting arguments aren't too much stable

shy turret
#

@cunning goblet i already fixed it

cunning goblet
#

also next time i suggest you ask dbl related questions in #general

junior dome
#

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.

boreal crest
#

@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

sudden geyser
#

no problem (although I forgot about this message)

hoary elm
#

Any help is appreciated

peak bloom
#

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

hoary elm
#

so for example the url they have in example one what would that be changed with or does it remain the same

peak bloom
#

you want it to go to your bot so you're gonna need an express server on the bot

hoary elm
#

Okay

#

Thanks 😁

#

So I'm honestly not even sure if this is the right guide for what I am trying to do

slender thistle
#

Discord webhooks accept data payload different from usual ones

#

Not sure if PayPal supports Discord webhooks k3llyShrug

hoary elm
#

I'm not sure either

slender thistle
#

you would need to host a webserver to handle that and send requests to Discord webhook yourself

hoary elm
#

Alright I'll do that then, thanks for your guys's help

slender thistle
valid frigate
#

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

cerulean salmon
#

how to get message content by message id

steel cloak
#

@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

glacial mango
#

How do I change word, word1, word2 into 'word', 'word1', 'word2' ?

#

Ping please

slender thistle
#

That's kinda too vague

glacial mango
#

wdym

#

I need to add quotes to every word which is seperated with a ,

slender thistle
#

"'${some_var}'"? thonkku

#

Is it that necessary tho, yeah

glacial mango
#

I need it to make a mod for dbm

#

How do I do it

fickle sage
#

Somebody van help me to create a webbiild

earnest phoenix
#

don't have a van sorry

cunning goblet
#

whats a webbiild

#

speak english please

sage bobcat
#

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.

fickle sage
#

Somebody can help me to make a webbuild

mossy vine
#

probably not

fickle anvil
#

is message.member.id and message.author.id the same ?

sage bobcat
#

One message removed from a suspended account.

fickle anvil
#

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

quartz kindle
#

they are both the same yes

fickle anvil
#

okay, yeah author is better to use, as it allows dm and server

quartz kindle
#

you only need to use member if you're going to do operations on the member object, like manage roles, nicknames, kick/ban, etc

fickle anvil
#

ah nice, thanks

earnest phoenix
#

any1 hosting on repl ?

loud salmon
#

@earnest phoenix repl, glitch, and heroku were never meant for good bot hosting

earnest phoenix
#

but they work

loud salmon
#

People say communism works too, doesn't mean its healthy @earnest phoenix

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

#

aws ?

cunning goblet
#

a glitch moderator technically promoted usage of uptimerobot

earnest phoenix
#

it isn't difficult at all looooool

#

^

cunning goblet
#

so technically the ping stuff

#

is allowed

earnest phoenix
#

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

cunning goblet
#

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

earnest phoenix
#

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

fickle anvil
#
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
earnest phoenix
#

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

blissful scaffold
#

most people get scared when they need to input commands in a console

#

so linux is scary

earnest phoenix
#

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

blissful scaffold
#

yeah

earnest phoenix
#

send voltage signals to your cpu like a real programmer does it

blissful scaffold
#

we also use keyboard with only 2 buttons, a 0 and a 1

earnest phoenix
#

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

blissful scaffold
#

there are drag and drop programming languages, they are just not very flexible

earnest phoenix
#

scratch

#

lol

blissful scaffold
#

and i dont think there are discord libraries for those languages

earnest phoenix
#

scratch is a great site

#

lol

#

tons of kids learn to program through it

#

scratch isnt really programming

#

why not

blissful scaffold
#

its a good way to learn how programs work

earnest phoenix
#

its technical lego blocks on a computer

#

i think it's a great tool to teach ppl programming and the logic behind it

blissful scaffold
#

it teaches about the logic behind programs, but it isnt very flexible

earnest phoenix
#

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)

blissful scaffold
#

so after using that its time to step up to something else

earnest phoenix
#

cry has the biggest brain

cunning goblet
#

scratch is a code generator

earnest phoenix
#

but a lot of the time you don't need all of the features that requires a console or w/e

cunning goblet
#

with a canvas for a preview

earnest phoenix
#

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

cunning goblet
#

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

earnest phoenix
#

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

cunning goblet
#

half of the shit that has a gui in linux

earnest phoenix
#

you don't always need all of the features

grizzled jackal
#

Is it my net or is Discord's api lagging?

earnest phoenix
#

especially for beginners

cunning goblet
#

emits command line stuff

#

in the background

#

@grizzled jackal discord api is lagging

#

@earnest phoenix if your a beginner then heres my first suggestion

#
  1. don't trust tutorials
#

and second

earnest phoenix
#

How to display API ping?

#

cry

cunning goblet
#

make other stuff first

earnest phoenix
#

you don't always need all of the features
yes, sure, but that's not a counterargument as to why UIs are absolutely trash

cunning goblet
#

alot of UIs use api/command line utilites

earnest phoenix
#

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

cunning goblet
#

stopwatch/timer

#

why would you do that for ping

earnest phoenix
#

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

cunning goblet
#

also zerp: if you used the command line, alot of more features could be accessed

#

which could help you do certain things

earnest phoenix
#

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

blissful scaffold
#

api seems to be fixed for now

#

pinging my bot works again

earnest phoenix
#

Me 2

cunning goblet
#

huh

#

ping still worked on my bot

blissful scaffold
#

at the worst pinging my bot took 1+ minute

earnest phoenix
#

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

blissful scaffold
#

those places are also bad to host on, but its good for training

earnest phoenix
#

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

#

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

blissful scaffold
#

"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

earnest phoenix
#

if anybody wants to be a programmer or a doctor they should have the resources to learn how to

#

they do

blissful scaffold
#

sure, they have the resources

earnest phoenix
#

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

mossy vine
#

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

earnest phoenix
#

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

blissful scaffold
#

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

earnest phoenix
#

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

mossy vine
#

i feel like most beginners jump into programming with the wrong mindset

earnest phoenix
#

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

blissful scaffold
#

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

earnest phoenix
#

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

blissful scaffold
#

its a fun toy to play around with, but dont expect to make a discord bot with it

earnest phoenix
#

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

blissful scaffold
#

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

grizzled jackal
#

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

fallow spire
#

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

earnest phoenix
#

what is up with you people using then in an async method

fickle anvil
#

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]});

earnest phoenix
#

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

fickle anvil
#

k thx

earnest phoenix
#

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

fickle anvil
#

yesn't I guess

earnest phoenix
#

when i try go in bitvise it says

#

that my password or username incorect

#

tried

valid frigate
#

bruh

earnest phoenix
#

to generate keys on windows you can use putty

#

tried

#

it says that my password or name incorrect

#

in digitalocean i changed

#

its ok

#

but bitvise says incorrect

fickle anvil
#

logins to websites are NOT your root logins (if the hoster doesn't suck balls)

earnest phoenix
#

it says it is

#

no, they're not

#

how do i get

fickle anvil
#

he probably didn't even read the mails he got after buying the server

earnest phoenix
#

read the last docs link i sent you

#

probably

#

mhmm

blissful scaffold
#

TimeWind, maybe your login or password is wrong

earnest phoenix
#

ok i understoood

#

thanks @earnest phoenix @fickle anvil

#

i never check my mail

earnest phoenix
#

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

fickle anvil
#

I can do them on my own

earnest phoenix
#

help

#

me

#

i would be rlly helpful

blissful scaffold
#

TimeWind, there are good tutorials online on how to use digital ocean

fickle anvil
#

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

earnest phoenix
#

i logged in bitvise

#

it was hardest part for me

fickle anvil
#

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.

earnest phoenix
#

some people call em chonky fines but to each their own

#

i alr made a bot

blissful scaffold
#

then its time to find a tutorial on how to run your bot on a linux server

cerulean salmon
#

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

molten yarrow
cursive gale
#

how do i get the bot's uptime in days hours and minutes

blissful scaffold
#

log the time when your bot starts and calculate the uptime from that

loud salmon
#

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

cursive gale
#

i'm trying to make a stats command

loud salmon
#

mhm

cursive gale
#

which says the bot's uptime

loud salmon
#

yep

blissful scaffold
#

what spider said should help you ^^

cursive gale
#

is there a way to get it when the cmd is ran?

blissful scaffold
#

you are the programmer who will make that command

loud salmon
#
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
cursive gale
#

see edited msg

blissful scaffold
#

but im sure there might be a library that can do it for you

loud salmon
#

yes

#

you need to get the global variable

#

when the command is run

#

and then generate the current date

#

in the command

cursive gale
#

ok i'm going hunting

#

lol

blissful scaffold
#

writing it yourself is probably easier than getting a library

cursive gale
#

ok i found something

#

bot.uptime gives the bot uptime in ms

#

how do i convert it to days hours and minutes?

loud salmon
#

omegalul the lib already does it for you

#

gg

#

uh

cursive gale
#

lol

#

i'm stupid

loud salmon
#

im sure you could do the math yourself

#

though I'm sure there is a function to change it to a date

cursive gale
#

i'm bad at maths do you know the formula?

loud salmon
#

its not really a formula

#

idk

#

i dont use js

blissful scaffold
#

you can either look for a library or just do some basic divisions

loud salmon
#

i know the way to do it in java

blissful scaffold
#

same here, i mostly use java

cursive gale
#

...

loud salmon
blissful scaffold
#
seconds = (time/1000)%60
minutes = (time/60000)%60
hours = (time/3600000)%24
days = time/86400000
loud salmon
#

Thonk why is modulus being used there

#

am i stupid

#

oh yea

#

no remainders

blissful scaffold
#

i use modulus so you dont get 1 hour and 3600 seconds

loud salmon
#

ye

#

lemme just yoink that

quartz kindle
#

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

blissful scaffold
#

but the date class might say that your bot is up for 1970 years 😛

amber fractal
#

You sure about that one chief?

west spoke
#

^

blissful scaffold
#

time 0 is usually 1-1-1970, but i dont know JS

quartz kindle
#

yup, im playing league and not thinking

amber fractal
blissful scaffold
#

looks like that gives the time the bot started

amber fractal
#

Yes, this one does

blissful scaffold
#

also useful for a status message

cursive gale
#

yeah

loud salmon
#

tim 02LUL

cursive gale
#

how to get the bot's memory/ram usage?

earnest phoenix
#

cry

#

hard

cursive gale
#

...

#

what

valid frigate
#

assuming it's js you can access it via process

cursive gale
#

i can?

valid frigate
blissful scaffold
#

Just make up a number, no one will question if it's real 🤔

valid frigate
#

yeah because my bot having 60zb of memory usage isn't suspicious at all

blissful scaffold
#

I'd believe it xD

valid frigate
#

not funny didnt laugh

blissful scaffold
#

You don't have to

valid frigate
#

actually

#

for starters you can look at the methods os.totalmem() and os.freemem()

earnest phoenix
#

ux tip

#

nevermind

cursive gale
#

hmm so i can subtract os.totalmem() - os.freemem() right @valid frigate

blissful scaffold
#

I think that counts all the memory used by the OS and applications

#

But I'm not sure

valid frigate
#

yeah

pliant needle
#

message.delete(), right?

#

djs

sudden geyser
#

wot

pliant needle
#

To delete a message

sudden geyser
#

yes

pliant needle
#

Ty

vapid rune
#

bill wurtz?

earnest phoenix
#

in the style of

#

someone in dapi made it

vapid rune
#

ahhh

earnest phoenix
#

Does someone use Lavalink?

past flower
#

Discord.JS NODE-GYP Error

 gyp ERR! node-gyp -v v5.0.5
 gyp ERR! not ok ```
#

Can anyone help me with this 🤦‍♀️

sick cloud
#

not related to discord.js

#

google node gyp error

past flower
#

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

quartz kindle
#

when does that error appear? when you try to install something?

past flower
#

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

quartz kindle
#

added the node version to where? to package.json?

past flower
#

Yes

#

I'll show you how

rugged bramble
#

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`)```
past flower
#
"node": "12.13.0" 
},``` @quartz kindle
quartz kindle
#

can you show your full package.json? is this for a module or your entire bot?

#

where are you hosting your bot?

past flower
quartz kindle
#

and that error happens when you run your bot? like node . or node yourfile.js?

past flower
#

Yes

quartz kindle
#

is there anything else to that error?

past flower
#

Yeah I actually was copying it to pastebin want me to send it here?

quartz kindle
#

sure

past flower
#

It's all gyp related from what I can tell

quartz kindle
#

you said you were running on a vulture vps?

#

why is there a ton of heroku written all over the place?

past flower
#

Yeah my bad this bot is Heroku hosted not Vulture

#

Got it confused with another bot I'm working on 🤦‍♀️

quartz kindle
#

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

past flower
#

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

quartz kindle
#

depends on the job

past flower
#

For right now just simple managing users, tracking usage ect

quartz kindle
#

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

sick cloud
#

anything that isn't json works

past flower
#

Lol

#

Yup

vapid rune
#

i use json files to store my users because hardly anyone uses my bot B)

quartz kindle
#

i use json because im too lazy to move all the data over to sqlite lul

#

but will do it eventually

vapid rune
#

ah

#

wait what 100,000 rows on postgres

#

wow

quartz kindle
#

hmm?

vapid rune
#

for heroku

#

i thought i wouldn't have a lot

#

since i'm on the free plan

blissful scaffold
#

100,000 rows is nothing

quartz kindle
#

if you're making a row for each user, this server alone has 70k

vapid rune
#

._.

blissful scaffold
#

my bot adds around 150k rows to my sqlite db every day

vapid rune
#

so better is a bunch of json files?

quartz kindle
#

no lol

vapid rune
#

oof

quartz kindle
#

why would json be better?

blissful scaffold
#

if you create a record for every user and you want the bot in this server then probably dont use json

quartz kindle
#

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

vapid rune
#

ah

blissful scaffold
#

i had one of my bots corrupt an sqlite db 😦

vapid rune
#

wow

#

f

blissful scaffold
#

luckily it also makes a backup of the sqlite file every couple hours, so not much was lost

vapid rune
#

phew

quartz kindle
#

how did it corrupt lol

vapid rune
#

i should just get a server one day

blissful scaffold
#

i think the bot crashed hard during a DB write

vapid rune
#

or pay for a vps ._.

quartz kindle
#

but sqlite offloads writes to the system

#

the bot doesnt do the actual writing

blissful scaffold
#

no idea how it did it 😄

#

something bad with the journaling file i guess

vapid rune
#

so the sqlite process crashed?

#

*a sqlite process

blissful scaffold
#

i could not open the sqlite db anymore so i didnt really look into it much and just swapped the backup into place

quartz kindle
#

(if js) are you using node-sqlite3 or better-sqlite3?

blissful scaffold
#

im running java

#

not JS

quartz kindle
#

well, the if didnt pass, so you can ignore the line and continue

blissful scaffold
#

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

vapid rune
#

bruh

#

i mean, i can't say much

quartz kindle
#

hue

blissful scaffold
#

what is the async branch?
just using all commands async?

quartz kindle
#

iirc async is the old branch, the new branch is called rewrite

#

so basically, just the old python lib

blissful scaffold
#

ah ^^

slender thistle
#

it isn't really rewrite anymore, more like latest
and yeah, async was the name for 0.16.12 version of discord.py

sage bobcat
#

One message removed from a suspended account.

fallow spire
#

How can i check if the Guild has an Animated Icon?
if so, how can i set the format from png to gif?

sage bobcat
#

One message removed from a suspended account.

fallow spire
#

discord.js

#

11.5.1

earnest phoenix
#

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

cunning goblet
#

oh

#

did someone say their bots got corrupt in sqlite?

#

smh sqlite is not for multi-threads

#

and has a limit

valid frigate
#

sqlite getting corrupted in a single threaed process seems highly unlikely

#

just use an actual database esketitit

cunning goblet
#

sqlite can get corrupted in multiple ways

unique nimbus
#

Anything can get corrupted if you try hard enough

cunning goblet
#

alot of online dbs barely will ever corrupt

earnest phoenix
#

hello

blissful scaffold
#

I lock all reads and writes to the sqlite DB, but there was a bug in my bot when it happened 😄

tacit stag
#

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

amber fractal
#

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

tacit stag
#

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?

past flower
#

Can anybody tell me how to add the RGB effect to my bot page?

west raptor
#
  1. you don't
  2. people aren't going to spoonfeed you
tacit stag
#

okay then. ill find a way to do this myself

past flower
#

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 😂😂

tacit stag
#

i thought april was talking to me lol

west raptor
#

@tacit stag sorry I was talking to @past flower

tacit stag
#

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

tranquil drum
#

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

tacit stag
#

after deleting the image, the url is unavailable, so im looking into databases

tranquil drum
#

👍

junior summit
#

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

dusky marsh
#

missing closing ) after closing curly bracket

#

most likely

junior summit
#

it worked on windows thou

#

and i dont see anything wrong

cunning goblet
#

SMH

#

its

#

client.on('message', async (message) => {

mossy vine
#

async message works too

cunning goblet
#

yes but

mossy vine
#

you have a missing ) somewhere else in your code @junior summit

cunning goblet
#

without () it's just ugly

mossy vine
#

then present it as a way to make the code more readable, not as a fix

junior summit
#

nwm

#

its not my code

#

it was node not install properly

#

XD

#

but i did update it

#

thanks

earnest phoenix
#

hello miles 2.0

#

how r u

restive furnace
earnest phoenix
#

use setColor on your embed

restive furnace
#

what color to make it like discord background

bitter sundial
#

side note: setting it to discord dark theme background color will not hide it in light theme

#

#36393F

earnest phoenix
#

just use a transparent color :wesmart:

solemn harness
#

anyone knows how to setup github enterprise server?

#

using Google Cloud Platform

mossy vine
#

@earnest phoenix is that actually possible

earnest phoenix
#

no

#

i was kidding

#

if embed colors supported rgba it would

mossy vine
#

oh

earnest phoenix
#

hello is it possible to connect several token on the same script with discord.js?

amber fractal
#

Technically if you have a process manager you can, but I just copy the folders when I need to make another bot

west raptor
#

@earnest phoenix yes it is possible

#

Is it recommended? Probably not

earnest phoenix
#

okay thanks

flat imp
#

I had someone join my discord and they it was blank they can't see anything but its not blank when I view it

cunning goblet
#

@flat imp 1. english

#
  1. i don't think this is related to bot development
quasi forge
#

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/

earnest phoenix
#

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
knotty steeple
#

js math ™

earnest phoenix
#

that's c @knotty steeple

knotty steeple
#

anything is js

#

im a bot

#

made in js

#

maybe cuz you made it a long double uwu

quartz kindle
#

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

earnest phoenix
#

That's weird

quartz kindle
#

also, it says the format specifier for long doubles should be %Lf not %lf

#

so you can also try that

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

grizzled jackal
#

I believe its startsWith*

#

Iirc

grim aspen
#

^

amber fractal
#

You could use regex instead of forEach

#

If you care to optimize the code later on

#

It can get conplicated tho

slim heart
#

Or you can just do
prefix = prefixes.find(x=>message.startsWith(x))

quartz kindle
#

or if(prefixes.some(x => message.startsWith(x))) { //continue }

amber fractal
#

Or those mmulu

languid dragon
#
if (!new RegExp(prefixes.join('|').replace(/[^|]/gi, i => `\\${i}`), 'i').test(message.content)) { return }
#

better yet, return the prefix you're using POGGY

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)

knotty steeple
#

ken coming in clutch

quartz kindle
#

how does that perform compared to native array methods?

tranquil drum
#

Lol imagine it being faster

#

Can’t imagine Array.join is fast

quartz kindle
#

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

blissful scaffold
#

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

quartz kindle
#

the same reason people love coding in brainfuck

#

probably

blissful scaffold
#

imagine regex in brainfuck...

quartz kindle
#

you'd probably have to write your own implementation of regex

#

in brainfuck

#

then use it, in brainfuck

blissful scaffold
#

im sure people who love brainfuck would love doing that too

quartz kindle
#

lol

#

perfect example of "why? because we can"

blissful scaffold
#

My brain starts melting just looking at that

quartz kindle
#

have you seen the video on the turing completeness of powerpoint ?

#

its amazing

blissful scaffold
#

I have seen some weird powerpoint videos, so i might have seen it

knotty steeple
#

brainfuck is a brainfuck

lunar crystal
#

Hey :3 do you know how to mix’ member.guild.add with an message.embed ?

earnest phoenix
#

?

#

what do you mean

real helm
#

!serverinfo

blissful scaffold
earnest phoenix
#

minimod

digital tangle
#

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

mossy vine
#

just eval and disable it?

digital tangle
#

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

blissful scaffold
#

My bot always accepts my commands as admin commands

#

For things like changing the prefix

loud salmon
#

@digital tangle we aren't going to be doing that, but bots cant ping everyone anyways so

#

-nicetry @real helm

gilded plankBOT
#

@real helm

Hey, any bots that have common prefixes are now blocked from reading any channel. Nice try spamming your dms though.

split hazel
#

Is there way to see how much memory a class is using? NodeJS

real helm
#

xd

#

i don't remember it

#

srry xd

hoary elm
#

@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

split hazel
#

I know but I want to view a specific classes size in memory

hoary elm
#

Ohhhh

#

That I'm not sure 🤔

split hazel
#

I need to debug what's using most of my memory

hoary elm
#

Ahh classic memory leaks

pliant needle
#

How tf do you get a guild owner's name with discordjs?

#

This shit is evading me and idk why

smoky spire
#

Guild#owner#user#username

pliant needle
#

Ty, I'll try it

earnest phoenix
#

why did you put # instead of .

#

@smoky spire

smoky spire
#

just the notation I chose

earnest phoenix
#

@pliant needle to get guild owner of the guild the command was executed in u have to use
message.guild.owner.user.username

pliant needle
#

Tyvm!

blissful scaffold
#

Don't forget to check if the message is not a DM

late hill
#

and that might not work if the owner isn't cached?

earnest phoenix
#

message.guild.members.fetch()

sudden geyser
#

ew

ornate hawk
#

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)
earnest phoenix
#

your posting to the wrong api endpoint

#

its v6

#

not v7

#

discord.js is wrong wtf

ornate hawk
#

So how to can i repare that ?

shy turret
#
            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

earnest phoenix
#

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

vernal willow
#

Servers: <Client>.guilds.size
Users: <Client>.users.size
This is only for cached users and servers iirc

shy turret
#
{ 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

peak bloom
#

where were you hosting before

shy turret
#

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

hot finch
#

Has anyone figured out yet how to set the custom status for a bot ?

earnest phoenix
#

You cant

hot finch
#

Too sad 😦

#

Yet another thing discord is not nice with

earnest phoenix
#

I mean it's not that big of a deal

hot finch
#

But it's a nice thing to have

#

Solving all those weird statuses "Playing type !help for help"

earnest phoenix
#

custom statuses for bots are not a good idea at all

#

it would be massively abused

grizzled jackal
#

Like?

earnest phoenix
#

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

hot finch
#

But but

#

Bots could already set their status under "Playing xxx"

#

._.

earnest phoenix
#

yes

woeful patrol
#

Wdym by “custom”

earnest phoenix
#

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

woeful patrol
#

Well you can but also not 🤔

earnest phoenix
#

what

woeful patrol
#

Let me try to find the code lol

heady snow
#

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?

past flower
#

What's the best timeout for playing statuses? Once every?

earnest phoenix
#

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

blissful scaffold
#

Are you sure Discord does not support custom statusses for bots, or is it just the libraries that don't support it yet?

earnest phoenix
#

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

blissful scaffold
#

im too lazy 😛

woeful patrol
#

Lol

heady snow
#

@earnest phoenix .net

earnest phoenix
#

custom statuses are basically rich presence under the hood

#

@earnest phoenix .net
yes but which lib

past flower
#

That's what I meant 🤦‍♀️ rich presence just changes every x amount of time

summer torrent
blissful scaffold
#

ty @summer torrent

summer torrent
#

np

past flower
#

Yeah sorry i meant rich presence so like streaming blah blah blah

heady snow
woeful patrol
#

"STREAMING"?

#

or doesnt that work anymore

past flower
#

@woeful patrol nah it still works I just wanted to know the best timeout before it changes to another presence

woeful patrol
#

hm

summer torrent
#

@past flower what is your library

blissful scaffold
#

bots can use playing, watching, listening and streaming as their status @woeful patrol

past flower
#

Node

summer torrent
#

discord.js?

past flower
#

Ya

earnest phoenix
#

if you're using discord.net, DiscordSocketClient#Guilds and use Count on it @heady snow

woeful patrol
#

ye

blissful scaffold
#

yes, that is what i said ^^

summer torrent
#
  client.user.setActivity("Blah blah blah", twitch link);
heady snow
#

@earnest phoenix ok thanks

summer torrent
#

@past flower

woeful patrol
#

then what is the problem?

#

never heard of it being timed out

past flower
#

One sec I'll show you guys how I have it set up

blissful scaffold
#

no one was talking about streaming statuses

woeful patrol
#

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

past flower
#

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

woeful patrol
#

ah

blissful scaffold
#

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

past flower
#

After that time it will change the stream name

hot finch
past flower
#

So I was just trying to figure out the best time to set to avoid API limits

heady snow
#

@earnest phoenix And how do i display it on the top gg site?

summer torrent
#

@heady snow what

past flower
#

@blissful scaffold sweet thanks I have it set to 2 minutes so I should be good

earnest phoenix
#

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

heady snow
#

ok thanks again

earnest phoenix
#

i wonder if you can resubmit a better library to the docs

#

because veld's code is just shit

west spoke
#

its veld what do you expect

west raptor
#

@west spoke not the other veld lol

west spoke
#

oh

#

Veld is veld

west raptor
#

well there's

#

ohlookitsveld

#

and

#

then

#

just veld

woeful patrol
#

How do you get roles display in names instead of numbers?

west raptor
#

map the roles

woeful patrol
#

hm

west raptor
#

if d.js

#

(assuming sorry if wrong)

woeful patrol
#

is js yes

earnest phoenix
#

em is it possible to get real time uptime on website where the time is constantly updating?

west raptor
#

wdym?

#

like a RSS feed?

earnest phoenix
#

so like u know the bot has an uptime i wanna try post the bot uptime to the website where it updates real time

west raptor
#

oh

#

hmm

earnest phoenix
#

i tried so many ways

#

but cannot even get the time to show

#

script does not allow = require