#development

1 messages Β· Page 717 of 1

earnest phoenix
#

sadly

west spoke
#

Use http headers

earnest phoenix
#

hm

valid frigate
#

i was gonna say websockets

west raptor
#

I've never done real time stuff so I can't reall help there

blissful scaffold
#

You would have to update the message that displays the uptime

valid frigate
#

but not really

blissful scaffold
#

and probably let your bot poll the site a lot to see if the site is still online

#

or a websocket

quartz kindle
#

Make an endpoint in your bots code and have your website query it every few seconds

#

You can run an offline timer and correct it once in a while, so you dont spam your endpoint

#

Like a heartbeat

flat imp
#

Is there a way to disable Mention everyone for live announcement

#

For couch bot

empty owl
#

hello

#

@flat imp what

loud salmon
#

-wrongserver @flat imp

gilded plankBOT
#

@flat imp

This server is NOT the support server for ANY bot. You need to click on the "Support Server" button on the bot's page, not the "Join Discord" button at the top of DBL.

empty owl
#

hey how do u fully restart a bot

dusky marsh
#

Kill process

#

Start process

#

In that order

empty owl
#

ah

dusky marsh
#

😩 πŸ‘Œ

empty owl
#

:xd:

#

oof

#

havent been on here in a long time

#

bro half of all my server that my bot is in is bot hell

dusky marsh
#

Oh you wanna make it leave servers?

empty owl
#

yea

#

i got the names

dusky marsh
#

Using discord.js?

empty owl
#

yup

vernal willow
#

A guild ID is better for that

empty owl
#

ight

dusky marsh
#

You can filter and loop over the guilds collection

empty owl
#

do i do client.guilds.map(g.id => g) or somthing

vernal willow
#

I think you could put something like this in your ready event:
const guild = client.guilds.get('guildID')
guild.leave();

empty owl
#

ah how would i get the id

dusky marsh
#

If the names of the servers are unique for the ones you want to go leave you can just use the names

empty owl
#

ok

#

also what the reason for the rror somthing took too long to do

sudden geyser
#

"It took too long to connect to Discord" // whatever other weird reason could be

#

api banned can make it say this too

empty owl
#

ah

#

yea

indigo geyser
#
@bot.command(hidden = True)
async def new(ctx, arg1, arg2):

  with open('tag.json', 'r') as f:

    l = json.load(f)

  l[str(arg1)] = arg2 

  with open('tag.json', 'w') as f:

    json.dump(l, f)

  await ctx.send('Done')
