#development

1 messages · Page 838 of 1

zenith terrace
#

uptimerobot

earnest phoenix
#

imma just bite my tongue

#

neither is

#

rent a vps if you want reliable hosting

opaque kite
#

Heroku ig

earnest phoenix
#

scratch

zenith terrace
#

uh

#

disboard

charred jetty
#

Thanks

#

Done

flat pelican
#

ping

summer torrent
#

stats

#

bot

#

yes

#

or user & server info

#

np

earnest phoenix
#

dont make a big multipurpose bot

#

find a purpose

#

and find commands useful to that purpose

#

:p

#

hm?

#

say actual sentences

flat pelican
#

no

earnest phoenix
#

what about it?

flat pelican
#

have you seen pokécord

earnest phoenix
#

those bots that have a purpose but omg moderation! fun! are annoying af

#

looks at mee6

#

other bots have it

#

the problem with those giant bots, is that no one has everything

#

so you have to add another giant bot to get the feature you're lacking

#

so then you end up with TWO moderation bots

#

TWO music bots

#

and 50 bots that have a freaking hug command

#

yea but

#

why have a ban command

#

unless you make an entire moderation system

summer torrent
#

spam command?

earnest phoenix
#

yea or that

summer torrent
#

@earnest phoenix that is api abuse

earnest phoenix
#

^

#

ok and?

#

if they're right after another , its api abuse

summer torrent
#

it is abuse

modest maple
#

that maxes your rate limit instantly

summer torrent
#

imagine spamming spam command

modest maple
#

that is abuse

earnest phoenix
#

you do know we all have bots on here right? and sorta know what we're talking about?

#

dont spam the discord api,

modest maple
#

@earnest phoenix Two people could do it and get your bot ratelimited easily

summer torrent
#

little

earnest phoenix
#

they dont have a spam command

summer torrent
#

^

modest maple
#

^^

earnest phoenix
#

ok and?

summer torrent
#

ratelimit is not a global

modest maple
#

1000 Times a minute is fine globally

earnest phoenix
#

the bot isnt ogiing a

#

the bot isnt going

#

a

#

aa

#

a

#

a

#

a

#

try that sometime in a dm

#

watch what discord does

modest maple
#

its 500/s for global rate limit across all actions approx

#

not to mention

#

bots like mee6 and dyno for all their logging stuff use webhooks

earnest phoenix
#

there we go again.

modest maple
#

because they have a higher ratelimit

earnest phoenix
#

you get told off or proved wrong

#

"k"

modest maple
#

shh he young

#

XD

earnest phoenix
#

k

#

but still its like wjsjdfb

#

try like naming the bit

#

bot*

#

instead of saying "this bot"

#

and then take it up with a mod.

#

because again.

#

that IS discord api abuse

#

search api abuse in:mod-log in discord search

#

and read a bit

#

right there.

#

@earnest phoenix

#

so yea

#

dont do it

summer torrent
#

little

#

how old are you

earnest phoenix
#

@flat pelican

#

halp

summer torrent
#

yardim me

earnest phoenix
#

since you were the one that just declined that bot

summer torrent
#

@earnest phoenix how old are u

earnest phoenix
#

What's happening here

#

this guy thinks its a good idea to have a spam command

modest maple
#

Kid spam command

earnest phoenix
#

That's not a good idea in any capacity

#

^^

#

again, read modlogs

flat pelican
#

What's happening

earnest phoenix
#

type api abuse in:#mod-logs

#

for fucks sake

#

we're not trying to diss you

#

spamming a message is api abuse

flat pelican
#

Can y'all calm down

earnest phoenix
#

oh i am calm xD

#

this mans is just being very difficult

#

Sometimes they have to learn the hard way lol

flat pelican
#

There is extremely no need to make a bot spam a channel with stupid messages

#

it is an API abuse

earnest phoenix
#

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

#

thats coming from a mod that decides the fate of your bot.

flat pelican
#

and we can't monitor the 10k bots that we have in our list

#

if a bot has a command like that, we can ask them to remove it

#

simply report it

earnest phoenix
#

report it

flat pelican
zenith terrace
#

Bruh

summer torrent
#

@earnest phoenix

zenith terrace
#

Wat

earnest phoenix
#

oh yea we know

zenith terrace
#

505571539333152781

flat pelican
zenith terrace
#

its not rulebreaking

flat pelican
#

only dev/code questions here

zenith terrace
#

its API abuse

earnest phoenix
#

thats discord rule breaking ;P

zenith terrace
#

ToS 👀

summer torrent
#

against to ToS

earnest phoenix
#

move before eri yeets us all

summer torrent
zenith terrace
#

Can't yeet me since I made the bot Yeet 😉

flat pelican
#

aight

zenith terrace
#

He can kick me tho

#

Ima move

#

xD

flat pelican
#

I'm not joking when I make warnings here, seriously stop and move - keep channels on purpose and clean for everyone

#

thanks.

valid holly
#

Has anyone used node's FS to fetch a github url ?

#

Github URL https://github.com/p/a/t/h/to/file

summer torrent
#

fs is not for fetch url 🤔

valid holly
#

URL is a global object

earnest phoenix
#

https://raw.githubusercontent.com/crazygmr101/AnsuraBot/master/main.py <<thats the format to download a raw file btw

valid holly
#

oh

earnest phoenix
#

its just

summer torrent
#

^

earnest phoenix
#

file

valid holly
#

let me eval that

earnest phoenix
#

none of the github stuff

quartz kindle
#

@valid holly Only URL objects using the file: protocol are supported.

#

file: is a local file in your computer

#

not a remote file

valid holly
#

Really ?

#

I thought it accepts absolute paths

#

fs.readFileSync(new URL('file://hostname/p/a/t/h/file'));

#

Maybe I need to document better

#

Anyway, thanks, I'll look for something else to use then.

#

Taking this into consideration:


          userinfo       host      port
          ┌──┴───┐ ┌──────┴──────┐ ┌┴┐
  https://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top
  └─┬─┘   └───────────┬──────────────┘└───────┬───────┘ └───────────┬─────────────┘ └┬┘
  scheme          authority                  path                 query           fragment
#

file: would be the scheme ?

