#development

1 messages · Page 960 of 1

still merlin
#

I was in the middle of making a set log command and I had the actual set log part but set.serverlogchannel is undefined, What would i put instead or how do I define it (I'm still learning js)

earnest phoenix
#

i just realized it wasnt my token

#

but why would you do that @next escarp

lyric mountain
#

n-GnxFS1yZEZ2vSOaqXDkk-ppvp8MTU5MTQ2MzY1MkAxNTkxMzc3MjUy
@next escarp that's no token dude, discord tokens have 3 sections

mossy vine
#

to prove a "point"

lyric mountain
#

that's literally something in youtube's html

next escarp
#

I didnt do anything

earnest phoenix
#

but either way you wouldn't put my "token" publicly unless you either wanted people to use it or you wanted to scare me bruh

next escarp
#

why doesn't it work again

lyric mountain
#

don't worry zen, he just mistakenly minimodded u

next escarp
#

yeah

#

sorry

lyric mountain
#

still

#

using youtube's api would be easier

next escarp
#

yeah

lyric mountain
#

BUT, if you really want to scrap the site, you'll need some regex

earnest phoenix
#

i dont know youtubes api and i already coded it this way and i am too lazy to change it

next escarp
#

idk what i did

earnest phoenix
#

idk javascript well but you could have just defined the embed weirdly

next escarp
#

how?

#

It doesn't even log the error

earnest phoenix
#

oh i know whats wrong

still merlin
#

try return message.channel.send(serverembed);

next escarp
#

ok

earnest phoenix
#
const Embed = new Discord.MessageEmbed()
     // ADD AN INDENT
     .blahblah() something balh blah javascript
#

then do message.channel.send

mossy vine
#

what

lyric mountain
#

indent?

#

that's no python lol

mossy vine
#

zen r u ok

earnest phoenix
#

no lol

mossy vine
#

first trying to scrape yt now this

#

im worried

earnest phoenix
#

but i know he doesnt use a { or } anywhere so he would probably need to indent it to show that its part of the last line

next escarp
#

doenst work

earnest phoenix
#

or atleast i think thats how code works

mossy vine
#

what

lyric mountain
#

nope

next escarp
#

who knows?

lyric mountain
#

you can write javascript entirely in one line

next escarp
#

yea

#

but, not recommended

lyric mountain
#

only python uses indentation for code syntax afaik

earnest phoenix
lyric mountain
#

because that's common sense

#

it makes the code more readable

earnest phoenix
#

oh

next escarp
#

it says channed.send

earnest phoenix
#

im too stupid to help imma be on my way

spice smelt
#

hey! i'm trying to use google's translation API, but there is a required field that I don't understand... it's the parent field. i've alredy tried projects/:my project id but it doesn't work.

mossy vine
#

hmm yeah that should be correct. what do you get as response?

lyric mountain
#

I'd not recommend using google translation api

spice smelt
#

well i'm really sorry, it looks like the error was cached or smth x) it works now

#

@lyric mountain why?

lyric mountain
#

the quota will stop your bot from making further requests

#

gtanslate api's free plan has a VERY low quota

topaz fjord
#

api key rotation mmLol

lyric mountain
#

I like the way you think boi

topaz fjord
#

but then you'll probably get ip/account banned if you piss them off

#

that's not enough context

#

I can't tell anything from that snippet

spice smelt
#

@lyric mountain do you have any recommendation to replace gtranslate?

lyric mountain
#

I'd recommend yandex api, their translator is quite good for a free service

#

I use it for my bot

spice smelt
#

ok, ill try it, thanks

earnest phoenix
#

what the

#

my guy

#

wtf

#

you cant kick ppl

#

and you cant kick ppl over any bot here anyways

#

i dont care you still pinged me a bunchof times

#

because it makes a (DUH DO) sound

#

its annoying

#

Which is the best free discord bot hosting service? I want to host it on a free one before it will be finished, then i'll buy a vps 🙂

digital ibex
#

depends

next escarp
#

how do i make a bot ping cmd that shows the ping

earnest phoenix
#

In your opinion, what whould you choose?

next escarp
#

?

digital ibex
#

its free & good

earnest phoenix
#

Ok, thank you

#
#

?

lyric mountain
#

In your opinion, what whould you choose?
@earnest phoenix if it's just for testing purposes: glitch, heroku or google cloud will do

topaz fjord
#

there is no best "free" hosting provider

#

there is only "free" hosting providers

lyric mountain
#

yeah, each one have its drawbacks

#

but as I said, if it's just for testing then it's ok

#

you don't need THAT performance nor reliability for that

pale vessel
#

google cloud ssh is really good if you only need to test stuff

#

and it's free too

lyric mountain
#

i'll give it a look later, guess I'll migrate my api to it

digital ibex
#

anyone got any idea why my discord oauth2 loads for around 15 minutes when using a different mongoose model? the models are exactly the same, the only thing i change for me to make it load for ages, is change the path of the model

#

and when it eventually does load, i get an error: InternalOAuthError: Failed to fetch user's guilds

still merlin
#

I was in the middle of making a set log command and I had the actual set log part but set.serverlogchannel is undefined, What would i put instead or how do I define it (I'm still learning js)

stable grail
#

can anyone help me about python?

#

my level system levels bots

#

but i dont want it to level bots

#

i tried already 20 minutes to solve that problem

lyric mountain
#

if user.bot: return

#

something like that

stable grail
#

hmm

lyric mountain
#

note that idk very much about python

stable grail
#

where should i put that

#

bcs it would mess up the lines

lyric mountain
#

just check if the user is a bot, if it is then break the code

stable grail
#

ah ok

lyric mountain
#

first line in the onMessage event

stable grail
#

user is not definied

lyric mountain
#

ik

#

that was an example

stable grail
#

async def on_message(self, message):

lyric mountain
#

not a copypaste-ready code

#

get the author from the message

#

it should have a bot attribute

calm lantern
#

A main downside from glitch is that you might need to replace your token almost every time, even with a watcher script.

#

wich sucks.

misty sigil
#

im trying to use snekfetch to use api but the code will not run

#

it's indicating no sign of error, just not running

#

like it just BREAKS, no code after it is getting ran, and the program doesn't stop

#

here's the code

#
const {get} = require("snekfetch");
const Discord = require("discord.js");

exports.run = (client, message, args) => {
let animal = args[0]
console.log(animal)
if(animal === 'dog'){
console.log(animal)
    get('https://some-random-api.ml/facts/dog').then(res => { // BREAKS HERE
    console.log('got')
       var randomColor = Math.floor(Math.random()*16777215).toString(16); // randomizes colour again
       console.log('randomized')
        const dogEmbed = new Discord.MessageEmbed()//creates embed
       .setAuthor('Dog Module')
       .setFooter('Dog provided by animal-bot (built and hosted by the Animal Bot team)') //sets footer to this text
       .setTitle("🐕Here's your random dog🐕") //the main message
       .setColor('#' + randomColor) // sets the colour to the random colour
       .setDescription(res.body.fact)
       console.log('embed done')
     return message.channel.send(dogEmbed); //sends the embed
     console.log('sent')
    });
}}```
split hazel
misty sigil
#

i will try that

still merlin
#

i've asked this question loads, can someone please answer!
I was in the middle of making a set log command and I had the actual set log part but set.serverlogchannel is undefined, What would i put instead or how do I define it (I'm still learning js)

misty sigil
#

you'd need to make it a constant or smthing

#
const channel = message.channel.id```
#

something similar to this

still merlin
#

how is that gonna set my channel to set the log channel

misty sigil
#

that stores the log channel id AFAIK

#

then you can set that

still merlin
misty sigil
#

idk actually

#

wait let me customise the const

const serverlogchannel = message.channel.id
``` and that'd go under the command listener
still merlin
#

right so ```client.on("message", (message) => {
let args = message.content.substring(prefix.length).split(" ");
const serverlogchannel = message.channel.id

switch (args[0]) {
case "setlogchannel":```

misty sigil
#

that sets the log channel to the channel the message was sent from

granite perch
#

Hey guys, how can i add link to the embed title just like this picture using js?

still merlin
#

ok tysm!

misty sigil
#

.setURL('url here') it might be this @granite perch

granite perch
#

.setURL('url here') it might be this @granite perch
@misty sigil it works thank you

misty sigil
#

🙂

#

you got any experience with node-fetch?

granite perch
#

yes i'm using it on my current project

misty sigil
#

what for?

granite perch
#

for fetching data from a graphql api

misty sigil
#

i need to fetch data from an api too

#

cant work it out tho

digital ibex
#

its a returns promise

granite perch
#

what is the problem ?

digital ibex
#

resolve it

granite perch
#

yes you have to resolve the promise

misty sigil
#

ah, thats fine

granite perch
uncut iron
#
    const args = message.content.substring(prefix.length).split(" ");```
#

anyone know what that means

misty sigil
#

yea

uncut iron
#

im attempting to change the prefix from / to the bot's name and its working but they both register as prefix's and i want it to be just the 1

misty sigil
#

now that, i have no idea

uncut iron
#

but what does that const up there

misty sigil
#

it tells you what the arguments are

uncut iron
#

whats prefix.length

misty sigil
#

if you have ```js
const prefix = 'prefix'

#

so in that case its 6

uncut iron
#

hm

#

ok ill keep looking

#

everytime i do /help and glitch help

#

both times

#

it works

#

for either prefix

#

and i cant figure out why

#

ive went through the main files and made sure that where it said / i replaced it with glitch

wet iron
#

<@&304313580025544704> Can someone change my name to Beaster888 cause Sklitl was my past name and it stayed when I got my bot approved.

modern sable
#

-atmods

gilded plankBOT
#

Please do not mention (ping) more than one or two moderators for help, unless there is an emergency.

Here are some examples of emergencies:

  • Raids / Multiple members mass spamming.
  • Severe disruption of Discord's ToS (NSFW content, etc)
  • Anything that requires more than 2 moderators to handle.
uncut iron
#

wooow

#

i pinged the entire role

#

what an idiot

halcyon ember
#

i have this

#
            userscore = client.getScore.get(user.id)
            const args = message.content.slice(prefix.length).split(/ +/)
            const detail = args.shift().toLowerCase()
            if (detail[1] === 'test') {```
#

where its trying to get user arguments but I dont know why it only shows the command

uncut iron
#

the user args as in what

#

who the sender is?

#

no idea man

halcyon ember
#

its supposed to be ran as ?shop buy item

uncut iron
#

idk man

halcyon ember
#

and I want to keep it one command

uncut iron
#

yeah

#
    runCheck: function(guild) {
        const currentMembersPeak = guilds[guild.id].members
        const currentOnlinesPeak = guilds[guild.id].onlines

        const currentMembers = guild.members.cache.filter(member => !member.user.bot)
        const currentOnlines = currentMembers.filter(member => member.presence.status != "offline")```
#

im trying to figure that out

#

says on line 3

#

that

#

members is undefined

#

cant read property type of members undefined

#

and ive never had this issue in this file before

#

and ive never made changes to this file before

earnest phoenix
#

is there a way, in python, to turn an emoji in unicode to the discord string (so like 👍 -> thumbsup) and back?

#

i don't wanna manually make a dictionnary either

lyric mountain
#

discord accepts unicode emojis as input

#

no need to convert to readable string

earnest phoenix
#

i have reasons, my text file converts the emojis into utf8 and then its a hellhole to get em out in a usable fashion, better to have a way to turn them into and back out of a string or sthg

#

i could use ascii character ids tho

#

ill try that

amber fractal
#

@earnest phoenix will that help?

earnest phoenix
#

well the id thing worked so i guess im good

#

ill have to get custom emoji implementation now

#

but anyways thanks for trying :D

#

*for your time

amber fractal
#

lmao it was just a url map I've used in the past

digital ibex
#

you've been told so many times to learn python

#

so please, just learn it

#

ik u r, cuz idk python

earnest phoenix
#

Calmdown bro

shy turret
#

I kinda know python

digital ibex
#

im learning python, starting to like it mmLol

shy turret
#

ctx.send(f"**

#

What's that "f" for

quartz kindle
#

f strings

#

similar to string templating i think

shy turret
#

Python makes no sense to me lol

quartz kindle
#

one of python's many ways of building strings

shy turret
#

@earnest phoenix
How does it not work?

#

Like you should explain more

digital ibex
#

i think its when u r gonna have variables in the string, so like ```py
ctx.send('{member.created_at}') # will return {message.member.username}
ctx.send(f'{member.created_at}') # will return OfficallyLost

#

not wait

#

no

modest maple
#

create_at is a time stamp no?

digital ibex
#

im dumb

shy turret
#

Same

digital ibex
#

yeah. idk why i had created_at and username

shy turret
#

Debugging exists

green kestrel
#

@still merlin I have no idea what the code is, you censored too much

amber fractal
#

What's the error?

still merlin
#

} expected

#

but i put one at the end

amber fractal
#

you didnt close the arrow function

still merlin
#

nevermind i fixed it

green kestrel
#

Between before and now you close and reopen the back ticks

#

Was that the problem you fixed?

amber fractal
#

Oh I didn't even see that lmao

still merlin
#

yeah i realised i forgot to add brackets to the end and a }

sterile minnow
#

does anyone know how i request a oage and change the result to json like with a API?

[axios used in js]

wet iron
#

I have a problem

#

With my bot

#

Im trying to make it play music

#

in a channel

#

but it joins

#

it shows that green circle

#

and you cant hear anything

astral yoke
#

code

ancient lichen
#

Im trying to make it play music
@wet iron little bit generic but ok

midnight blaze
#

message.react(':thinking:').then(console.log).catch(console.error);
quick question, how can I react on a specific message id?

earnest phoenix
#

🤔

#

like this

#

dont put it, just put the original emoji if you just use discord's emojis.

#

So as i have a bot made from discord.js... and saw that the discord.py can access to user's nitro info to show it on my userinfo command... Is it even possible to like use both the libraries... Like discord.js being the whole bot as main... But using discord.py at the other hand to check that info and use it on my userinfo command?

digital ibex
#

wym users nitro info?

earnest phoenix
#

like... If the user has the nitro badges and stuff

midnight blaze
#

@earnest phoenix ? I want to react on an old message

#

I dont have a problem with the emoji

earnest phoenix
#

oh,sorry.

digital ibex
#

YOU CAN CHECK MEMBER.PREMIUMsINCE AND IF ITS NULL THEN THEY DON'T, OTHERWISE, THEY HAVE NITRO

#

uh

#

sorry

earnest phoenix
#

No not that

digital ibex
#

caps

earnest phoenix
digital ibex
#

kk

mystic violet
#

https://hastebin.com/doxuqufivi.js

On line 20: info is equal to

  access_token: 'cv...',
  expires_in: 604800,
  refresh_token: '7k...',
  scope: 'identify guilds',
  token_type: 'Bearer'
}```

/users/@me/guilds is returning unauthorized for some reason
#

any idea why?

earnest phoenix
#
// in msg event
const active = new Map();
const options = { active: active };
await cmd.run(bot, msg, args, options);

// in play command
module.exports.run = async (bot, msg, args, ops) => {
const data = ops.active.get(msg.guild.id) || {};
// ..
ops.active.set(msg.guild.id, data);

Problem is is that there is never data

mystic violet
#

idk why you need to push through bot and msg

#

use msg.client

earnest phoenix
#

where do I need to use msg.client?

mystic violet
#

its not related to your issue its just an enhancement

earnest phoenix
#

oke

#

I use bot, msg, args for the rest of the code

midnight blaze
#

hmm, I tried this, but it didnt work

message.channel.fetchMessage("570646739145457685").then(message.react(emotes[0]).then(console.log))```
error:
```console
TypeError: message.channel.fetchMessage is not a function```
![thinKappa](https://cdn.discordapp.com/emojis/275103065235914752.webp?size=128 "thinKappa")
earnest phoenix
#

message.channel.messages.fetch()

midnight blaze
#

thanks

#

hmm, still not working

#

message.channel.messages.fetch("570646739145457685").then(message.react(emotes[0]).then(console.log))

earnest phoenix
#

any error?

midnight blaze
#

nope

earnest phoenix
#

@midnight blaze here
message.channel.messages.fetch("570646739145457685").then(message => message.react(emotes[0])).then(mr => console.log(mr))

midnight blaze
#

thanksxD

digital ibex
#

@earnest phoenix can't find anything about it, unsure. sorry about that

earnest phoenix
#

It's ok

digital ibex
#

i'd use async/await instead of callbacks pangloss

earnest phoenix
#

I mean it's the same thing but sometimes .then() doesn't work on some functions

#

So yea some functions doesn't work with .then(), use async/await

leaden flame
#

Ok, so I'm using json to keep my ticket bot's data.

JSON code:

{"ticket-counter": 0, "valid-roles": [], "pinged-roles": [], "ticket-channel-ids": [], "verified-roles": []}

Even if the bot is on 6 servers, and there is 1 ticket on one server, for the other server it'll be ticket-2.
How would I make it so that every server it joins, it adds the server id and resets it to 0 for that server?

vernal rivet
#

i mean, idk if using json is a good idea to use for heavy data on a bot that can grow. if you want to use json structures, then i suggest looking into using quick.db

#

json is more for lightweight data, such as holding credentials, or data, that hardly ever needs to change, and is small. SQLite and MySQL is better for heavy data, such as database data, or data that changes a lot, or needs to handle a lot of data.

tropic moss
#

hey!

#

I'm working on a discord bot

#

using an attachment system

#

what is a proxy url? I can't find anything about it on google

#

@earnest phoenix do you know anything about this, you were helping some people

midnight blaze
#

rip, I just wanted to ask him as well

tropic moss
#

?

digital ibex
#

~~ look at my status please ~~

earnest phoenix
#

@tropic moss proxy url is a url that if the image doesn't have an actual image extension... It will show the image anyway

tropic moss
#

it's not an image

#

text file

#

how can I process that?

earnest phoenix
#

Proxy url is useless with text file extensions

tropic moss
#

aa

#

how do I read text files?

digital ibex
#

same way you would with any other file ig

tropic moss
#

nono like from an attachment

#

all I have are the urls

midnight blaze
#

@earnest phoenix can I ask you again something about the command you have written?

earnest phoenix
#

Yea

tropic moss
#

uh

#

no

#

@ember atlas

#

cookie logger

#

oml

#

@modern sable

midnight blaze
#

@earnest phoenix the command you have written, I have wainted to make a for loop, so each of the emojis get reacted

#

something like this

for(i=0;i<5;i++){p++;message.channel.messages.fetch("718591041149861888").then(message => message.react(emotes[p])).then(mr => console.log(mr))}
#

but only 1 emoji reacts

modern sable
#

ty

earnest phoenix
#

Can't you just do a forEach() ?

tropic moss
#

lol

#

I like their attempt on obfuscation

midnight blaze
#

where should I add the forEach() function? :>

earnest phoenix
#

Wait forEach() would not work but i have no idea how to make that thing work

#

Lol

midnight blaze
#

but it should work right?

#

I dont see why it shouldnt work :>

digital ibex
#

just like

#
message.channel.messages.fetch("718591041149861888").then(async(e) => {
await e.react('emote');
await e.react('emote 2');
});```
#

i believe that should work

quartz kindle
#

when looping with promises always use async/await syntax unless you purposefully want to execute them concurrently and dont care about their order

mystic violet
#

How do you get a guild icon with oauth2 icon property?

icon: 'fab0d3bd981d3b6a00da3a9ca2dc044b',```
#

I forget the url

quartz kindle
stark abyss
#

i am making discord js bot and certain commands get delayed until next command is run. I don't understand why or how. ping me

uncut iron
#

idk either mate

#

alright so basically i want my prefix to be * and i dont want it to accidentally format the text, so how do i force it to not format the text, do i just add a backslash before it?

#

yeah lol

#

i did try and so far its working just fine

#

thanks mihzo

#

i got no clue ben, i'd love to help but i got no idea

#

ive never seen code that looks like that before

amber fractal
#

Raspian is linux isnt it?

#

just download it like you would on any other linux distro

unique nimbus
#

Raspbian is Linux

#

It is a Debian based Distro if I remember correctly

#

RUN AS ROOT

curl -sL https://deb.nodesource.com/setup_14.x | bash -
sudo apt-get install -y nodejs
#

@earnest phoenix

midnight blaze
#

@digital ibex thanks for your help

quartz kindle
#

thats kinda going the long way lul

digital ibex
#

np

tired nimbus
#

how can I determine if the bot can send a DM to an user?

earnest phoenix
#

hi

steel drum
#

@tired nimbus you can just try to send the message and if it fails (for ex: theres a promise rejection) then handle it accordingly

#

you dont HAVE to check if your bot is able to dm a user before trying it, as long as you have corresponding error-handling

tired nimbus
#

I already tried and catched and it still retruns an error

earnest phoenix
#

.catch()?

steel drum
#

what exactly are you trying and catching ?

tired nimbus
#

the send

earnest phoenix
#

use send(...).catch(err => {})

tired nimbus
#

I did

earnest phoenix
#

wrap it in try {} catch(e) {} if that doesnt work?

tired nimbus
#

I did it still returns an error

steel drum
#

if you're gonna use try catch you might as well use async / await

earnest phoenix
#

you have another error then...

steel drum
#

@tired nimbus what exactly is the error?

earnest phoenix
#

lmao

tired nimbus
#

DiscordAPIError: Cannot send messages to this user

#

I think its a different error

#

or somewhere else

steel drum
#
let user = await Bot.users.fetch(vote.user);
if (user) try {
      let dms = await user.createDM();
      return await dms.send(`too long`);
  } catch (e) {
      return;
  }
#

this is how i sent users

#

it doesnt produce an error when i block the bot

earnest phoenix
#

oh god

#

lmao

steel drum
#

this was pulled from my top.gg webhook part of my bot, but im sure w some modification you could make use of it

mystic violet
#

my lavalink node is giving me this.. any way I can resolve this? js [20:34:31] [lava-daemon-pool-playback-1-thread-1/ERROR] [LocalAudioTrackExecutor]: Error in playback of r7Ve8ExE8YY

dusky marsh
#

Can you not disable certain events anymore in v12?

uncut iron
#

my bot sends 3 embeds for every command, no idea why lol, someone help me figure it out?

#

idk canarado

#

im pretty sure u can

summer torrent
#

Can you not disable certain events anymore in v12?
@dusky marsh it is removed in v12 iirc

uncut iron
#

ah

#

rip

#

how tf do i fix my bot responding 3 times

#

lol

summer torrent
#

regenerate token

uncut iron
#

oh

#

good idea

grizzled raven
#

censoring your bot's prefix?

#

well okay understandable

earnest phoenix
#

Anyone need some help with d.py?

#

How do I fetch a user using eris sharder?

shrewd prairie
#

hi

lyric mountain
#

So

#

What is bottlenecking your bot?

#

Like, how have you noticed that the vps can't handle it anymore?

shrewd prairie
#

well it used to run fine but now its in a lot of servers it cant anymore

#

like i start it up and it flickers on and offline

#

doesnt even finish its on_ready event

lyric mountain
#

Any error in the log?

#

Also, what vps?

#

@earnest phoenix no dotpost

shrewd prairie
#

no no errors show up

lyric mountain
#

Use esc to clear message notifications

shrewd prairie
#

i use a2hosting

#

centos server, like 500mb of ram

lyric mountain
#

Still

#

You shouldn't be having issue with only 100 servers

#

@earnest phoenix shiro

#

Maybe it's some issue with your code

#

When did that start to happen?

shrewd prairie
#

i mean maybe but all my other server bots run fine, and the bot in question runs fine from my home computa

lyric mountain
#

Do you use in-memory data storage?

shrewd prairie
#

that could explain it but i have no idea what could cause that, other than some strange memory leak

#

which i dont think could be possible

#

ok im gonna try running like a hello world bot on the token and see what happens

lyric mountain
#

Storing lots of data inside variables is a probable memory issue

#

It can drastically increase your bot's memory footprint

#

I'd check this kind of thing first, since moving to another vps will just act as a placebo to the real issue

shrewd prairie
#

yeah

#

ok ok check this out

#

this is what i thought would happen

#

like as barebones as possible

#

it cannot run this on that token

lyric mountain
#

Maybe it's something to do with the token

#

Try refreshing it

shrewd prairie
#

oh i forgot thats a thing

#

ill test

#

refreshed token, same issue

lethal hawk
#

You might have hit an api rate limit. It's rare, but it occurred to me once. Turn the bot of for 24h and look if it works again.

(Workaround to test if this it the problem: register a new bot at discord.com and put that token in your bots' code.

#

@shrewd prairie

shrewd prairie
#

registered new bot, yeah that runs fine on that token

#

im not really convinced thats the issue, the bots been down for a while due to me not wanting to deal with it

lethal hawk
#

Then it is you bot that is being rate limited.
If you are convinced it is not a rate limit, I suggests you fill out a suport form on discord.com to see what's going on.

shrewd prairie
#

yes

#

wait it cant be a rate limit!

#

bot runs fine when i run it from windows pc

lethal hawk
#

Ok, recap.
It doesn't work on vps with token 1, but it does work with token 2.
On pc it works with both.
Is that correct?

shrewd prairie
#

yes

lethal hawk
#

Is the latest version of python installed on the vps?

#

And did you try without using async functions yet?

#

async doesn't always throw an error

shrewd prairie
#

no, same version as windows pc (3.6.8)
no, i dont know how

lethal hawk
#

Just remove every async and await should do that

shrewd prairie
#

i may have just figured out the issue..

#

i physically do not have that much memory

lethal hawk
#

might not work. I'm more of a js guy

#

Wdym?

shrewd prairie
#

i have 500mb

#

checked how much i was using

#

a lot

#

its not that i have leaks anywhere i just. do not have that much memory to run a lot of things

lethal hawk
#

You used more thatn 500mb for that hello world thing?

shrewd prairie
#

no i run other bots on it

lethal hawk
#

Oh, I see

shrewd prairie
#

but apparently the hello world bot tipped it over

#

ah gee

#

guess ill optimize my other bots lol

lethal hawk
#

Memory leaks are never a good thing. Even with little usage/users, it will crash over time

shrewd prairie
#

i cannot believe it took this long to figure out omg

lethal hawk
#

Np :)

shrewd prairie
#

thanks for the help i appreciate it

#

made it way easier to narrow down

brittle mica
#

oof

rotund yarrow
#

can someone help me with creating a backdoor to my bot

#

i need admin only commands to work for me even if im not admin

#

someone please

oak cliff
#

that doesnt look like bot development.

zenith crescent
#

at!info

#

oh bots don't have perms here

slender thistle
#

-botcommands

gilded plankBOT
#

Hey! Bots aren't given permissions to send responses in this channel. Please use #commands or #265156322012561408 to run commands. In addition, bots with commonly used prefixes cannot read or send messages in any channel. This is done to prevent spam and bot abuse.

zenith crescent
#

ah

#

thanks

grizzled raven
#

anything wrong with ending something with ```js
return await promise()
// instead of
return promise()

dusky marsh
#

return await returns the resolve value of the promise if there is one, return just returns the promise

vale garden
#

i wanted to ask what this means

dusky marsh
#

are you asking what Promise { pending } means?

vale garden
#

no what the entire error means

#

previously it was an if err throw err

#

but it still refers to that line

#

i just dont understand what it means

cosmic girder
#

How do you see the amount of members online

#

Ex

Users Idle : 3000
Users DND : 5000
Users Offline : 50000
vale garden
#

someone help me

pale vessel
#

probably is not a constructor

#

did you recently upgrade or something

vale garden
#

oof

#

no i didnt

#

it cuts after the n idk

pale vessel
#

i was asking Ben, sorry

#

oh

#

i got a little confused

vale garden
#

@proven lantern

#

um

#

idk

#

my friend did this

#

its a part of his sql database

#

which i know nothing of

astral yoke
#

learn d.js before making a bot and taking people’s codes 🙈

vale garden
#

he made the sql

#

lol

strong tundra
#

is there a const con = or let con = somewhere

torn ravine
#

I wanna use my db a little more

#

by adding a toggle setting to some commands and banning users from certain commands in server

#

I actually own 2 db’s

pale vessel
#

that's crazy

torn ravine
#

crazy

#

but possible

#

DEEP RESEARCH TIME

#

so like I’d make it store a list of banned user from x server

jolly inlet
#

@rivex

torn ravine
#

I’m using a mongodb

#

as expected

#

It would look something like that

#

exactly

cosmic girder
#

How do u make is so if theres a error it shows it in chat

grand dagger
#

I use mongo too

#

It’s a bit slow but it is what it is

pale vessel
#

did you provide the correct headers

#

also, https://discord.com/api

cinder patio
#

I don't think you can get the DM channel

#

For bots, this is no longer a supported method of getting recent DMs, and will return an empty array.

#

If you are trying to create the DM, then the recipient_id should be in your request body

#

not a query string

cinder patio
#

show how

#

what are you using to make http requests

golden condor
#

Why do you need to do that?

cinder patio
#

recipient_id shouldn't go in headers, but in body, aslo you need to provide an Authorization header

golden condor
#

Oh

#

Yeah there is broadcastEval

#

I can't do manager.broadcastEval with Kurasuta
@wide ridge yeah

cinder patio
#

See that's what sucks about discord.js, you don't have the object - you cannot do anything else, even if you have all the data you need (ids)

golden condor
wide ridge
#

ye I need the ShardClientUtil

golden condor
#

Look at the example

#

client.shard.broadcastEval

wide ridge
#

so with clustering, I'm not sure how I would get that set up properly

#

I tried manager.client.shard.broadcastEval

golden condor
#

You don't need to do that

wide ridge
#

but manager doesn't have that property

golden condor
#

You can just do client.shard

#

.broadcastEval

#

Or bot

#

Or whatever your client object is

#

That should work

#

And you also have client.shard.send()

wide ridge
#

it's in a different scope tho, I'm trying to do it in a different file

#

my index.js has the shardingmanager

#

and my shard.js has the client objects basically

golden condor
#

Use that file then

#

You need the client basically

wide ridge
#

yeah

golden condor
#

It's the same as djs sharder in this case

wide ridge
#

I'll try it out and see how it goes

#

i want it to only send 1 dm, so I'll probably need to check if isMaster right?

golden condor
#

client.shard.broadcastEval("client.user.cache.get('userid').send('message')")

#

Since only one shard will have that user

wide ridge
#

the user could be in multiple shards so maybe just

#

client.shard.masterEval? idk

cinder patio
#

wait wait wait

golden condor
#

Oh yeah

#

I'm stupid

haughty night
#

The left should be an emoji

pale vessel
#

font maybe

#

did you change your font

haughty night
#

I didnt, the only thing i did was host it, when i do it local it works

#

Kinda weird

#

Ill take a look to be sure tho

cinder patio
#

Are you hosting on heruko?

haughty night
#

yee

cinder patio
#

same happened to me, but instead all the text just disappeared

#

I fixed it by not hosting the bot on heruko

haughty night
#

😂

#

Ill just look into it, if i cant find a solution then no emojis

#

Cant be bothered

pale vessel
#

again

iron scroll
golden condor
#

The database name cannot contain a .

cinder dove
#

The error says it all

vale garden
#

hi

#

what does this mean

white anvil
#

port 3306 is not open on 127.0.0.1

vale garden
#

what does that mean i have no clue

#

lol

white anvil
#

you are trying to connect to something that doesnt exist

pale vessel
#

repl kek

earnest phoenix
#

I have this in my code (html website)
app.get('/', function(request, response) {
response.sendFile(__dirname + '/views/index.html');
});
and i want to add another page, so when i press a button i get there
i added a botinfo.html file, but i cannot add response.sendFile() to it

digital ibex
#

so u want it to be like ursite.com/botinfo

earnest phoenix
#

yeah

digital ibex
#

you'd use response.render('botinfo', 'path to botinfo.html')

#

for ejs anyways

#

u can try it, might work

earnest phoenix
#

TypeError: Cannot create property '_locals' on string '/app/views/botinfo.html'

#
app.get('/', function(request, response) {
  response.sendFile(__dirname + '/views/index.html');
  response.render('botinfo', __dirname + '/views/botinfo.html')
});```
digital ibex
#

which one?

earnest phoenix
#

botinfo one

#

i cant add another one

digital ibex
#

confuso

#

remove the sendFile bit, and see if it works

earnest phoenix
#

it will if i remove the other part yes

#

but i want them to all work together

#

and i cant add another app.get because it wont work

digital ibex
#

then use seperate files, and in that seperate files, use router instead of app and then you can do it like that to make the url hi.com/index/botinfo/ or something

#

you probably can use it in the same file, but with router. unsure

#

router will be ```js
const router = require('express').Router();

earnest phoenix
#

so confused

#

why cant i just use

  response.sendFile(__dirname + '/views/index.html');
  response.sendFile(__dirname + '/views/botinfo.html');
});```
#

this is in my main file

#

server.js

digital ibex
#

unsure tbh, but ur code will be something along the lines ofjs const express = require('express'); const app = express(); const router = require('express').Router(); app.get('/', (req, res) => { // do whatever u need to do here router.get('/something', () => { // do whatever u need to do here }); }); im not sure tho as i use separate files cuz i think its easier than doing ^^

#

you can, if that doesn't work , do ```js
const express = require('express');
const app = express();
app.get('/dashboard', (req, res) => {
// do whatever u need to do here
});
app.get('/dashboard/settings', (req, res) => {
// do whatever u need to do here
});
app.get('/dashboard/account', (req, res) => {
// do whatever u need to do here
});

#

that one will obviously work, but its not the cleanest way to do it

earnest phoenix
#
app.get('/', function(request, response) {
  const router = require('express').Router();
  response.sendFile(__dirname + '/views/index.html');
  router.get('/botinfo.html', () => {
  })
});```
#

what about router.get

#

what do i do there

digital ibex
#

i'd put the const router = ... outside of {} and u do whatever u'd do with app.get

earnest phoenix
#

but im asking what about the router.get

#

what does it even do

#

Cannot GET /app/views/botinfo.html

digital ibex
#

its middleware, it refers to how ur enpoints respond to requests

earnest phoenix
#

Error: Can't set headers after they are sent.

digital ibex
earnest phoenix
#
app.get('/', function(request, response) {
  response.sendFile(__dirname + '/views/index.html');
  response.sendFile(__dirname + '/views/botinfo.html');
});```
this is supposed to work, but i get CANNOT GET error
digital ibex
#

thats cuz the file ur trying to access doesn't exist or the path is incorrect

#

u need to make it

earnest phoenix
#

it does exist

#

and it is the path

#

the index website works

digital ibex
#

send a screenshot of the file tree

#

that thingy

earnest phoenix
digital ibex
#

im not too sure, but ^^ for context and idk if it would help

#

im kinda confused why its not working tbh

#

have u saved it?

earnest phoenix
#

yes

digital ibex
#

im not too sure why thats happening

#

does res.render not work?

earnest phoenix
#

no

digital ibex
#

does it error?

vale garden
#

im sorry im not good at js

#

but what does this mean

golden condor
#

whatever you use .get with is undefined

cinder patio
#

Wait wait waiy

#

nesting express listeners is not a good idea

willow marlin
#

i have really outstanding problem

#

am using enmap for database

#

every time i write a new value it takes about 3 minutes to write it globally

#

this is what i men
I use bal command and see my balance is 1000
i have a beg command. The beg command gives you +50
I use bal command , bal is still 1000

#

I wait for about 3 minutes

#

then when i try bal it works and shows 1050

#

but it doesnt update instantly

#

i have done expermint and i know the beg command writes the new value instantly

#

the problem is the bal command

golden condor
#

Try switching dbs

honest perch
#

have you tried mongo?

golden condor
#

Maybe to something like mongo

willow marlin
#

aaaaa i jus switched from json to enmap lol

#

ill try mongo i guess

#

its not complicated is it?

blazing bloom
#

Was there a reason why you chose a local database?

willow marlin
#

idk how to do databases

blazing bloom
#

enmap is a thin wrapper on Sqlite isn't it?

willow marlin
#

ah is it

#

are remote databses better

hasty sparrow
#

No

modest maple
#

i mean no

blazing bloom
#

There are more robust in the sense that if your machine hosting the code goes wrong, your database could be too

#

Sqlite is perfect for things like Android apps and small things. In an Android app, you could use Sqlite as a SQL cache against network requests so your application can work offline.

#

You also need to take into account your disk speeds since they will always have a large factor on how well your database can react to immediate reads and writes. By far, you want an database on a SSD.

#

And if you can live with it being temporary to an extent, tmpfs.

true pawn
#

hello

#

i need support

hasty sparrow
#

Then you came to the right place

honest perch
hasty sparrow
#

@willow marlin Are you sure the database is at fault?

true pawn
#

@hasty sparrow My bot is stuck and if I create a new app, will I?

honest perch
#

huh

#

what do you mean by stuck

#

just reset the token

blazing bloom
#

Yeah, that's a good suggestion, what exactly are you doing that causes writes to be that long?

#

I mean, you could try Redis instead, that's battle tested as all things go.

true pawn
#

just reset the token
@honest perch I reset the token but does not log in

honest perch
#

you have to login using the new token

hasty sparrow
#

How many rows do you have in your table(s), any indexes, using caching, etc.

blazing bloom
#

idk how to do databases

#

Good luck trying to explain what those mean.

honest perch
#

with mongoose its pretty simple\

hasty sparrow
#

Time to learn the basics

golden condor
#

This guy sounds like he should be using quick.db

true pawn
#

I get an error: (node:1222) UnhandledPromiseRejectionWarning: Error: Something took too long to do.

honest perch
#

you have probably been rate limited

hasty sparrow
#

Kudos for not using JSON as database

willow marlin
#

uh

hasty sparrow
#

@true pawn Screenshot the error

willow marlin
#

im just writing numbers

true pawn
#

you have probably been rate limited
@honest perch what should I do ?

honest perch
#

run curl -I https://discordapp.com/api/v7/gateway

#

and sc the results

true pawn
#

me ?

honest perch
#

yes

rose mauve
#

evet

true pawn
hasty sparrow
#

@willow marlin How many guilds is the bot in?

honest perch
#

what happens when you run the command @true pawn

#

curl -I https://discordapp.com/api/v7/gateway

true pawn
#

ok wait

earnest phoenix
#

@true pawn Türk müsün?

true pawn
honest perch
true pawn
#

@earnest phoenix evet.

honest perch
#

you have been ratelimited, above is the glitch thread for that

#

i also suggest that you dont use glitch for discord bots

ancient notch
#

Sa

earnest phoenix
#

As

true pawn
#

i also suggest that you dont use glitch for discord bots
@honest perch what can i use?

honest perch
#

a vps?

#

or host locally if you really want

true pawn
#

I do not want to pay

blazing bloom
#

Heroku has a free tier I think

honest perch
#

then goodluck with getting ratelimited

earnest phoenix
#

oof

willow marlin
#

@willow marlin How many guilds is the bot in?
@hasty sparrow
76

honest perch
#

there is no free good hosting

wild mist
#

@true pawn someone said on glitch forum it mean ur host banned

willow marlin
#

@willow marlin Are you sure the database is at fault?
@hasty sparrow
What else could it be

earnest phoenix
#

@true pawn try google cloud 30 days trial maybe its can be helpfull

willow marlin
#

@true pawn someone said on glitch forum it mean ur host banned
@wild mist
I had that issue

honest perch
#

a raspi isnt that expensive either

true pawn
#

hmm

wild mist
#

U have just have to remix to fix it

honest perch
blazing bloom
#

Raspberry PIs, do they still mess up SD cards due to writes? My SD card didn't last as long as I would like

honest perch
#

i havent had an issue with my sd

#

i make weekly backups anyway

willow marlin
#

My phone messes up my SD and I have to switch it once a month

blazing bloom
#

That's extremely odd

honest perch
#

as long as you dont buy an sd for $2 off of AliExpress you will be fine

true pawn
#

thanks i took care of my problem

blazing bloom
#

For that to happen, your phone or something must be writing gigabytes very frequently to occur.

true pawn
#

U have just have to remix to fix it
@wild mist thanks bro

hasty sparrow
#

@willow marlin I'm curious to know how many rows your database table has

willow marlin
#

It doesn't?

#

Wdym

blazing bloom
#

It's Sqlite, it has to have rows

hasty sparrow
#

If it's huge and hasn't got an index/bad index, then the updates will indeed be slow

willow marlin
#

In the database the name and Mony is stored

hasty sparrow
#

Every entry is a row

blazing bloom
#

"Mony"?

willow marlin
#

Money

blazing bloom
#

Okay, how many inserts or create new records do you think you're doing?

willow marlin
#

One

blazing bloom
#

What.

hasty sparrow
#

What are you using as key for each user?

blazing bloom
#

This sounds like a massive table lock then.

willow marlin
#

Who tf is nezukochan

#

I'm using their ID as a key

hasty sparrow
#

Lmao, DMed me as well

willow marlin
#

Lol same

blazing bloom
#

Same.

hasty sparrow
#

@green kestrel Got @rose glen dming a bunch of people about missing perms

blazing bloom
#

Do you know what your table schema looks like? You said and ID and money, so it is literally a table with 2 columns?

willow marlin
#

Idk how to see my table

#

But it's just ID and money

blazing bloom
#

Right, so in order to actually answer our questions, Duke's included, we need to know what this table looks like.

willow marlin
#

I have no idea how to see the table

blazing bloom
#

Otherwise we're just stabbing in the dark.

willow marlin
#

Is this virtual table?

#

523039234022440962 => name : 523039234022440962
Money : 69

#

That's what it looks like

blazing bloom
#

Where are you hosting this bot?

hasty sparrow
#

Is there a database file anywhere?

blazing bloom
#

And are you able to copy the contents of where this db is hosting to your machine? I don't know if that's wise or not, copying a sqlite file while it's running.

willow marlin
hasty sparrow
#

Ahh

willow marlin
#

Is there a database file anywhere?
@hasty sparrow
No it's virtual database

#

Ahh
@hasty sparrow
Even on glitch and heroku it didn't work

hasty sparrow
#

If the data persists through restarts, then it has to be stored somewhere

willow marlin
#

Idk

#

When I kill and restart program it works

blazing bloom
#

But you don't know if it's starting from scratch right?

willow marlin
#

What do you mean by that

blazing bloom
#

As in, when you kill and restart it, does the data that you saved in a previous session still exist?

willow marlin
#

Yep

#

It does

blazing bloom
#

Cool, so this means the data has to live somewhere since it lives outside restarts right?

willow marlin
#

Probably

blazing bloom
#

But it seems you don't know where that is?

willow marlin
#

Ohh wait

#

I know

#

It shows up on glitch

#

Only glith

#

As a weird stream of unidentified emojis

#

It's not a readable text

blazing bloom
#

Probably stream data then. I think we know what the problem is then.

#

Glitch is probably not a good place to save a lot of data, it has to go over some sort of network and some file system that you don't know about

willow marlin
#

Yep that's why I switched to replit

blazing bloom
#

I don't know how old you are, but it's effectively similar to writing to a floppy disk; slow as all hell.

willow marlin
#

Oh ik

blazing bloom
#

So I don't think sqlite is to blame here; provided that the file is on the same device that's running your code, it will be fine for most low-medium traffic.

#

But writes to some unknown file system, who knows at that point.

willow marlin
#

Uh okay

#

So how do I go about resolving this issue?

hasty sparrow
#

Stop using enmap and sqlite

blazing bloom
#

Pretty much what Duke said

willow marlin
#

Lmao what do I use then

#

Mongo

#

Mango

hasty sparrow
#

MariaDB/MySQL/PostgreSQL/MongoDB/anything

blazing bloom
#

Some alternatives are MongoDB atlas, Heroku with SQL, Gigalixir

hasty sparrow
#

Depends on your data structure

willow marlin
#

If I want to store timestamps as well

blazing bloom
#

I don't even think you have a proper hosting solution in place.

willow marlin
#

Where it gets pinged by uptime monitor every 30 m

blazing bloom
willow marlin
#

What does a free tier do

hasty sparrow
#

Use proper hosting, glitch and repl.it are both for prototyping, not long term hosting

blazing bloom
#

Costs nothing, data limit 512MB.

willow marlin
#

What am I meant to host on

#

I can't afford to spend any money

blazing bloom
#

Back to this again.

hasty sparrow
#

Not even a fiver a month?

willow marlin
#

Nope

#

If I had money I would buy a vps

hasty sparrow
#

Could you show the command code that updates the user's balance?

willow marlin
#

Sure

#

The beg?

hasty sparrow
#

If that's the one that updates it, then yes

willow marlin
#

It's funny because the database works when I store timestamps for cooldown

blazing bloom
#

Flyaway, do you want a $100, 60 day credit for digital ocean then?

willow marlin
#

How do I get

blazing bloom
willow marlin
#

Do u wanna see my whole code

hasty sparrow
#

Sure, hastebin it

#

Shameless ref link

blazing bloom
#

No shame here.

willow marlin
#

It expires in 10

#

Also I didn't do the comments well

pale vessel
#

hastebin it

willow marlin
#

Oops was I meant to hastbin I thought you mean pastebin

hasty sparrow
willow marlin
#

Uh

hasty sparrow
#

Why are you creating a new client at the top of your command file?

willow marlin
#

Thanks I'll try it

#

Am i

hasty sparrow
#

Yes

#

const bot = new Client();

willow marlin
#

Ah I think that's because

#

I wrote my enmap as bot.balance

#

And bot wasn't defined

vale garden
#

hi

#

can someone tell me

#

why im getting this error

summer torrent
#

define bot

hasty sparrow
#

Because "Bot" is not defined

vale garden
#

i have defined bot

hasty sparrow
#

"Bot" is not "bot"

#

And vice versa

summer torrent
#

variables are case sensitive

vale garden
#

ok well i tried lower case too

#

same thing

summer torrent
#

restart your app

willow marlin
#

Try again

hasty sparrow
#

Is "bot" defined in the command file?

vale garden
#

its defined in index.js

willow marlin
#

Can you show the line which errored

vale garden
#

see

#

im using a command handler

hasty sparrow
#

You can't just use one file's variable in another file (without importing/requiring it, but that makes no sense in this case)

vale garden
#

oh

sinful harness
#

Also if bot.ping will be undefined , u have to type bot.ws.ping

digital ibex
#

depends which version he's on

blazing bloom
#

@willow marlin It's definitely not enmap fault, reads for one operation at at 0.384ms, while writes/updates are at most 1.2ms

#

Also, instead of this:

bot.cooldown.ensure(`${user}`, {
      name: user,
      beg: Date.now()
    }); //check for time beg
var cooldown = bot.cooldown.get(user, "beg")

You can just do

 const { beg } = coolDownTable.ensure(user, {
        name: user,
        beg: Date.now(),
    })

Saves you one query

willow marlin
#

sorry?

#

oh

#

i see

#

thats very clever thanks

blazing bloom
willow marlin
#

uh ill show u

blazing bloom
#

Well, at least has that structure anyways

willow marlin
#

actualy yes like that exceot wth User IDs

#

yes

#

that structure

cosmic vortex
#

hi, any good lib for discord bot
c# btw, i only know c# (and pascal)

willow marlin
#

js

#

discord.js is rlly ez

cosmic vortex
#

i said c#, not javascript

blazing bloom
#

Literally google

pale vessel
#

dsp

earnest phoenix
#

wut is .first() using for 🤔

willow marlin
#

to get the first of that object in a message i think

pale vessel
#

collection/map

earnest phoenix
#

:0

willow marlin
#

message.mentions,users.first()gets the mention

earnest phoenix
#

yes

cosmic vortex
#

any lib that i can use with mono

willow marlin
#

discord.js

earnest phoenix
#

bruh he c#

blazing bloom
#

Why Mono. It has dotnet core support.

hasty sparrow
#

DSharpPlus or Discord.NET, no clue which one/if either supports Mono

pale vessel
#

ask cry

#

cry#2046

willow marlin
hasty sparrow
#

Incorrectly, yes

#

The shared variable method latches onto the bot initialized in your main file, whilst you add the balance to a new instance inside your command file

willow marlin
#

oh what am i

#

doing wron

#

oh

#

so when i call it in other files do i need to define it?

hasty sparrow
#

No, you access it through the bot instance

earnest phoenix
#

@earnest phoenix

#

he offline smh

willow marlin
#

so

index.js
const Discord = require ('discord.js')
const bot = new Discord.Client();
const Enmap = require("enmap");
bot.balance = new Enmap({ name: "balance" });

balance.js:
const Discord = require ('discord.js')
//without defining it
bot.balance.get
hasty sparrow
#

Probably don't need to require discord.js in your balance command file, but yes, that would be the structure

willow marlin
#

but then it will say bot is undefined

hasty sparrow
#

Are you passing the message to the command method?

willow marlin
#

when i use command handler i have to define everything im gonna use

#

ah

hasty sparrow
#

message.client is the bot

willow marlin
#

do i still have to define enmap

hasty sparrow
#

No, you already defined it once in your main file

willow marlin
#

kk

torn ravine
#

I have a good idea

willow marlin
#

huh i passed bot but still no define

hasty sparrow
#

Use message.client

#

Or whatever you defined the message as

willow marlin
#

oh i defined it before i defined obt

#

sorry

#

o lmao enmap is not defined

#

do i have to pass enmap as erll

hasty sparrow
#

The guide explains what you have to do and how to use it

torn ravine
#

I wanna create a bot-ban system that doesn’t allow users to use commands. it could be specific commands or it could be the whole bot. It’ll be server-wide so I can store data in a db which includes time remaining, and ban reason. I’ll use the DB to store USERID that do bad things and have em erased of the face of the planet

willow marlin
#

the only issue with that i s you have to convince developers to use your system

lusty quest
#
                  .setColor('#006c80')
                  .setTitle(`Vote Leaderboard`)
                  for (var i=0; i<chunked[n].length; i++) {
                    prevembed.addField(`User: ${chunked[n][i].username}`,`Votes: ${chunked[n][i].votes}`)
                      }
                prevembed.setFooter(`Page ${n+1}/${chunked.length}`)
                sendmessage.edit(prevembed)```
is the code for the embed
willow marlin
#

have u defined the variable n and chunked?

lusty quest
#

yes

#

its an array from a database with a few thousand returns. i chunk them into 10 datasets per chunk

hasty sparrow
#

Why are you fetching so many results when you only display 10 at a time?

lusty quest
#

its an interactive embed. with mutiple pages

#

so i can limit the results per page

#

but my issue is that i get on my first page always this undefined page

willow marlin
#

is it because n+1 / chunked.length at that point is a dodgy number

#

as in like 0 or 1

#

or nan

#

NaN

lusty quest
#

n is defined as 0 in the beginning

#

but since its an Array that starts at 0 but i want to be the first page to be 1 it sets n to 1 for the footer

#

also the footer is not in the for loop and appears only once

#

running this loop also gives the same result javascript for (var i=0; i<chunked[n].length; i++) { // embed.addField(`User: ${chunked[n][i].username}\n Votes: ${chunked[n][i].votes}`) embed.addField(`User: test\n Votes: test`) }

#

found the issue

hasty sparrow
#

What caused it?

lusty quest
#

the AddField is only 1 field and the undefined is the missing Field title

willow marlin
#

omg i still cant with the enmap

#

ive read the guide and tried

#

i cant

digital ibex
#

enmap is bad

#

don't use enmap

lusty quest
#

what did you want to do?

willow marlin
#

im trynig to follow tha

lusty quest
#

enmap is fine but you should not use it with more than 10 Guilds

willow marlin
#

whot