```with this it will do {"<arg1>" : "<arg2>"}, how to ```py
{
  "user_id" {
    "arg1": "arg2"
  }
}
```?
#

discord.py

fallow quiver
#

So I got a question

#

How Would I Port A Variable From A HTML

#

Lets Say

#

The Variable is a time

#

So in the html, launched as a webpage, you can choose a time

#

then the bot can get that variable

#

Or in the case I'm using

#
<button onclick="window.alert('Reset Request Sent'); var tagBreach = true;" style="background: rgb(200, 0, 10); color: cornsilk; font-family: Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif;">Click to Request Link change, In Case Of Breach</button>

Then the JS file can read to see if tagBreach is true

west spoke
#

@fallow quiver webhooks.

#

Or store it in the file, and have the bot check every x seconds. (Bad idea)

#

for a change

fallow quiver
#

It's meant to be a password for the mod settings, it can be manually changed if it gets leaked

#

Thanks, I'll look into them

earnest phoenix
#

Do shards output to the main process?

tranquil drum
scenic kelp
#

From the looks of it you could probably throw a few &&s in there

#

or whatever your lang's 'and' is

loud salmon
#

@tranquil drum try throwing things into functions

#

it doesnt change the line count

#

but it makes it easier to read

rose minnow
#

Hey

native narwhal
#

You could do

if(event.getUser().isBot()) {
    return;
}

if(event.isFromType(ChannelType.PRIVATE)) {
    return;
}
...

or

if(event.getUser().isBot()) return;
if(event.isFromType(ChannelType.PRIVATE)) return;
...
pure creek
#

you can also do things like if (xyz) return;

#

instead of nesting everything just break out of the function

#

oh, exactly what joakim said nvm

unkempt moon
#

Those "early returns" are called guard clauses. You should definitely use them πŸ‘

valid frigate
#

yeah yk you could just combine a simple logic gate like if(event.getUser().isBot() | event.isFromType(ChannelType.PRIVATE)) return;

wheat jolt
#

hi

#

i am trying with .playStream but it doesn't play

#

if I try to make it say hello there it says only hello

#

the last words doesn't gets played

jade thistle
#

is it allowed that i make the bot not respond to a specific person?

little hamlet
#

yes

jade thistle
#

perfect

slender thistle
#

So long as it doesn't intervene with the review process if your bot is in the queue

jade thistle
#

nah i will only ignore the one and the only person who gave me a death wish (which backfired immensely) so i don't think it should intervene with the review prozess

solemn plank
#

Quick question, when my bot mentions somebody, (through ${msg.author} or similar methods), sometimes the mention is fine, as you'd expect, @solemn plank, however sometimes its just <@userid192938294>. Anyone know what causes this inconsistent behaviour and how one would fix it?

slender thistle
#

Your Discord cache

quartz kindle
#

that doesnt make sense

#

assuming discord.js, the library automatically caches the message author before firing the message event

late hill
#

^It'll show as <@userid> to any user that doesn't have the mentioned user cached

#

It will still be a valid mention

quartz kindle
#

but if the person was online at that moment, their discord will cache the user because it sees them sending the message

#

unless its someone who was offline and opened discord later

#

and the message is older than what discord preloads when you open it

#

and even then, discord should load user information the moment it loads a message

#

the only real reason i see for it happening is that the user who used the command left the guild

split hazel
#

What's the best way of looking at JS class/objects sizes on core dumps

#

It looks like my bot slowly leaks memory, going from 5gb to around 14gb in 17 hours

quartz kindle
#

how many guilds?

split hazel
#

5.4k

late hill
#

It depends on his use case, it can be really annoying.
An example using one of my bots:

#

It's a recruitment thing for groups on the bot, but most mentions on it look like that because they aren't cached as it's a big server where most people won't be cached

#

All of those users are still in the server

#

I'm most likely going to switch to a different approach as it's very annoying especially for end users that have no idea what's going on when they see that

earnest phoenix
#

how about

#

username#discriminator [mention]

late hill
#

Yeh well if you look

#

That's what I do

earnest phoenix
#

ah

late hill
#

But end users aren't always that smart to realise that

earnest phoenix
#

there's nothing you can really do ig

#

end user has to cache them themselves

late hill
#

Yeh

earnest phoenix
#

usually done by trying to mention the other uncached user

late hill
#

I'm thinking about making it a thing where the one posting the recruitment would get a special role giving them access to send the recruitment message themselves

#

and then remove the role right after they posted

#

If it's their own message, people can just click the name and DM them from there

#

I'd just have less control over the format they use to post it

quartz kindle
#

@split hazel thats way too much ram for only 5k, are you using js?

split hazel
#

yyes

quartz kindle
#

do you have zucc installed (a npm package)?

blissful scaffold
#

I think ram fills up faster from the users than from the servers its in

quartz kindle
#

yes, but guilds are easier to use as a metric than users

split hazel
#

nope we dont

quartz kindle
#

how many users are cached when itas at 5g and when its at 17g?

split hazel
#

at around 5g its at 500k cached for one of the shards

#

it may not be the users

#

its at 10g now and its 570k users cached for one of the shards now

teal stirrup
#

how do i code to make a discord account for a bot or something

quartz kindle
#

@split hazel the 10g is only that shard or all shards?

#

you might have a memory leak thats not related to discord

#

could be something in your own code

split hazel
#

all shards

#

there are 2,903,780 users cached in total

quartz kindle
#

well, how about sweeping those caches?

split hazel
#

i'm not exactly sure which object/class is using most memory is the thing

#

which is why i wanna figure out how to look at js objects in core dumps

quartz kindle
#

did you manage to get a successful dump?

#

open it in a chrome inspector

blissful scaffold
split hazel
#

i wanna try do it inside the ubuntu server, using chrome and downloading the dump is my last resort

quartz kindle
#

you can use remote debugging, but it requires free ram equal do the used ram

#

if you have like 40gb ram its doable

split hazel
#

i should have enough, i'll try that

quartz kindle
#

idk if this one is up to date, but its more or less like that

#

you will probably need an ssh tunnel as well

earnest phoenix
#

Lets assume i use Axios for web request, how could i make a request and pull a image from the website?

quartz kindle
#

is the url of the image not known or dynamically generated?

#

if it isnt, just request the image directly

#

if it is, request the body, and extract the image url from it, then request the image

quasi forge
earnest phoenix
#

Thanks.

quartz kindle
#

@quasi forge i would advise dropping request and using something like node-fetch or got

#

the reason is that request is nearly 5mb big

quasi forge
#

It made life easy lol

#

But sure can do

quartz kindle
#

yes, but there are many alternatives to request

quasi forge
#

Node-fetch is kinda buggy

quartz kindle
#

for example got is very good, and in many points better than request, and it only takes up 300kb

quasi forge
#

I was originally planning to use it

earnest phoenix
#

that lib is vulnerable to csrf attacks

quasi forge
#

Never heard of got tho

quartz kindle
#

check it out on github

quasi forge
#

Yea

quartz kindle
quasi forge
#

@earnest phoenix I would like to know how

earnest phoenix
#

you don't have a state parameter anywhere

#

to anyone's account

#

exposing the user's information

quasi forge
#

@earnest phoenix it's only a library for making the http request, not for making the website, the library user will have to make their own servers

#

@quartz kindle thank you, I will surely move it to got

earnest phoenix
#

as the library dev you should ensure your users are secure

#

forcing them to fiddle with your lib's internals to get lacking protection is a red flag

#

that's a common mistake in oauth implementation which is how idiots leak their email

quasi forge
#

I'll try adding the state as well then.

earnest phoenix
#

also you should probably handle ratelimits

quasi forge
#

Pretty sure the backend devs should be able to handle it but I could make slight modifications

earnest phoenix
#

to avoid users being api banned

quasi forge
#

Yea error handling is currently under development

#

I haven't pushed that to GitHub yet

#

Cuz I was having some issues but that's what I was working on currently.

shadow dust
#

Hey, would anyone using d.js know how to wait only to be logged in when you use Client#login, what I mean is only wait for client information and not for all guilds to be cached. Im on a very slow connection and doing UI stuff, so waiting for all guilds to be cached before being able to display appropriate information is a hassle.

quasi forge
#

The ready event in libraries is fired after the guilds have been cached. I think using partials might also modify this behaviour

quartz kindle
#

@shadow dust you can do that by messing with the raw events

#

i messed around with it before, basically the readycheck in discord js compares if the guilds store size is equal to the total guilds

#

the ready event is not fired until all guilds are cached

#

but you can disable processing of guild packets via disabled events

#

and you can fill the store up with fake guilds

#

another way to speed things up is to set the large threshold to the minimum (50 i believe)

#

this will make discord only send you 50 users per guild, thus making the guild packets faster

#

the first ready packet gives you an array of unavailable guild objects

#

you can use those to fill up the guild store with guild partials and trigger the ready event

#

that still wont help you with shards tho, as discord only accepts one login every 5 seconds

cursive gale
#

hey i'm using process.memoryUsage().heapUsed to find my bot's ram usage and i'm converting it to MB

quartz kindle
#

so if youre making an UI for a sharded bot, it will still take time before it can access all shards

cursive gale
#

and i wan tto make it so that if it's above 1000 then it get's divided by 1000

quartz kindle
#

@cursive gale use rss, not heapUsed

cursive gale
#

rss?

#

what is that?

quartz kindle
#

heapUsed is the actual memory used by the js code
rss is the total memory used by the process

cursive gale
#

so process.rss?

shadow dust
#

I see

quartz kindle
#

the memory usage that your operating system reports is similar to the rss

#

memoryUsage().rss

shadow dust
#

Thanks for the advices @quartz kindle

quartz kindle
#

for example, heapUsage might tell you your bot is using 10mb ram

#

but the full node process its actually using 50-60mb

#

so using rss is more accurate

#

as for the divisions, divide by 1024, not 1000

#

if rss > 1024, divide by 1024 and append "KB", if its still bigger than 1024, divide again, and append "MB" instead

cursive gale
#

ok

quartz kindle
#

thats the basic logic

#

you'll probably also want to use string.toFixed() to limit the number of decimals

cursive gale
#

yes i did that

#

@quartz kindle do you know how to get the the total number of users of my bot?

amber fractal
#

on what lib

quartz kindle
#

@cursive gale to get an accurate number, you need to loop over all guilds and sum their memberCount

#

the best way to do that is to use guilds.reduce()

cursive gale
#

ok

earnest phoenix
#

how

#

to do it

mossy vine
#

its an embed

earnest phoenix
#

how

wheat fern
#

Color : 'RED'

mossy vine
#

you cant do it on a user account

wheat fern
#

You will

mossy vine
#

look into your librarys documentation

earnest phoenix
#

Β―_(ツ)_/Β―

wheat fern
#

Title
That's An Embed

mossy vine
#

@wheat fern its not

earnest phoenix
#

ye

#

but red

#

how

mossy vine
#

stop giving misleading info

wheat fern
#

it's embed

mossy vine
#

embed != blockquote

wheat fern
#

NO

#

it's an embed

mossy vine
#

how did you do it then

earnest phoenix
#

ik dis

mossy vine
#

on a user account

earnest phoenix
#

idk how red

harsh nova
#

you cant

#

you can on a bot acccount**

mossy vine
#

you just cant

earnest phoenix
#

ok

mossy vine
#

blockquote colors cant be changed

#

only embed

harsh nova
#

a normal user account cant make embeds atm without breaking tos. bots can

mossy vine
#

and that is not an embed

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

marble juniper
#
if (command === 'help') {
        const embed = new Discord.RichEmbed()
            .setColor(config.defaultColor)
            .setTitle("Current avaible commands")
            .setDescription('**Prefix:**' + config.prefix + '\n__**Commands:**__\nhelp, leaderboard, daily, slots, work, dice, coinflip, transfer, balance')
            message.channel.send(embed)
    }
#

anyone knows why it returns TypeError: Cannot read property 'length' of undefined

quartz kindle
#

are you sure the error is from there?

#

show the full error

blissful scaffold
#

doesnt look like you use length in that code snippet

marble juniper
#

well I changed prefix in the config maybe thats the error

#

yeah was the code at the start up

#

I didn't change it yet

#

ok problem solved

#

im so stupid sometimes

earnest phoenix
#

me too

humble pendant
#

bro my bot wont start up

sudden geyser
#

is there a reason

humble pendant
#

just pm2 being a big no

#

but

#

β”Œβ”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ id β”‚ name β”‚ mode β”‚ β†Ί β”‚ status β”‚ cpu β”‚ memory β”‚
β”œβ”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 1 β”‚ a β”‚ fork β”‚ 15 β”‚ errored β”‚ 0% β”‚ 0b β”‚
β”‚ 0 β”‚ index β”‚ fork β”‚ 194 β”‚ online β”‚ 0% β”‚ 4.6mb β”‚
β””β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

#

oof

blissful scaffold
#

that is a nice table ^^

humble pendant
#

ikr

late hill
#

is it process a?

#

because

#

If it says errored

#

Maybe check the error log

humble pendant
#

you know what

#

im doing

#

sudo rm -rf /*

#

again

#

jk

late hill
earnest phoenix
#

i wonder if some low iq here actually ran that

humble pendant
#

i did

#

once

earnest phoenix
#

F

sudden geyser
#

again scared

humble pendant
#

ik

#

again

#

i did it before

#

xD

slender thistle
#

I tried it once iirc

#

it gave a confirmation message or something

humble pendant
#

not for me

#

just yeet

earnest phoenix
#

if you sudo it

humble pendant
#

everything gone

earnest phoenix
#

it doesn't

humble pendant
#

now pm2 is being bad boy and not starting up my f****ing bot

slender thistle
#

Oh

#

Guess I rely on root too much sometimes lul

quartz kindle
#

have you actually checked pm2 logs?

humble pendant
#

oh wait

#

its line 34, 38 index.js

earnest phoenix
#

How i can copy any embed with eval??

quartz kindle
#

what?

#

like in an eval command?

earnest phoenix
#

usually in a library a message object will have an embeds collection/array

#

get the first item out of that, you'll have to copy it's properties over to a RichEmbed if using d.js

#

I can't ?

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.

earnest phoenix
#

xd

sage bobcat
#

One message removed from a suspended account.

storm nimbus
earnest phoenix
#

remove msg.author.addRole(uye) and change to msg.member.addRole(uye)

storm nimbus
#

ok 1 minute

#

thanks Δ± am having troΔ±uble with it about 1 hour and 30 minutes

#

whats your bot Δ± want to add it

earnest phoenix
#

πŸ˜„ np (tΓΌrkΓΌm xd)

storm nimbus
#

πŸ˜„

#

teşekkür ederim knk adamsın

earnest phoenix
#

ânemli değil xd

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.

earnest phoenix
#

Δ°nsteresting xd

quartz kindle
#

@sage bobcat how are you reading/loading/running it?

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

quartz kindle
#

how are you reading/loading/running it?

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

quartz kindle
#

show it

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

quartz kindle
#

try console.log(commandfile)

#

before the if (!commandfile)

sage bobcat
#

One message removed from a suspended account.

quartz kindle
#

nothing, or undefined?

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

quartz kindle
#

does it even receive messages then?

sage bobcat
#

One message removed from a suspended account.

quartz kindle
#

console.log(prefix)

sage bobcat
#

One message removed from a suspended account.

quartz kindle
#

on the beginning

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

quartz kindle
#

right after client.on("message")

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.

quartz kindle
#

i noticed it now

#

you have prefix = require("configuration")

#

so prefix is the entire configuration file

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

quartz kindle
#

should probably be prefix = config.prefix

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.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

vernal willow
#

client.aliases = new Discord.Collection();

sage bobcat
#

One message removed from a suspended account.

vernal willow
humble pendant
#

whatever i do

#

i cannot get a embed with my ping command

#

bruh

earnest phoenix
#

Lmao

humble pendant
#

Lmao

earnest phoenix
#

const embed = new Discord.RichEmbed()
.setTitle(client.ping)

humble pendant
#

no

#

too bad

earnest phoenix
#

Thats just the basic

#

2hich return milliseconds

#

You'll have to round it

humble pendant
#
const Discord = require("discord.js")


module.exports.run = async (bot, message, args) => {

    message.channel.send("Pinging...").then(m => {
        let ping = m.createdTimestamp - message.createdTimestamp
        let choices = ["Pong! :ping_pong:", "Pong! :ping_pong:"]
        let response = choices[Math.floor(Math.random() * choices.length)]

        m.edit(`${response}: Bot Latency: \`${ping} ms\`, API Latency: \`${Math.round(bot.ping)} ms\``)
    })

}