earnest phoenix
#

should be

valid holly
#

I'm basically trying to read stuff related to covid

#

URL constructor returned this for my url

#
URL {
  href: 'https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_daily_reports/03-25-2020.csv',
  origin: 'https://raw.githubusercontent.com',
  protocol: 'https:',
  username: '',
  password: '',
  host: 'raw.githubusercontent.com',
  hostname: 'raw.githubusercontent.com',
  port: '',
  pathname: '/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_daily_reports/03-25-2020.csv',
  search: '',
  searchParams: URLSearchParams {},
  hash: '' }
#

I know request isn't maintained anymore

#

Anyone knows any other packages for HTTP requests ?

earnest phoenix
#

node-fetch

amber fractal
#

node's built in HTTP library mmulu

restive furnace
#

node-superfetch

summer torrent
#

node-fetch or axios

pale vessel
#

node-fetch

earnest phoenix
#

Do i need to use Sharding to make a music bot work in two servers?

#

nu

pale vessel
#

no

#

that's not how it works

restive furnace
#

but you need at 2000 servers.

#

(2500 really, but 2000 recommended per shard)

tight plinth
#

*1000 servers per shard

pale vessel
#

which one are you correcting?

#

(ik it's the latter but some people might get confused)

earnest phoenix
#

you can't choose how many servers you have on a shard, you're forced to shard when you hit 2.5k guilds, which and how many guilds go to each shard is discord's decision following the formula (guild_id >> 22) % num_shards == shard_id

solemn quartz
#

Guys

#

How to do that?

tight plinth
#

thats not the bot, thats the bot app

solemn quartz
#

but how?

tight plinth
#

oauth

solemn quartz
#

how do they do that?

tight plinth
#

discord dev portal

earnest phoenix
#

it shows up in your apps once you authorize an app via oauth

#

Hmm... @solemn quartz are you talking about making a bot or the oauth?

solemn quartz
#

i already made a bot

#

im developing it

earnest phoenix
#

@solemn quartz so wdym by how do they do that?... The oauth?

solemn quartz
#

yea

#

i said that

earnest phoenix
#

look at the url above

summer torrent
#

"Know what servers you're in"

solemn quartz
pale vessel
#

probably for the dashboard

earnest phoenix
#

oauth is used in web apps to get a bearer token for your account to access certain endpoints on your behalf

solemn quartz
#

okay

#

lol

#

then probably i will not do that

#

im lazy

earnest phoenix
#

you need a webserver to use oauth

#

anyways

solemn quartz
#

lol

#

ok

#

i will not do that

#

that's it

earnest phoenix
pale vessel
earnest phoenix
#

Kk

solemn quartz
#

lol

grizzled raven
#

wait

#

ok so

#

if i had partial messages, would i recieve messageDelete/Update events from a guild on a different shard?

#

wait do you recieve events across shards to begin with?

pale vessel
#

yes

grizzled raven
#

so you can recieve a message event on each shard for one message?

earnest phoenix
#

no

#

DMs are always on shard 0

#

you'd get MESSAGE_CREATE from a guild on whichever shard the guild is supposed to be in

#

based on the already mentioned formula above

flat pelican
#

Ehhhh...

#

DMs aren’t really working with shards

earnest phoenix
#

what

#

yes they are

#

shard 0 will be the one handling dms

#

since they're always sent out to only shard 0

#

a lot of libraries unify sharded clients into one

#

so any events you get on any shard are forwarded through one client

digital ibex
#

how can i make js client.commands.execute(message, client, args) not be a function and be something like ```js
client.commands.execute: (message, client, args)

the second one gives a syntax error, how can i make it not give one and make it function?
#

any ideas?

earnest phoenix
#

what

digital ibex
#

like

#

i am getting this error, client.commands.execute(.....) is not a function

#

so

#

i need to make it not be a function and be smthing like the second one, client.commands.execute: (message, client, args)

#

if that makes more sense...

slow elk
#

Is it even a real function? I don't think it is

digital ibex
#

yes..

slow elk
#

I just grab the command from the collection and use .run(), but eh

digital ibex
#

wdym?

earnest phoenix
#

@digital ibex what are you trying to do with that function? Can you show us an actual screenshot of it?

quartz kindle
#

sounds like an X Y problem

digital ibex
#

ok

quartz kindle
#

tell us what you really want to do

digital ibex
#

ik its messy

#

make a command handler, eris

quartz kindle
#

ok, so client.commands is a collection

digital ibex
#

yeah

quartz kindle
#

it is not one command, it does not have an execute

#

it is many commands, each command with their own execute

digital ibex
#

mhm

quartz kindle
#

so client.commands.get(command).execute

digital ibex
#

oh

quartz kindle
#

you have to get/find the command first, so you can execute it

digital ibex
#

yeah

#

ok, im getting another error:

#

cannot read property of 'name' of undefined

#

here: client.commands.get(command.name);

#
    const command =
        client.commands.get(commandName) ||
        client.commands.find((cmd) => cmd.aliases && cmd.aliases.includes(commandName));```
#

const commandName = args.shift().toLowerCase();

sleek vale
#

how can i make js client.commands.execute(message, client, args) not be a function and be something like ```js
client.commands.execute: (message, client, args)

the second one gives a syntax error, how can i make it not give one and make it function?
@digital ibex
#

i think what you're trying to do is to have something like

module.exports = {
  execute: ({ message.client.args }) => {
    [command code here]
  }
}

in a separate .js and then you assign that to client.commands and just call the exported function with client.commands.get('commandname').execute({ message, client, guilds })

#

sorry if thats not it

digital ibex
#

uh

#

i was getting the error in my command handler file, not the command file

#

thank you anyways

quartz kindle
#

that means the command was not found

#

have you tried doing console.log(commandName) to see if the command is correct?

#

also, why are you trying to get the command again?

#
let command = client.commands.get(commandName) || client.commands.find(c => c.aliases && c.aliases.includes(commandName));
if(command) {
  command.execute()
} else {
  // command not found
}```
earnest phoenix
#

how to start up making my own website ?

digital ibex
#

im making a command handler

#

and i have not

earnest phoenix
#

k

digital ibex
#

and... im using a try and catch thing

compact oriole
#

Step 1. make index.html
Step 2. write code
Step 3. Run site

prime cliff
#

Learn a coding language for websites like js and use a framework/web server

earnest phoenix
#

@prime cliff i have not learnt to use frame work or web server

prime cliff
#

Better get learning then mm

earnest phoenix
#

@prime cliff from where can u plz guide me pal

quartz kindle
#

first of all you need a server

#

do you have any sort of hosting?

#

ie: a webhost, or a vps

prime cliff
#

Glitch supports web servers too i think

earnest phoenix
#

hm

quartz kindle
#

or a service like glitch/heroku

earnest phoenix
#

yep

quartz kindle
#

which one do you have?

earnest phoenix
#

i have

#

glitch n heroku

#

both

prime cliff
quartz kindle
#

well, you can use either of them

#

first you need to install a webserver

#

if you're using javascript and node.js, a popular webserver you can use is express.js

earnest phoenix
#

express.js is used for web development ??

compact oriole
#

express.js is a backend

quartz kindle
#

express is a webserver

digital ibex
#

tim, nothing logs when i log commandName

compact oriole
#

you need html for frontend

quartz kindle
#

a website is made of many different things that work together.

compact oriole
#

^ yea

quartz kindle
#

at a basic level, there is a "backend" (the server, that people connect to to load the website) and the "frontend" (what people see in the browser)

digital ibex
#
    if (!command) return;

    try {
        const client = { value: new Eris.CommandClient(token) };
        client.commands = new Eris.Collection();
        const args = message.content.slice(prefix.length).split(/ +/);
        const commandName = args.shift().toLowerCase();
        const command =
            client.commands.get(commandName) ||
            client.commands.find((cmd) => cmd.aliases && cmd.aliases.includes(commandName));
        client.commands.get(command.name);
        client.commands.get(command).execute;
        console.log(commandName);
    } catch (e) {
        console.log(e);
        client.createMessage('689557849214418972', e);
        client.createMessage(message.channel.id, `An error occured.\n\`${e}\``);
    }``` thats what i have commandName doesn't log anything and i just get an error
earnest phoenix
#

@compact oriole dm pls

quartz kindle
#

@digital ibex wtf

#

why are you overwriting your client?

compact oriole
#

true

quartz kindle
#

also, what is that first command at the beginning?

digital ibex
#

oh nevermind the first command

#

and

#

i am doing it bc i was getting errors saying cannot read property of 'commands' of undefined even when i defined it in the try and catch, so.... i defined it with a type

quartz kindle
#

you just made it worse lmao

#

you are basically destroying your entire client, and your command handler

#

no wonder why it never finds any command

digital ibex
#

oh

#

yikes

#

what do i do then?

quartz kindle
#

assuming your command handler is properly done, all you need is to check if a command exists

#

but i guess its not properly done lol

#

show your entire code i guess

digital ibex
#

ok

#

im aware its a mess

quartz kindle
digital ibex
#

yeah....

quartz kindle
#

so essentially, delete those 3 squares

#

leave only the first one

digital ibex
#

i was getting so many errors and that was the only solution

#

ao

#

what

#

so, delete everything in the try thing?

quartz kindle
#

basically yeah, your entire try block is wrong lol

digital ibex
#

o

#

ok

#

what do i do with the catch (e) {}

#

then?

quartz kindle
#

yes

digital ibex
#

ok uh

#

client is still not a thing

#

and message, args

quartz kindle
#

where is it not a thing?

digital ibex
#

in my command file

quartz kindle
#

didnt i tell you before that the execute function should be a property?

versed latch
#

no

#

oh wrong server

digital ibex
#

oh yeah

versed latch
#

lol

digital ibex
#

pretend its the way u shown me

versed latch
#

.

quartz kindle
#
module.exports = {
  a: something,
  b: something,
  c: something
}```
digital ibex
#
module.exports = {
name: 'random',
}
execute: (message, client, args) => {
//code
}
#

like that?

quartz kindle
digital ibex
#

ok

#

still

quartz kindle
#

should be correct

#

if its not showing what you expect, then its an issue with your code editor

#

also make sure the file is saved

digital ibex
#

oh

#

OH YES

#

my bad

#

yay

#

ty

#

wait, nvm

silent shore
#

guys ive just started out with making a discord bot but for some reason when i use the event "on_raw_reaction_add(payload)" and print the payload i dont get the emoji id im at a total loss

crimson vapor
#

What language?

silent shore
#

python

#

rewrite

slender thistle
#

refer to the docs, see what the payload actually returns, see its properties

silent shore
#

i mean i have been

crimson vapor
#

Thank you for saying python, some people just say Russian or English

silent shore
#

ill give it another look

#

haha yes i am a programmer i just never did discord bots before

modest maple
#

@silent shore on_raw only gives Ids nothing else

silent shore
#

when i print it i get this <RawReactionActionEvent message_id=692747529560784959 user_id=210886704842670081 channel_id=692726432018858066 guild_id=692726210849144922 emoji=<PartialEmoji animated=False name='�💩' id=None> event_type='REACTION_ADD' member=<Member id=210886704842670
1 name='Fam' discriminator='5761' bot=False nick=None guild=<Guild id=692726210849144922 name='Fam' shard_id=None chunked=True member_count=2>>>

modest maple
#

yh

silent shore
#

see the id="none"

modest maple
#

cuz its unicode

silent shore
#

how am i ever supposed to see what emoji is

modest maple
#

only custom emoji's have Ids

silent shore
#

ohh

modest maple
#

defualt emoji's will be unicode

#

and will only have a name

silent shore
#

so if i just do emoji == "💩" it works

slender thistle
#

str() the emoji

modest maple
#

^^

slender thistle
#

so that it will be converted to its name if it's unicode

silent shore
#

ohh

#

that makes alot of sense

#

thanks guys ill give it a try

slender thistle
#

and if it's a custom emoji, it'll be converted into <:name:id>

silent shore
#

okay sorry guys ive wasted alot of time on this and its still not working can someone type it for me i must be a retard just to be sure im not fucking up the syntax

modest maple
#

whats ur code

silent shore
#

@client.event
async def on_raw_reaction_add(payload):
#channel = get(payload.guild.text_channels, name="welcome")
#print(channel)
print(str(payload.emoji.name))

#

ive tried some other syntax stuff

#

but not really working

#

ignore the # stuff

#

i just want to print the reaction in string so : poop :

slender thistle
#

Eh, you don't need to call str() on stuff you print since it's automatically called already

#

It'll be received as a unicode emoji

silent shore
#

so if i store it in a var before itll print out as ": poop :"?

slender thistle
#

No no no

#

You'll receive it from Discord as a unicode emoji already

#

So \💩

silent shore
#

soo how do i get it in str

modest maple
#

you cant

#

your console will print is as the emoji

#

because thats how unicode works

silent shore
#

soo i just compare the unicode with some other unicode

slender thistle
#

Yeah

modest maple
#

yh

silent shore
#

in an if statement?

#

god dammit

modest maple
#

yh

slender thistle
silent shore
#

imagina how long it took for me to actually search up a discord to get help

#

ive been struggling with this all day

slate oyster
#

I got a NullPointerException, but my stacktrace points to where I print my trace. Genius.

#

Extremely not helpful

slender sleet
#

How do you do to get server membercount on your website?

slate oyster
#

Use the api

#

Your bot tells the website what it's server count is

slender sleet
#

No

#

On the server pages

crimson vapor
#

what do you mean?

slender sleet
#

The server MemberCount

crimson vapor
#

oh

slender thistle
#

You send a request to top.gg with the info about your bot's amount of servers and/or shards

slate oyster
#

They have their own bot

earnest phoenix
#

i'm so confused

#

stop being so abstract with your questions and describe them instead so we don't have to guess

slate oyster
#

you add their bot to your server

quartz kindle
#

not bots

slate oyster
#

before getting on the server list

#

And then their bot counts your users

#

and tells the server list site

slender sleet
#

How?

#

I want to have a Member Count on my website

slate oyster
#

I just told you

quartz kindle
#

on your website?

slate oyster
#

@pliant gorge Counts ot for them

#

And reports to their site the stats

slender sleet
#

On my website @quartz kindle

slate oyster
#

If you wanted it on your own site
You'd have to make your own bot

#

That counts users for you

#

and sends it to your site

crimson vapor
#

you could use a get request on the website

#

and get the users on load

quartz kindle
#

then make your bot count it. give it an api that your website can request, or make it available somewhere that your website can use

slender sleet
#

But i don't have the same server

slate oyster
#

Yes
Which is ehy you use your own bot rather than dbl's
So you can make it route to you own server

earnest phoenix
#

But i don't have the same server
hence why give it an api that your website can request was said

#

or you can do it the other way around

#

it doesn't matter which end POSTs

languid heart
#

Hi

strange gyro
#

I'm trying a very simple html but this made the widget always loading help please?

<!DOCTYPE html>

<a href="" target="_blank" rel="noreferrer nofollow">
<iframe src="https://discordapp.com/widget?id=478687499137449984&theme=dark" width="350" height="500" allowtransparency="true" frameborder="0"></iframe>
</a>```
languid heart
#

How i create a bot

earnest phoenix
robust moth
restive furnace
#

make a loop to check if its still playing

#

if not post error msg and continue playing (atleast try) if not, then start over

tight plinth
#

question : whats the best between handle events in a single file (like handle everything into index.js) or handling them in separate files?

quartz kindle
#

whatever you prefer

tight plinth
#

ok

valid holly
#

@strange gyro

#

widget works just fine

#

@tight plinth handling everything into one file isn't going to clog your code ?

tight plinth
#

idk

valid holly
#

Also if you have line 2.000 for an event, it will use more resources to read through and translate to machine code

#

And load them when needed, export global objects you're likely to use

#

You can also use ES6's import

quartz kindle
#

the resources needed to compile big file vs small file is negligible compared to the resources needed to read multiple files from disk

#

the reason to go for multiple files is for maintainability and ease of use, not for performance

valid holly
#

my command handler and event handler uses 4mb

quartz kindle
#

4mb is a lot lol

#

my files are mostly < 10kb

crimson vapor
#

find an api

#

use it

#

ez

restive furnace
#

i think it has api too

unique nimbus
#

it has one

#

but it costs

restive furnace
#

noo its best rip

uneven wyvern
#

since when does that sht have an api?

#

is there any way that that str.match() dont returns an array?

#

ever

modest maple
#

since agess

#

not all APIs are free

sudden geyser
#

Shimano you could use a different method, but it depends.

modest maple
#

and alot of sites use back end APIs

#

just theyre protected and locked

#

all of my backend APIs are locked and protected with oauth

prime cliff
#

APIs do require bandwidth, storage and cpu especially if it has image generation so yes APIs do cost money

sudden geyser
#

the npm package you found is just a wrapper for an api

uneven wyvern
#

Shimano you could use a different method, but it depends.
@sudden geyser wym

modest maple
#

anything covid related is not useful for a bot

prime cliff
#

Probably 10 covid bots listed on DBL

modest maple
#

there are over 100 in queue rn

#

it isnt and wont be unique

unique nimbus
#

yes

modest maple
#

because all of them use the same god damn API scraped from the same site

earnest phoenix
#

can someone tell me if this code is right

modest maple
#

the only dude who deserves credit for a corona bot is the guy who actually made the api that just about every corona tracker bot uses

uneven wyvern
#

@earnest phoenix send it

earnest phoenix
#
  const wait = require('util').promisify(setTimeout);
  bot.guilds.forEach(g => {
    g.fetchInvites().then(guildInvites => {
      invites[g.id] = guildInvites;
    });
  });


  bot.on('guildMemberAdd', member => {
  
    member.guild.fetchInvites().then(guildInvites => {
    
      const ei = invites[member.guild.id];
      
      invites[member.guild.id] = guildInvites;
     
      const invite = guildInvites.find(i => ei.get(i.code).uses < i.uses);
   
      const inviter = client.users.get(invite.inviter.id);

      const logChannel = member.guild.channels.find(channel => channel.name === "join-logs");
    
      logChannel.send(`${member.user.tag} joined using invite code ${invite.code} from ${inviter.tag}. Invite was used ${invite.uses} times since its creation.`);
    });
  });
uneven wyvern
#

come one

earnest phoenix
#

well it say Cannot read property 'get' of undefined

#

oh wait

#

omg client.users.get

#

lol it has to be bot

sudden geyser
#

where did you even define client

summer torrent
#

bot

earnest phoenix
#

i have 2 bot one is client and other is bot i was doing 2 at once so i got confused

#

I AM NOT 2 DIFFRENT BOTS

#

*different

tight plinth
#

*src/events/guildCreate.js

crimson vapor
#

I dont think so

#

but maybe

#

you can test with evaling an emit

golden condor
#

Hello

#

I am tryna move to v12 in discord.js

#

And I get this error with embeds

#

(node:28267) UnhandledPromiseRejectionWarning: TypeError: fields.flat is not a function

#

What does it mean and how do I fix it

crimson vapor
#

do node -v

#

and say what it says

tight plinth
#

upgrade node

#

I know Im doing smth wrong, but idk what

crimson vapor
#

yes

#

you forgot the module.exports =

tight plinth
#

no

#

restarted, fixed itself

#

waat

crimson vapor
#

ok nvm then

#

thats not efficient though

tight plinth
#

it works

crimson vapor
#

every message will cache message.js

#

so lets say you get 3 messages a sec

#

thats more ram

tight plinth
#

wdym

crimson vapor
#

using require

#

change js client.on('message' async message => { require('./src/events/message.js')(client, message, dbl, queue, messageCounter); }) to

Const MessageFile = require('./src/events/message.js')

client.on('message', async message => {
  MessageFile(client, message, dbl, queue, messageCounter)
})```
tight plinth
#

ok

crimson vapor
#

it should still work

earnest phoenix
#

const invite = guildInvites.find(i => ei.get(i.code).uses < i.uses);
i cant find what's wrong with this xcmeep

#

Cannot read property 'get' of undefined

#

it looks fine to me

#

or i am just dumb

tight plinth
#

ei.get

#

still works

earnest phoenix
#

ik but it say that

#
    g.fetchInvites().then(guildInvites => {
      invites[g.id] = guildInvites;
    });
  });