module.exports.config = {
    name: "ping",
    description: "ok",
    usage: "!ping",
    accessableby: "Members",
    aliases: ["latency"]
}
#

well

west raptor
#

let choices = ["Pong! πŸ“", "Pong! πŸ“"]

humble pendant
#

ik

west raptor
#

they're the exact same

#

what

humble pendant
#

i cant go without 1

#

ill try

sage bobcat
#

One message removed from a suspended account.

west raptor
#

send code

sage bobcat
#

One message removed from a suspended account.

west raptor
copper cradle
#

you πŸ‘ didn't πŸ‘ define πŸ‘ it

west raptor
#

command file isn't defined in that scope

brisk spruce
amber fractal
#

you showed the code that doesnt help us

#

show how you define the embed

brisk spruce
amber fractal
#

Ah

#

your 2nd to last field

#

uppercase the 'f'

#

I didn't see that at first

sage bobcat
#

One message removed from a suspended account.

blissful scaffold
#

tricky one to find

brisk spruce
#

oouh ok i find it

amber fractal
blissful scaffold
#

that is the kind of code they give you at a test during your study, they upper or lowercase 1 letter and ask what the bug is

brisk spruce
#

thanks @amber fractal

amber fractal
#

define it before you use it

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.

amber fractal
#

you define it after you use it

sage bobcat
#

One message removed from a suspended account.

amber fractal
#

the first usage is commandfile.run(client, message, args);

quartz kindle
#

he put that line there accidentally lol

amber fractal
#

show your new code then

quartz kindle
#

he has to remove it, not define it

amber fractal
#

oh

#

yeah then remove that line

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.

#

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.

amber fractal
#

can you show the code you have now then?

sage bobcat
#

One message removed from a suspended account.

amber fractal
#

does it log anything like ready before it goes unresponsive?

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

cursive gale
#

hey

sage bobcat
#

One message removed from a suspended account.

cursive gale
#

i'm making a server info command

sage bobcat
#

One message removed from a suspended account.

cursive gale
#

how do i get the creation date of a server?

sage bobcat
#

One message removed from a suspended account.

amber fractal
#

that's props I'm guessing

sage bobcat
#

One message removed from a suspended account.

cursive gale
#

ok

amber fractal
#

is that the only command you have at the moment? @sage bobcat

cursive gale
#

got it

sage bobcat
#

One message removed from a suspended account.

quartz kindle
#

actually why do you even have that line at all, if you deal with aliases two lines after it anyway

sage bobcat
#

One message removed from a suspended account.

copper wraith
#

How do I make a bot message refresh every 60 seconds for python?

quartz kindle
#

@sage bobcat .set() cannot be used with only one argument

#

you cant set anything without setting a value for it

#

and you're already doing the exact same thing two lines below

amber fractal
#

It defaults to undefined, it wouldn't cause an error I dont think

quartz kindle
#

does it?

amber fractal
quartz kindle
#

welp alright then

amber fractal
#

but it will take up more memory nonetheless

quartz kindle
#

that line is still useless

copper wraith
#

how would I make a python bot loop and refresh message every 60 sec?

amber fractal
#

I don't know python, but you would want an interval of some kind

#

can't help you with the code around it because i don't know it

blissful scaffold
#

you want some kind of timer, but i also dont know anything about python

slender thistle
#

A task will do

#

or even a loop with async sleep

copper wraith
#

how?

slender thistle
#

I thought you were supposed to know that

earnest phoenix
#

finally running bot on google cloud

brisk spruce
blissful scaffold
#

what error do you get?

brisk spruce
blissful scaffold
#

that's the trace log, what does it say at the top of the error?

brisk spruce
#

for up time robot

blissful scaffold
#

scroll up in your log and show us the first lines of the red text

brisk spruce
blissful scaffold
#

I dont know anything about JS, so you will probably have to wait for someone who can help you with an unhandled promise rejection