is this right

tight plinth
#

no, and thats a privacy branch

earnest phoenix
#

how does one fix

tight plinth
#

to fix that, you just delete this

earnest phoenix
#

k

golden condor
#
(node:28881) UnhandledPromiseRejectionWarning: TypeError: fields.flat is not a function

    at Function.normalizeFields (/rbd/pnpm-volume/6290b71c-6a1d-4514-9546-23b51fb40976/node_modules/.registry.npmjs.org/discord.js/12.0.2/node_modules/discord.js/src/structures/MessageEmbed.js:436:8)

    at MessageEmbed.setup (/rbd/pnpm-volume/6290b71c-6a1d-4514-9546-23b51fb40976/node_modules/.registry.npmjs.org/discord.js/12.0.2/node_modules/discord.js/src/structures/MessageEmbed.js:70:91)

    at new MessageEmbed (/rbd/pnpm-volume/6290b71c-6a1d-4514-9546-23b51fb40976/node_modules/.registry.npmjs.org/discord.js/12.0.2/node_modules/discord.js/src/structures/MessageEmbed.js:11:10)

    at embedLikes.map.e (/rbd/pnpm-volume/6290b71c-6a1d-4514-9546-23b51fb40976/node_modules/.registry.npmjs.org/discord.js/12.0.2/node_modules/discord.js/src/structures/APIMessage.js:164:40)

    at Array.map (<anonymous>)

    at APIMessage.resolveData (/rbd/pnpm-volume/6290b71c-6a1d-4514-9546-23b51fb40976/node_modules/.registry.npmjs.org/discord.js/12.0.2/node_modules/discord.js/src/structures/APIMessage.js:164:31)

    at WebhookClient.send (/rbd/pnpm-volume/6290b71c-6a1d-4514-9546-23b51fb40976/node_modules/.registry.npmjs.org/discord.js/12.0.2/node_modules/discord.js/src/structures/Webhook.js:145:62)``` How can I fix this with embeds
crimson vapor
#

update node

loud salmon
#

does node of a separate manual to learn or do I just look at javascript's manual?

crimson vapor
#

node just runs js files

earnest phoenix
#

lol

loud salmon
#

hey, i have no idea about programming here

open flicker
#

https://hasteb.in/ajorubiq.php
error DiscordAPIError: Target user is not connected to voice.
what's wrong? The error appears after I exit the voice channel

#

all problem solved

heavy marsh
#

I am on discord.js v12.0.2
I am trying to make a command so that when a user does one certain command It will send a message to a certain channel for example
bot.channels.cache.get(`xxx`).send(`bloa vloa vloa`)
How can this be done when the bot is sharded?

earnest phoenix
#

ah yes `` the rewrite

#

my favourite version

#

/s

heavy marsh
#

I edited the message I hit enter before

earnest phoenix
#

i'm pretty sure you're going to have to use broadcastEval

loud salmon
#

if I want to send a list of items, how should I do it? I'm not really good at programming so I've been doing the idiot way of sending a large number of messages instead.

earnest phoenix
#

in which library

heavy marsh
#

broadcastEval hmm ok

loud salmon
#

node js

earnest phoenix
loud salmon
#

oh, I mean like a numbered list

#

something that gives out:

  1. A
#
  1. B
#
  1. etc
earnest phoenix
#

map provides you with an index argument which allows you to get the position of the element in the array

loud salmon
#

okay, thanks

loud salmon
#

and how would I make it so that there are multiple pages to the list?

valid holly
#

What are you exactly trying to do ?

#

Making a list is as simple as joining strings by \n

loud salmon
#

I'm trying to make a list of monsters for a text-based rpg I'm trying to create on discord.

#

so when the user hits the necessary keyword and prefix, an alphabetical list of monsters appear

#

and there will be many monsters so having them appear all at once is too much. Thus I want to also include something that allows the user to flip through 'pages'

valid holly
#

Well there's more to that than making a list.

#

First have an array.

#
var monsterlist = [
  "Monster1",
  "Monster2",
  "You",
  "Monster4"
];
#

Then:

#
monsterlist.sort();
#

This will sort everything alphabetically and in ascending order, placing You as the first monster in the list.

#

sort() is an Array method.

vestal star
#

How much bandwidth should my bot use?

valid holly
#

Then displaying the actual list you can join everything by \n

pale vessel
#

i'm pretty sure Y comes after M

tight plinth
#

Lol

valid holly
#

I'm too high

pale vessel
#

me too

#

how did i mess up that sentence

#

you need reverse() method

#

after sorting

valid holly
#

sort() is sorting strings alphabetically in an ascending order.

#
var x = [
"B",
"C",
"A"
];
x.sort(); // [ "A", "B", "C" ]
x.sort().reverse(); // [ "C", "B", "A" ]
loud salmon
#

okay

#

what do you mean by join everything by \n? isn't \n mean newline or am I thinking of something else?

pale vessel
#

x.sort() is not needed

topaz fjord
#

You can join by \n

pale vessel
#

yes \n means newline

loud salmon
#

I need to have the monsters numbered so that when user chooses a number, it will display the corresponding monster's stats.

vestal star
#

How much bandwidth should my bot use? I don't really care how much it uses, but I would like to know why it uses 50kb/s. My bot is a text bot (not a music bot) with 36 servers.

valid holly
#

Then easiest method to slice info in a nice format (recommend Embed Message)

var monsterlist = [
  "Chair",
  "Monster",
  "Ducktape",
  "Apple"
];
var x = monsterlist.sort(); // [ "Apple", "Chair", "Ducktape", "Monster" ]

x.slice(0,2); // [ "Apple", "Chair" ]
x.slice(2,); // [ "Ducktape", "Monster" ]
#

Send a message with first items, then update on request with the rest

#

There are more methods of doing it, but this is basically simple.

#

Ex: You'ld have a list of 100 items, divide it by 5 and have 20 items per "page".

loud salmon
#

okay thanks

#

I know what to do now.

valid holly
#

You can for loop the array, iterate through elements, have an integer inside a variable that you add 20 every time it receives update requests from user input, and stop it when i >= array.length

#

Then slice with the integer from i

loud salmon
#

OK

earnest phoenix
#

how do i highlight a text in purple?

#

i'm aware that you can use syntax highlight, but it doesn't seem you can get purple through that method`?