brisk spruce
#

oouh ok

blissful scaffold
#

or maybe google can help you

late hill
#

Those aren't the first lines

tranquil drum
#

something through an exception inside an await

late hill
#

the unhandled promise rejections tells you exactly what an unhandled promise rejection is

#

You'll have to show what went wrong up above that

copper cradle
#

^

#

@brisk spruce just show the whole error

#

if you can't do that then why are you coding?

earnest phoenix
#

He's got point, why is it that hard to show the full error

brisk spruce
#

lol

#

to many eror

earnest phoenix
#

have you thought about not using glitch // whatever free host that is

mossy vine
#

that is indeed glitch

dry hedge
#

glitch and heroku = shit

selfhost or buy vps using galaxygate (cheap)

cursive gale
#

how do i get guild emotes?

knotty steeple
#

selfhost is basically free

#

except obviously electric bills but

earnest phoenix
#

it's less reliable

cursive gale
#

welp...

valid frigate
#

lmao people who think selfhosting is genuinely better than a vps

earnest phoenix
#

it depends on your internet connection and you have to account for power outages

valid frigate
#

plus the cost of a server is too much for 99.9% of bot developers

cursive gale
#

uhm

valid frigate
#

physical*

knotty steeple
#

yea i cant buy a vps lul

cursive gale
#

resberry pi is good for hosting

earnest phoenix
#

if anything like that happens at a hosting company they can switch to another server farm

knotty steeple
#

and if i had a server better than my pc id just be

#

eeee

earnest phoenix
#

while selfhosting you're fucked and you have to wait for the issue to be resolved

tranquil drum
#

bro a vps is like $2/month

valid frigate
#

im pretty sure a decent physical server is like 5k or smth

#

dont take my word on this, but if a vps is $2 a month

cursive gale
#

where is it $2? @brisk spruce

knotty steeple
#

and i dont have anywhere to put the server

#

like

cursive gale
#

i can find $5

knotty steeple
#

where to place it lul

valid frigate
#

you could pay off for way longer than you'll be interested in hosting a bot

knotty steeple
#

ovh

#

and galaxygate

#

are really cheap

#

well for ovh idk really but

cursive gale
#

i can't find $2 vps anywhere @tranquil drum

valid frigate
#

if you want beefy storage go for digital ocean

tranquil drum
valid frigate
#

though to be fair when will anyone ever need like 250gb of disk

knotty steeple
#

for a discord bot nah

#

well for most projects at all

#

not really

valid frigate
#

general usage

knotty steeple
#

what general usage do u have on a server

cursive gale
#

is it legit?

tranquil drum
#

you can always use cloud storage if you need more

brisk spruce
#

emm

slender thistle
#

SkySilk offers 50% off for 3 months on their VPS for new users

knotty steeple
#

oh skysilk

valid frigate
#

bruh ss

knotty steeple
#

that

tranquil drum
#

yeah all my services are on it @cursive gale

cursive gale
#

it's your host?

tranquil drum
#

i use them to host my projects

valid frigate
#

i host my file api on the same server as my discord bot lmao

cursive gale
#

ohh

knotty steeple
#

remember it being free until it "oFfIciALLy reLeAsEd"

valid frigate
#

it's common to do that

#

also gettin a vps means you can fuck around with it

knotty steeple
#

ive had like 3

#

vps

#

es

cursive gale
#

awesome $2 vps is not bad

valid frigate
#

i have 2, one for my projects and 1 for a database

knotty steeple
#

not mine but im just hogging of someone else mmLol

slender thistle
#

What's the issue with the "public release"?

knotty steeple
#

nothing

#

xd

slender thistle
#

Beta users get 25% discount yeet

knotty steeple
#

nah that should be 50%

#

kthx

slender thistle
#

You needy boi

knotty steeple
#

oh yes

valid frigate
#

id rather invest in a stable vps company mmLol

cursive gale
knotty steeple
#

wait u have a dedi

cursive gale
#

not me

knotty steeple
#

anyway

cursive gale
#

a kind man gave me

knotty steeple
#

can u just

#

sell it to me

cursive gale
#

lol

knotty steeple
#

for $0

cursive gale
#

you can ask my admin

#

for an account there

knotty steeple
#

lmao ok

tranquil drum
#

nice lol

cursive gale
#

i need like nodes

#

for my hosting company

knotty steeple
#

i wouldnt even know who it is if i really actually had to ask

cursive gale
#

can't find any place that sells 1TB RAM 2-4PB Storage nodes

knotty steeple
#

plus the only thing i have to host is my discord bot which my friend is already doing

#

so

cursive gale
#

hmm maybe try yellowcircle student plan

#

they give 2GB ram for $1

tranquil drum
#

@cursive gale just use cloud storage

cursive gale
#

all tho internet is not very good

#

can someone tell me?

#

@tranquil drum do you know how to get the guild emotes?

tranquil drum
#

use a guild emote with your bot?

restive furnace
#

Does anyone know how to get ws ping and client heartbeart (on d.js)

quartz kindle
#

client.ping?

earnest phoenix
amber fractal
#

you only get 1000 identify's a day iirc

earnest phoenix
#

so how long is the ban?

knotty steeple
#

just reset ur token

earnest phoenix
#

thanks

didn't seem to work though

quartz kindle
#

the ban is 2 hours if im not mistaken

#

but are you sure thats a ban? can be rate limit due to concurrent logins

#

you can only login once every 5 seconds

#

if you're trying to login multiple shards at the same time, you'll get that too

slender thistle
#

wasn't it an hour?

quartz kindle
#

could be, i dont remember

slender thistle
late hill
#

A ban would most likely return something along the lines of forbidden access

ornate hawk
#

Hello !

#

Can you help me ?

earnest phoenix
#

A ban would most likely return something along the lines of forbidden access
no