copper cradle
#
std::cout << "no, you can't" << std::endl
earnest phoenix
#

is there any other metod to color code text?

copper cradle
#

not really

#

syntax highlighting is the only way of coloring text on discord

earnest phoenix
#

seems kinda counter intuitive since names can be any color

copper cradle
#

well that's why roles exist

#

can by?

valid holly
#

You can make it like this, here is an idea:

#

Make 2nd embed the list, play an animated gif that basically "loads" the next page and update embed with gif, timeout 1 sec then update with list

earnest phoenix
#

can be*

#

so generate an image?

valid holly
#

Nah

#

Too much hussle

#

@loud salmon

#

Made embed the same size as the gif

#

12 lines + footer 60 invisible spaces

#

When you update there will be no change in embed size

#

But this is purely optional, just an idea to make it unique.

#

You can also have a fade effect on the loading gif, for smoother slideshow

#

But yeah good luck with your code.

#

Omfg when I'm high I have the best ideas @tidal parrot

tidal parrot
#

yoooo

#

wait

valid holly
#

What if you'ld make gifs out of a movie, then update embed message with each gif sequentially to play the movie

#

Short films ofc

tidal parrot
valid holly
#

Cinema Bot

tidal parrot
#

ooo

valid holly
#

Update them and have "cinema slots"