#

the api ban behaves as a big ratelimit

#

429

ornate hawk
#

So how can i correct tha ?

blissful scaffold
#

I don't know anything about NPM and JS, but it looks like something went wrong while downloading d.js
Maybe try the command again, something might have gone wrong while transmitting the data.

#

Else I also dont know

earnest phoenix
#

they probably fiddled with their package.json file manually

ornate hawk
#

Nop.

cursive gale
#

hey

#

rn i'm using .rss to get the used memory for my bot

#

i wan to get the total memory usage of the bot on all shards combined how would i do that?

#

can anyone help me?

quartz kindle
#

@cursive gale if you're running shards on separate processes, the only way is through ipc

#

discord.js's sharding manager has its own ipc you can use: broadcastEval

#

@ornate hawk you can an error in your package.json file

earnest phoenix
#

Which permission allows the bot to fetch invites?

#
await message.guild.ban(x.id)
});```
if i use this command bot will down :D?
#

what

blissful scaffold
#

Wut

quiet topaz
#

why does it only is executed 3 seconds and than no more : ```js
const Discord = require('discord.js');
const client = new Discord.Client();
const fs = require('fs');

var date = new Date();

var timestamp1 = [ "[" + date.getDate() +"."+ date.getMonth() + "." + date.getFullYear() + "] " +date.getHours() + ':',date.getMinutes() + ' Uhr,',date.getSeconds() + 's,',date.getMilliseconds() + 'ms']
var timestamp = timestamp1.join('')
//console.log("bla",)
console.log2 = console.log;
console.log = function (msgparam){
console.log2(msgparam + " " + timestamp);
};

client.on('ready', () => {
console.log(Logged in as ${client.user.tag}! /**+ timestamp*/);

client.user.setStatus('idle')
});

client.on("message", message => {
if(!message.author.id == "406447103964086282") return;
if(message.content == "!move"){

      let channelsall = Array.from(message.guild.channels);

};

});

#

other bots execute normaly

shadow dust
#

@quartz kindle hey sorry to bother you, you mentioned I could decrease the large threshold per guild Im wondering how I'd achieve such a thing with d.js

cursive gale
#

i tried but it didn't work can i get an example code it really helps @quartz kindle

late hill
#

@quiet topaz assuming that's your entire code, you never login.

#

It's a websocketOption that you add to your clientOptions

shadow dust
#

Yes thank you so much

late hill
quiet topaz
#

@late hill oh, right, i overlookt it 😐

ocean rampart
#

What does Error: Cannot find module β€˜./config.json mean?

earnest phoenix
#

what do you think it means

ocean rampart
#

I don’t know, I’m pretty new to coding. I’ve made my bots file separate from my config.json.

blissful scaffold
#

I dont know js, but my guess is that it can not fine config.json
do i win?

ocean rampart
#

Omg

#

I fixed it

#

By myself.

#

I can’t even believe it.

mossy vine
#

nice

grizzled jackal
#

gratz I suppose XD

woeful patrol
#

How do you overwrite permissions on a role?

split hazel
#

lib?

woeful patrol
#

node.js discord.js

safe pecan
#

Someone can help with an array Client.guilds?

#

I want to get the id list of all guilds, but I don’t understand how to do it

#

Already tried everything

earnest phoenix
#

use map

summer torrent
safe pecan
strong peak
#

Just finished writing my first github project

amber fractal
#

and?

strong peak
#

idk

#

its cool

valid frigate
#

ok i have feedback

#

mostly it's good practice to put event handler functions into their own files

#

especially the message event

#

second

#
// Your Twitch Username (optional)
const USERNAME = "";

this line is present in your code despite something about twitch also being present in your .env file

sudden geyser
#

Putting event handlers into multiple files for such a small bot is a waste of time imo

knotty steeple
#

i have my events in separate files

#

which can make it 3x better

valid frigate
#

putting event handlers into multiple files makes your bot not only easier to scale, it makes reading it easier

#

or you could be a chad and write a 4000 line index.js file since that's what it gets compiled into anyway

haughty mica
#

eeee i need some help

#

i have no clue on how to make a cooldown

#

lol

knotty steeple
#

for?

haughty mica
#

actually I think i may have gotten it to work

sudden geyser
#

Vysion that's the point. If your bot is large and has a lot, an event handler with different files is recommended. However, in my opinion, if your bot is only for a small function (like the one above) and doesn't have many lines, I'd say doing it within your index.js or app.js is fine too.

#

If it's going to be larger, sure. Just don't see it as a recommendation just because it's cleaner

knotty steeple
#

even if it is a small bot i find it just as good practice

sudden geyser
#

it is; I just don't find it necessary (recommendation wise) Shrug

haughty mica
#

h m

#

the cooldown somewhat works

#

but it doesn’t send the message when the cooldown is done

knotty steeple
#

discord-eco :omegalul:

haughty mica
#

without return it sends both the cooldown and normal message

#

any way to fix that?

sudden geyser
#

you're returning regardless. Return if they are in the cooldown

knotty steeple
#

why are u using discord-eco

haughty mica
#

Because.

knotty steeple
#

if you want to make a rpg bot you should know how to use sqlite urself

haughty mica
#

I can use the packages I want to use, lol.

knotty steeple
#

tis unnecessary

haughty mica
#

That’s your opinion.

knotty steeple
#

and adds an extra dependency

#

but ok

haughty mica
#

You make your bot your way, I make my bot my way.

knotty steeple
haughty mica
#

this is what happens when I remove return;

#

It sends both the cooldown and regular message.

#

How can I get that to not send the regular message when the user is set on cooldown?

knotty steeple
#

cuz its just an if

#

to check something

sudden geyser
#

like I said, return if they are in the cooldown. btw your phone's about to die

knotty steeple
#

it will still run code below it

haughty mica
#

yeah i plugged it in

#

Hm...

#

How would I change it then?

#

I’ve been struggling with this command for an hour today lmao.

knotty steeple
#

only return the cooldown

#

also is that talkedRecently just new Set()

haughty mica
#

Mhm.

#

With a ; at the end.

knotty steeple
#

:omegalul:

#

for daily and basically any long period that wont work

sudden geyser
#

how wouldn't it

knotty steeple
#

bot can go down for no reason and it will just reset it

sudden geyser
#

that's the same case for any ratelimit except stored ones (db)

knotty steeple
#

and it might probably uh

#

take up more ram just having settimeout

#

idk

#

lmao

#

probably doesnt but eh

haughty mica
#

Im still confused. MegaThonk

haughty mica
#

bruh

#

what the hell

#

for some reason

#

my commands work on my first server

#

but won’t work on any other servers

tepid osprey
sudden geyser
#

pretty sure that's just for you to come up with

final stone
#

Anyone know any simple image apis that are easy to use? Trying to make a "hug" command which would send a random pic of someone hugging

sudden geyser
#

so you know dbl is sending the request

#

and you might wanna delete the webhook if that's the full id

#

Collier, have you tried Tenor's image API?

knotty steeple
#

u cant delete the webhook

#

you just need to make sure ur auth key isnt shown

final stone
#

I have not looked into it, can you specify like tags on it?

sudden geyser
#

samurai confused

knotty steeple
#

yes

final stone
knotty steeple
#

with css or anything

#

nvm i got it

#
input:focus {
    outline: none;
}
tepid osprey
#

oki

lavish shuttle
#

Hey, so for those of you who do JS stuff, What's the difference between new Function(code)() and eval()

valid frigate
#

they're basically the same

#

however

#

eval() evaluates a string as a JavaScript expression within the current execution scope and can access local variables.

new Function() parses the JavaScript code stored in a string into a function object, which can then be called. It cannot access local variables because the code runs in a separate scope.

https://stackoverflow.com/questions/4599857/are-eval-and-new-function-the-same-thing

#

basically with new Function() you can't access locally declared variables outside new function()

humble pendant
#

i want to make a profile command but i sorta dont know how

lavish shuttle
#

@valid frigate thank you

heavy void
#

Guys how do I prevent crappy music of my music bot?

#

Is there a module?

dusky marsh
#

use lavalink/lavaplayer :P and a good host

heavy void
#

Is lavalink an npm module?

dusky marsh
#

its a java api

heavy void
#

Hw about on js

dusky marsh
#

that you need a client library to connect to

#

discord.js-lavalink

#

is the lib for js

heavy void
#

Ahh kk

#

Lemme try later

cursive gale
#

hey

#

i have a logging system which logs user stuff in a channel

#

i started to make shards for my bot

#

now it gives me errors that it can't find the channel as that shard is not on the server

#

can someone help me?

#

i tried this: ```js
bot.shard.broadcastEval(`
const channel = this.channels.has('${636625617382801418}');
if (channel) {
channel.send('test this works');

}
`)```
but it just dosen't send anymore it's a test code BTW

#

no errors on the console

sick cloud
#

@cursive gale ${636625617382801418}

#

how do you think that'd work

#

drop the template literals

cursive gale
#

ok

#

also i want a shard to send me dms when they start/restart how would i do that? @sick cloud

sick cloud
#

look at the docs and work out the events

cursive gale
#

ok

sick cloud
#

it depends if you're using internal sharding or the sharding manager though

cursive gale
#

i'm using d.js sharding manager

sick cloud
#

then just use the ready/disconnect events

cursive gale
#

ok

#

i got this error

#

@sick cloud

sick cloud
#

no error

#

that's just the bottom of the stack

cursive gale
#

sry wrong error

sick cloud
#

but most likely the .has

#

yeah

#

change it to get

cursive gale
#

ok

sick cloud
#

has returns a boolean, yet you then try to send to it

cursive gale
#

kk i'll try now

#

for testing i'm spawning 20 shards rn

#

so it's taking time

sick cloud
#

you shouldn't

#

that's spamming 20 log in requests every time

#

you'll just reset your token

cursive gale
#

ohh

sick cloud
#

at most 1 or 2

cursive gale
#

ik 4?

#

*ok

#

my friend taunted me and said spawn 50 then so i did does that mean...

#

ohh no

sick cloud
#

you'll probably just have 50 less launches

cursive gale
#

i did that yesterday

#

i've seen bots with 500 shards too

sick cloud
#

yeah and those bots get double the launches

#

discord gives you 1000 launches, bots over 100,000 servers get 2000

cursive gale
#

ohh that's why

#

what if a bot is in 1mil severs?

#

discord will give more launches then?

#

@sick cloud hey i got a new error

sick cloud
#

err doesn't exist anywhere in the function

#

and if you hit that far discord gets more lenient

cursive gale
#

it exists

sick cloud
#

check it doesn't exist elsewhere then

#

try a different name

cursive gale
#

ok

cursive gale
#

new error

sick cloud
#

your token is invalid

#

check your email for a token reset email or just reset the token and use the new one

cursive gale
#

ok

#

new error again

sick cloud
#

again, no error, just the bottom of the stack

#

also stop mentioning me

cursive gale
#

ok sry i somehow got this habit of mentionning people

restive furnace
#

Invalid or Unexpected token = some }{ (; is missing

cursive gale
#

but where?

#

woah cool pfp @restive furnace

restive furnace
#

Im not sure + you could use webhooks instead bot client spamming in the channel. @cursive gale

cursive gale
#

idk how to use weebhooks

restive furnace
#

lemme send u tutorial

cursive gale
#

ok :))

restive furnace
cursive gale
#

ok ty :))

restive furnace
#

np

cursive gale
#

how do i get webhook id?

restive furnace
#

By creating it