#

not more than 50 people watching the movie across client

#

So no abuse/insane ram usage

#

yoo I need to smoke another one

#

Ima become next Elon Musk

tidal parrot
#

bruh

#

I'm all out of weed and no dealers available cuz of lockdown

#

you lucky fuck

#

send some

valid holly
#

mine is literally next door

mossy vine
#

yall sure you wanna discuss this in this channel

tidal parrot
#

shhh

valid holly
#

👀 👮

earnest phoenix
#

how will you ensure that the gifs transition smoothly into each other?

mossy vine
#

you cant

earnest phoenix
#

you hope that your end user doesn't live in venezuela and has trash internet

digital ibex
#

hi

#

when i use my eval command i get this error args is not defined when it is

#

any ideas?

#
    execute: async (message, client, args) => {
        try {
            const { token, prefix } = require('.././/..//config.json');
            // const args = message.content.slice(prefix.length).split(/ +/);``` like, i defined it both here but still
#

it says args isn't defined

valid holly
#

@loud salmon Here is more lmao

#

Have items as emotes for each monster (I put pepes cause that's what I had) then have them highlighted with hover info and clickable link to the monster docs

earnest phoenix
#

@digital ibex remove the //

valid holly
digital ibex
#

even when i have it uncommented

#

it still returns its not defined

earnest phoenix
#

execute: async (message, client, args) => {
const args = message.content.slice(prefix.length).split(/ +/);
try {
const { token, prefix } = require('.././/..//config.json');

digital ibex
#

OH

#

IM DUMB

valid holly
#

how many directories do you need to back ?

digital ibex
#

i was using the wrong command :p

#

a few...

earnest phoenix
#

ik i have never seen that type of directories

digital ibex
#

well

#

you've seen it now

earnest phoenix
#

PepeExplosion that's an bad idea

digital ibex
#

i guess

#

what

earnest phoenix
#

nothing as long as it works

digital ibex
#

also

#
fs.readdirSync(`./commands/${dir}/`).filter((file) => file.endsWith('.js'));
```why is this only reading files which is is only `.js`?
valid holly
#

Because you put the filter to do so ?

digital ibex
#

green 1 works, not the other 1

#

what

#

i mean

valid holly
#

If it's a command handler just:

const command = "example"; // This would be your command from user input
require("./p/a/t/h/to/folder/with/commands" + command + ".js");
digital ibex
#

w-

#

no

valid holly
#

Idk I'm too high

digital ibex
#

:/

#

k

zenith terrace
#

un momento

#
fs.readdir("./commands/", (err, files) => {
  if (err) console.error(err);
  let jsfiles = files.filter(f => f.split(".").pop() === "js");```
#

@digital ibex

digital ibex
#

thats-

zenith terrace
#

Wait

digital ibex
#

that won't allow u to use dirs

#

and

zenith terrace
#

Have u got the nested

digital ibex
#

no

#

wait

#

yeah, no

zenith terrace
#

What have you got dir defined as

digital ibex
#

dir

#

🙃

zenith terrace
#

<_<

digital ibex
#

like, my file management ting is lost/commands/directory/command

#

for commands

zenith terrace
#

What is dir define as since you are doing ${}

digital ibex
#

if u use ur 1 its lost/command/command

#

wot

#

its defined as dir

valid holly
digital ibex
#

desu, u can't rly talk, pls ty

zenith terrace
#

You dont need the ${} in the command handler

digital ibex
#

what

#

@zenith terrace

hybrid bone
#

Hello i have a problem

#

How speak french please?

digital ibex
hoary dawn
#

How do I change the prefix

#

In a server

zenith terrace
#

Make a prefix command

hoary dawn
#

How?

zenith terrace
#

Have a look there first

regal saddle
#

whats that, discord.js docs

#

Dafuq?

zenith terrace
#

No

regal saddle
#

No
Yes

zenith terrace
#

Yes
No

regal saddle
#

No
Yes
No
Yes

zenith terrace
#

No
Yes
No
Yes
No

amber fractal
#

Nice development talk

regal saddle
real summit
#

yes very helpful tysm

regal saddle
#

No Problem, when you need more help. Dm me.

zenith terrace
#

oof

#

i forgot this was the dev talk

hoary dawn
#

I still don't understand it

regal saddle
#

I still don't understand it
@hoary dawn, what do you need?

#

explain the people here what you need

hoary dawn
#

How to change prefix in the server

#

I added zerotwo in my server but I want to change the prefix

zenith terrace
#

...u want to change zerotwos..?

hoary dawn
#

Yes the prefix

zenith terrace
#

...........this aint the support server

hoary dawn
#

Then?

#

It brought to here

#

Me*

zenith terrace
hoary dawn
#

Thank you

wide ridge
#

I keep getting a permissions error 50013 with POST (d.js v12)

0|index    | 26-03 21:12:54.010:     at RequestHandler.execute (/root/bot/node_modules/discord.js/src/rest/RequestHandler.js:170:25)
0|index    | 26-03 21:12:54.010:     at runMicrotasks (<anonymous>)
0|index    | 26-03 21:12:54.010:     at processTicksAndRejections (internal/process/task_queues.js:97:5) {
0|index    | 26-03 21:12:54.010:   name: 'DiscordAPIError',
0|index    | 26-03 21:12:54.010:   message: 'Missing Permissions',
0|index    | 26-03 21:12:54.010:   method: 'post',
0|index    | 26-03 21:12:54.010:   path: '/channels/692488724008927333/messages',
0|index    | 26-03 21:12:54.010:   code: 50013,
0|index    | 26-03 21:12:54.010:   httpStatus: 403
0|index    | 26-03 21:12:54.010: }

I'm checking for:

  • ATTACH_FILES
  • SEND_MESSAGES
  • ADD_REACTIONS
  • EMBED_LINKS
  • USE_EXTERNAL_EMOJIS
  • READ_MESSAGE_HISTORY
  • VIEW_CHANNEL
  • MANAGE_EMOJIS
  • MANAGE_MESSAGES

I still don't know what's causing the problem. Any suggestions? My bot is very simple. It sends, edits, and deletes its own messages. Sometimes sends images, and adds reactions to its own messages.

zenith terrace
#

Oof ?

#

Idk

sudden geyser
#

Can you show the code that's causing the error?

earnest phoenix
#

i'm guessing it's sending a message

#

since it's a POST request to the messages endpoint

#

gopi, are you sure you're actually checking for those permissions?

#

be sure to prioritize channel overwrite permissions over guild permissions

grim aspen
#

are you sure it's not muted?

mystic violet
#
function Eq(configs, bassboostgain) {

    console.log(bassboostgain)

    const bands = configs.BassboostBands

    tmp = []

    bands.map(band => {
        band.gain = band.gain + bassboostgain
        tmp.push(band)
    })

    return tmp

}```
#

when I input 1

#

into bassboost gain

#

it works

#

but when I insert 0 again

#

its the same output

#

any idea why?

#

It just adds more on

#

and doesn't reset it

#

like the "const" implies

astral yoke
#

Trying to make it find the command handler but I don't know how to put it correctly. What you have to do is go into the file handlers, then go into the command.js one. How would I properly do it?

#

Code:

#

const Command = require("../handlers/command"),

#

Error:

#

[2020-03-26 19:10:06]: [Error]: Error: Cannot find module '../handlers/command'

#

For js.

#

nevermind, i fixed.

slate oyster
#

My old version of my bot has a help command

#

but I dropped support in the rewrite

#

It was underused

earnest phoenix
#

You literally dropped support for the help command??

slate oyster
earnest phoenix
#

But

#

Why

#

That's like the worst thing you can o

#

Do

slate oyster
wide ridge
#

be sure to prioritize channel overwrite permissions over guild permissions
@earnest phoenix do you have any code snippets on how to prioritize channel overwrites?

earnest phoenix
#

Again, why the fuck would you drop your help command?

#

It's like giving you a new closet without any instructions

#

Or a car without even knowing how to drive

heavy anchor
#

Good point^

earnest phoenix
#

Your bot won't even get accepted if it doesn't have a help command lol

copper cradle
#

yes lmao

earnest phoenix
#

hm

honest whale
#

Does anyone know what a .then in js is equivalent to in python

#

I just recently started working in discord py

copper cradle
#

await

earnest phoenix
#

How i can conect a page with a webhook? Discord.js 11v

copper cradle
#

use async functions @honest whale

earnest phoenix
#

Help?

restive furnace
cunning glen
#

you could give a little command or something? 🙂

dusky marsh
#

npm i

cunning glen
#

it warrn

#

error

dusky marsh
#

warns dont matter, errors do

mossy vine
#

npm i quick.db

#

also youre probably missing build tools

cunning glen
#

npm i quick.db
@mossy vine still fails

mossy vine
#

what is the error

cunning glen
#

npm i --global windows-build-tools --vs2015

#

virtual server it

astral yoke
#

how would i make a set prefix command that is able to go to a database that supports heroku

pale vessel
#

you need a remote database

astral yoke
#

can you recommend one

mossy vine
#

mongodb atlas

finite bough
#

Mongo db

earnest phoenix
#

um

small prairie
#

can we edit a message and add attachment in it discord.js?

tight plinth
#

I've done a function that search a guild member by its username and return member. The problem is that if member exists every member propriety returns undefined. Here is an output of the function if I search myself

#

it works, but member.user is undefined

#

member.guild too

#

strange

#

username is a string

pale vessel
#

can you try adding .user after .find? just for debugging

#

and console log it

tight plinth
#

k

#

returns the same as message.member.member

#

hmmm

pale vessel
#

omg

#

nvm

tight plinth
#

wait a second

pale vessel
#

nah it was the letter

tight plinth
#

removed the async

#

and now...

pale vessel
#

cache is not a promise

tight plinth
pale vessel
#

ok

#

cache returns a collection

modest maple
#

icon_url or somthing like then i imagine

pale vessel
#

why me

zenith terrace
#

Cause yes

pale vessel
#

it's for image url (or an attachment)

zenith terrace
#

I mean it can be the display avatar one

summer torrent
#

avatarURL()

zenith terrace
#

it can be either at times

pale vessel
#

avatarURL() won't return default avatar iirc

#

displayAvatarURL() does that

earnest phoenix
#

So i have a command called userinfo also serverinfo but it shows the still icons and avatars of the users and servers but when the users or server has an animated icon or avatar it still shows a still image of the animated avatar or icon's first frame... and it doesn't show the animated gif used as icon or avatar... What's the code to fix that?...
I use displayAvatarURL() for users and
iconURL() for server icon.....

#

(discord.js v12.0.2)

valid holly
#
URL({
dynamic: true,
size: 1024,
format: "png"
});
marble juniper
#

here are the image url options

valid holly
#

dynamic suits for your problem here, as it returns .gif format for animated and it defaults to .png as mentioned in format if !gif

marble juniper
#

and also look at the docs

earnest phoenix
#

Oh nice... Thx for the help...

valid holly
#

Recommend using png as default format, a lot of people use avatars with transparent bg

marble juniper
#

png uses less compression

#

and also transparency

earnest phoenix
#

/transparency

valid holly
#

^ better for graphic avatars

earnest phoenix
#

Yeh

#

Jpng => less size
Png => high size...

valid holly
#

webp < jpg

marble juniper
#

dynamic is set by default to false so this is why you need to set it first

prime cliff
#

Yup always use webp for Discord avatar in bot commands

valid holly
#

webp can't be viewed on mobile

earnest phoenix
#

Hmm...

prime cliff
#

It can

golden condor
#

Hello, using d.js v12, this code won't work js client.user.setActivity(`c!help | ${client.guilds.cache.size} servers | ${client.users.cache.size.toLocaleString()} users`); client.user.setStatus("dnd")

valid holly
#

if in embed maybe

marble juniper
#

but this is a browser enviroment

prime cliff
#

It still can on browser

valid holly
#

iOS nah

prime cliff
#

Except for safari

#

Safari and ios is bad though so lul

earnest phoenix
#

Webp can be viewed on mobile... I tested it before...

valid holly
#

to be as friendly as possible, - the size use png @earnest phoenix

golden condor
#

Hello, using d.js v12, this code won't work

client.user.setActivity(`c!help | ${client.guilds.cache.size} servers | ${client.users.cache.size.toLocaleString()} users`);
 client.user.setStatus("dnd")```
prime cliff
#

It can but not on IOS @earnest phoenix

#

Safari does not support it yet

earnest phoenix
#

Hmm... Might be true cuz I'm not an IOS user @prime cliff

marble juniper
#

don't copy and paste your message again just wait for someone to help you @golden condor

#

hecc

golden condor
valid holly
#

setPresence in v12

marble juniper
#

also why do you need the .toLocalString()

golden condor
#

Thx

valid holly
#

Instead of setActivity

golden condor
#

What about the setStatus

marble juniper
#

its the same

valid holly
#
setPresence({
activity {},
status: ""
});
golden condor
valid holly
#

setPresence({
activity {
name: "your game"
},
status: "your status"
});
golden condor
#

Like that

#

client.user.setPresence({
activity: {
name: c!help | ${client.guilds.cache.size} servers | ${client.users.cache.size.toLocaleString()} users},
status: "dnd"});

valid holly
#

👍

golden condor
#

It stil didn't work tho

valid holly
#

you sure on v12 ?

golden condor
#

Should i try catch

#

Yes

marble juniper
#

did you stop the bot and restart it

golden condor
#

Yes

valid holly
#

console log it yes

#

but also .then

#

No need to use toLocaleString() as it will convert to string

#

it's inside ``

golden condor
#

.then(console.log("success")).catch(e => console.error(e))

valid holly
#

👍

golden condor
#

It said success but still no status is showing up

#

wtf

#

I don't get the problem

fallow wigeon
#

Hi guys I have a question. When I make a Streaming Status on my Bot on PC then theres Playing but on Mobile theres Streaming.

Can someone help me?

earnest phoenix
#

Use setActivity @golden condor

valid holly
#

He's on v12

earnest phoenix
#

Still it's not working

golden condor
#

How about going on dnd

earnest phoenix
#

Are you sure you're on v12?

golden condor
#

Yes I am fucking sure

#

I just spent the past 3 hours rewriting to v12

#

And I have updated it

earnest phoenix
#

Restart the bot and add the code in ready event

golden condor
#

Otherwise I wouldn't be able to use the code

#

What about going on dnd

valid holly
#

you can still use setStatus

golden condor
#

It worked

earnest phoenix
#

Depreciated

#

@golden condor what you did?

fallow wigeon
#

Hi guys I have a question. When I make a Streaming Status on my Bot on PC then theres Playing but on Mobile theres Streaming.

Can someone help me?

golden condor
#

.setActivity

earnest phoenix
#

@fallow wigeon it needs an url

valid holly
#

I thought v12 wasn’t released tho