#

go to the channel

#

then go to webhooks

#

and then press create new

#

and then u get the id

cursive gale
#

is it the /api/webhoks/number?

restive furnace
#

wait lemme check it

#

yes i think it is it.

cursive gale
#

ok ty

restive furnace
#

nono its token, you can check the id by going it

#

and then copy the "id": "number" @cursive gale

fallow spire
#

How can i make an Prefix like: bot help

restive furnace
#

wdym

sick cloud
#

set your prefix to bot

restive furnace
#

oh u mean like botmention help?

#

just put <@urbotid> as prefix, that should work.

fallow spire
#

@sick cloud well but the space is the big problem

#

@restive furnace nah elsr i would say @botmention

late hill
#

Code your own bot so that'll you understand how the splitting up between command & args works

sick cloud
#

how is it a problem

late hill
#

And there shouldn't be a problem

restive furnace
#

@fallow spire it isnt actually a probelm just put prefix as prefix (space) <<<-- theres space after it.

sick cloud
#

just literally use a space

#

mine is set as yt

fallow spire
#

@sick cloud so in my cfg just

{
prefix: "bot "
}

#

?

cursive gale
#

yes

#

that should work

#

also you should use .env file for storing data instead of a json in my opinion .env is better @fallow spire

restive furnace
#

if you use like glitch.me then it is but if vps it wont change anything

fallow spire
valid frigate
#

lmao tony

fallow spire
#

@cursive gale well how do i point to that file

valid frigate
#

you wont like my code at all

#

i have spaced prefies as well but

sick cloud
#

ok

fallow spire
#

ur eris @Vysion#3272

valid frigate
#

dont be like me

fallow spire
#

meh

restive furnace
#

i just would use @botname as another prefix and space.

cursive gale
#

omg you serious @valid frigate you use that?

valid frigate
#

i am very gay

sick cloud
#

i just use startsWith

valid frigate
#

but most of the time you dont need to use spaced prefixes

sick cloud
#

nothing crazy

fallow spire
#

@sick cloud Your Eris aswell

cursive gale
#

lol thaaaaaat can be written in 1 line kinda

restive furnace
#

i too use startsWith hehe

fallow spire
#

@restive furnace well show xd

cursive gale
#

i use a command handler

fallow spire
#

same @cursive gale

restive furnace
#

me too who wouldnt?

cursive gale
#

ikr

sick cloud
#

@fallow spire what

restive furnace
#

anyone who want main file being 1gb, maybe?

fallow spire
#

Arent u Eris?

#

@sick cloud

sick cloud
#

wdym

fallow spire
#

@restive furnace Sureeee

valid frigate
#

august looks at me with a funny face

restive furnace
#

i use d.js

valid frigate
#

i use d.js

sick cloud
#

i use both

fallow spire
#

@restive furnace same

valid frigate
#

go eris

cursive gale
#

i'm d.js too

fallow spire
#

@sick cloud Thats pretty gay

valid frigate
#

well to be fair

sick cloud
#

lol

valid frigate
#

i wrote a cluster library in eris

restive furnace
#

eris = harder ver of d.js?

fallow spire
#

Yep

valid frigate
#

eris has less utilities

sick cloud
#

eris is just another library

#

but yeah

valid frigate
#

if you want performance then eris

sick cloud
#

less clutter

#

and less caching

valid frigate
#

djs is beginner friendly

fallow spire
#

WELL, HOW CAN I MAKE THAT NOW

cursive gale
#

calm down

valid frigate
#

an eris rewrite doesnt take too long

sick cloud
#

i use my own library sometimes but it's not done

valid frigate
#

a cluster lib?

sick cloud
#

no like

cursive gale
#

i have to travel 12 hrs in car in an hr

sick cloud
#

a whole lib

#

like i made my own sort of eris

cursive gale
#

awesome sounds cool

valid frigate
#

eris is already good under the hood

#

admittedly some modifications

cursive gale
#

where can i signup? @sick cloud

sick cloud
#

it's not done

#

but its on github

cursive gale
#

ok

valid frigate
#

it's free real estate

fallow spire
#

(node:3849) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 ready listeners added. Use emitter.setMaxListeners() to increase limit

Where i put .setMaxListeners()

valid frigate
#

are you

#

what the fuck lmao

sick cloud
#

event within event i bet

cursive gale
#

tf's that

restive furnace
#

i will rewrite to eris when i added basic cmds first.

valid frigate
#

you attached 11 ready event listeners

cursive gale
#

OMG

fallow spire
#

how what tf

cursive gale
#

teach me @fallow spire

valid frigate
#

i laughed

restive furnace
#

tf 10 ready listeners who need em?

earnest phoenix
#

gucci gang

fallow spire
#

I only have 2 xD

valid frigate
#

psst uber

earnest phoenix
#

?

restive furnace
#

just use 1

valid frigate
#

do you think djs or eris is better

#

honestly

#

performance-wise

cursive gale
#

it's just opinion wise

fallow spire
#

Well But WHERE TF ARE THESE 10 READY 'S

sick cloud
#

i like eris but if you do it right djs works just as well

cursive gale
#

nothing is better

valid frigate
#

nothing is better

cursive gale
#

it's just what people prefer

valid frigate
#

that's an opinion

#

boi

cursive gale
#

lol

earnest phoenix
#

well thats a heated debate, djs is honestly better if you take advantage of all the QOA and stuff it provides, but if you dont absolutely need it, eris is pretty much just djs with some useless stuff removed leading to less overhead

sick cloud
#

my library doesn't cache anything so, it > *

earnest phoenix
#

so its sorta specific usecase

#

miles is making us a really cool custom library though

#

for them hyper performance

#

and automatic scalability

restive furnace
#

whaaaa anything

valid frigate
#

(remove caching when)

sick cloud
#

who needs caching

cursive gale