#development

1 messages Β· Page 762 of 1

earnest phoenix
#

legacy code my guess

modest maple
#

it does sometimes still come up

uneven wyvern
#

is this for js tho cause thats what im using atm ?

modest maple
#

everything

#

this is discord in general

uneven wyvern
#

oki πŸ™‚

earnest phoenix
#

the gateway today is not the same as the discord gateway back in 2016

#

i'm guessing the client had to make an additional request to get the user's nickname

#

hence the exclamation mark

#

but right now the entire member object is sent through the gateway/rest

#

so the exclamation mark is obsolete

#

no idea why it's still in the client

modest maple
#

still used

earnest phoenix
#

uh

#

i know

#

that's not what i was talking about

#

i was talking about how the exclamation mark is obsolete but the client still does it

modest maple
#

oh yh

west spoke
#

The ! is for nicknames i think

knotty steeple
#

they said above its not used anymore

#

in the api

peak venture
#

Ahm. how do i count every member on all the servers my bot is active on?

fleet chasm
#

including bots?

peak venture
#

excluding bots

modest maple
peak venture
#

@earnest phoenix upload it to top.gg

modest maple
fleet chasm
#

hmm

#

from what i see, youll have to do something with client.users and user.bot

#

not very good with collections, sorry

peak venture
#

ah nP. πŸ™‚

knotty steeple
#

dont use <Client>.users.size

#

if you want a real count

#

thats only cached users

#

to find a true user count you have to iterate through each guild adding their member count together

fleet chasm
#

(and make sure each user is not a bot)

knotty steeple
#

cant really do that unless you check every member

#

which takes too long

peak venture
#

<Client>.users.size seems to give undefined anyway

#

What would make every user including bots be like then?

knotty steeple
#

however you do it in discord.js

#

just loop through each guild

modern summit
#

hey, idk if this is the right place to ask questions, but could someone help me? I'm trying to have the bot check for answers from the people in my server, and then respond if that person was correct or not

knotty steeple
#

you can just use a foreach on <Client>.guilds

#

@earnest phoenix try to think of commands on your own

#

@modern summit please dont do that

fleet chasm
#

would a collector work?

knotty steeple
#

you will get ratelimited

#

use awaitMessages

modern summit
#

don't ask questions?

knotty steeple
#

then you can wait for a message

#

dont do it the way you currently are

modern summit
#

oh ok well

knotty steeple
#

wouldnt args be something after a command

modern summit
#

I'm new so Idk how else to do it

#

yea

knotty steeple
#

like !trivia 1 2

#

that kinda loses the point then

modest maple
#

@modern summit sending everything separately will get you ratelimited and API abuse

#

use block quotes

modern summit
#

I shall google whatever those are

#

thanks

fleet chasm
#

youll get delays

knotty steeple
#

u dont need blocks

#

just send it in 1 message

modest maple
#

block quotes r still handy

modern summit
#

well I wanted it formatted neatly

knotty steeple
#

you rather use

1. f
2. u
3. c
4. k
#

or an embed

modest maple
#

you can either use block quotes or put \n at the end of each part and send as one long long string

fleet chasm
#

\n is a neat whitespace

knotty steeple
#

what discord.js version are you using

#

stable? latest?

#

maybe v11

modern summit
#

latest ye

knotty steeple
#

wait

#

stable

#

or master

modern summit
#

uh idk I just followed the tutorial

#

how would I find that

warm marsh
#

Package.json

knotty steeple
#

so you are following a tutorial to make a discord bot?

modern summit
fleet chasm
#

did you run npm i discord.js?

knotty steeple
#

ok ur using v11

#

use awaitMessages

modern summit
#

okay maybe a trivial pursuit bot wasn't the best place to start lol

knotty steeple
#

have you properly learned js

#

its not that hard

fleet chasm
#

you can try using the example as a learning point if its hard

modern summit
#

no, not really I know C# alot better

#

and I've heard that js is commonly known as the easier one

knotty steeple
#

then use a c# lib

#

lmao

modern summit
#

I wasn't aware that I could

#

I thought they were strictly in js

knotty steeple
#

no?

#

why would they be

modern summit
#

I should probably learn js either way though

knotty steeple
#

look at which you like

earnest phoenix
knotty steeple
#

ey

#

ey

modern summit
#

but like

#

I should still know js though right

earnest phoenix
#

well

knotty steeple
#

not really

#

unless ur gonna make websites

#

js helps

earnest phoenix
#

it really depends on what you're planning on doing/doing right now

#

js is not for everything

knotty steeple
#

try using js to make a desktop app

modern summit
#

I'm planning on going into computer science / game development , and I'm currently just dicking around in unity

knotty steeple
#

electron omegelul

fleet chasm
#

its best to stay on your main language, but if you want you can branch out
id recommend youd stay on c#, its easier

knotty steeple
#

well c# is also better for game dev

earnest phoenix
#

js is easier than c#

#

but c# is way more performant

knotty steeple
#

and u can make native apps

earnest phoenix
#

that too

fleet chasm
#

its easier for them not generally*

knotty steeple
#

generally js is easier yes

earnest phoenix
#

it is generally

modern summit
#

aight so time to completly uninstall node.js lol

earnest phoenix
#

js is not oop

#

which makes it really easy to pick up

knotty steeple
#

why do u think i still use it

earnest phoenix
#

lol

fleet chasm
#

i miscommunicated but oh well

modern summit
#

C# looks alot more "english" to me than other languages

#

like it looks easier to read to me

knotty steeple
#

the other language ive used is lua for trying to mess with love2d

#

and game dev

earnest phoenix
#

lua more like

#

t O I L E T

knotty steeple
#

nO

glacial anchor
#

alright

#

so im gonna try and hardcode this nsfw lock thing, as you all ask

modest maple
#

what discord asks*

glacial anchor
#

do songs need an nsfw lock tho

#

they may have rude language

modest maple
#

thats not how that works lmao

tidal relic
#

What a useful answer

modest maple
#

im tryna respond inbetween karaoke

#

but basic rule

#

NSFW Content in anyway shouldnt not be able to be sent in a SFW channel

glacial anchor
#

so even links are not tolerated

#

?

unkempt ivy
#

what defines nsfw content

glacial anchor
#

gore, porn, etc

tidal relic
#

Something that shouldn't be viewed as a child or at work

modest maple
#

Not safe for work (NSFW) is an Internet slang or shorthand used to mark URLs and hyperlinks which link to videos or websites pages that contain nudity, intense sexuality, profanity, violence or other potentially disturbing subject matter, which the viewer may not wish to be seen looking at in a public or formal environment, including a workplace, school or in a family setting.[1][2] NSFW has particular relevance for people trying to make personal use of the Internet at workplaces or schools which have policies prohibiting access to sexual and graphic subject matter

#

and no links wouldnt be tollerated

glacial anchor
#

shit

#

i wonder if newgrounds have some sort of filter

tidal relic
#

@glacial anchor an easy fix to this would be to just lock all links to NSFW channels

unkempt ivy
#

so p0rnhub links are πŸ‘Ž

glacial anchor
#

wait but if a website has a thing like "are you 18"

unkempt ivy
#

lol

glacial anchor
#

is this still nsfw?

unkempt ivy
#

@tidal relic that is way overkill

tidal relic
#

No

modest maple
#

technically thats what the NSFW channels do

glacial anchor
#

no shit im not locking the whole bot on nsfw

#

@modest maple but if the website itself has it

#

is this fine? or i still need to make an nsfw filter

tidal relic
#

If there's no way to easily check the rating, which was your problem in the first place, then why not?

modest maple
#

no as you're still sending it, if that link has a chance of having an NSFW Preview etc its still counted

glacial anchor
#

not a preview

#

it does not preview images

tidal relic
#

Unless you want to manually make a request to the NG post to check if it's NSFW

earnest phoenix
#

if a command has potentionally nsfw content, it has to be locked to nsfw channels only

modest maple
glacial anchor
#

ok so im locking all commands besides song stuff nsfw only

modest maple
#

any thumbnails descriptions etc.. are πŸ‘Ž if they contain nsfw stuff

glacial anchor
#

as i cant make that filter because of the shitty web scraper

#

so whats that command again

modest maple
#

i mean you could

glacial anchor
#

msg.channel.nsfw?

unkempt ivy
#

which lib

modest maple
#

i think its is_nsfw() which returns a bool (python)

glacial anchor
#

discord.js

#

@unkempt ivy @modest maple

tidal relic
glacial anchor
#
if (<TextChannel>.nsfw) { return <TextChannel>.send("uh oh") }```
unkempt ivy
#

rtfm

glacial anchor
#

?

tidal relic
#

Sure

glacial anchor
#

doesnt work

tidal relic
#

Wait did you just copy and paste exactly what you wrote

glacial anchor
#

no

#

i might be dumb

#

but not that dumb

tidal relic
#

Ok

#

What was the error?

glacial anchor
#
if (msg.channel.nsfw) { return msg.channel.send("uh oh") }```
earnest phoenix
#

what didn't work

#

provide more context

glacial anchor
#

unexpected token..?

#

for the whole line

earnest phoenix
#

what's your entire code

#

in a paste service pls

glacial anchor
#

do i really have to send itpepowot

#

its super messy

earnest phoenix
#

...which would explain how you have a syntax error

modest maple
#

you want help?

#

xD

glacial anchor
#

now it doesnt output the error

#

yet it is not locked too

earnest phoenix
#

because what you're doing is

#

checking if the channel is nsfw

#

and if it is nsfw, return out of it

#

you want to do the opposite

glacial anchor
#

??

#

so do i just put an exclamation mark

earnest phoenix
#

yes

glacial anchor
#

before msg.channel.nsfw

earnest phoenix
#

negate the boolean

glacial anchor
#

alright

#

ok, i locked all commands except music related

#

am i good now?

tidal relic
#

Should be

amber fractal
#

fucking penis vagina sex

glacial anchor
#

i mean, those are the first words i came up with

#

ok, im gonna go sleep

#

i swear if it goes down again

#

im gonna be so mad

deep wedge
#

Has anyone every tried to make a userinfo command that would work on people outside of the server?

sudden geyser
#

yes, you can do it.

#

what library

deep wedge
#

Djs I know how to do it jsut wondering if any big bots have it

modest maple
#

@weak parrot isn't that what Jack does?

weak parrot
#

Yes and I have seen a couple other bots who do it but I don't do JS

earnest phoenix
#

how it usually works is

#

try to find user in guild -> if not found look up your user cache on the client -> if not found use fetchUser which will return basic info on the user regardless of shared guilds

weak parrot
#

In C# you just use DiscordUser rather than GuildUser 😩

earnest phoenix
#

well

#

depends which lib

weak parrot
#

Both libs. Both D.net and DSharpPlus use
Guild and Discord user objects (granted there are other C# libs but generally they're not really work talking about)

earnest phoenix
#

im aware

#

dsp uses more accurate namings

weak parrot
#

Both do their job so shrug.

earnest phoenix
#

doing it's job properly?

#

what a joke

#

i used it for a while and still use it to this day in some projects

#

im going to be migrating to disqord though

weak parrot
#

Uhh what? What would you define as "broken"?

earnest phoenix
#

half of the things don't work. CacheMode? doesn't work, casting Socket types back to their interfaces and then force downloadng in cache doesn't work, the lib makes 4 extra unnecessary requests to just call one endpoint

#

etc etc

#

plus d.net is missing out on so many features the api offers right now

weak parrot
#

I do agree with you on the last part as for the rest never really had to deal with it.

If I can program a bot using a library I wouldn't call it broken but I do agree that it has quite a few flaws

earnest phoenix
#

i just generally suggest using dsp over d.net right now

#

i still have to try out disqord

#

which is supposed to be extremely low allocation

weak parrot
#

Hmm might look into it myself however as it's 03:35 I will be calling it here blobwave

earnest phoenix
#

sameee lol

#

night

soft eagle
#

is this correct im getting a error bc it cant find the channel id or name its discord.js

amber fractal
#

That depends, do you pass channel in your command handler?

soft eagle
#

yes and its an event channelDelete

amber fractal
#

is channel your message Thonk

scenic kelp
#

is it a dm? pretty sure they don't have ids

#

or that

amber fractal
#

because you do channel.guild

#

channels do have a guild as well

#

but it's more common on a message

#

and messages have an id too so I actually dont know

soft eagle
#

this is a event to log when a channel is deleted

#

adding guild didnt do anything

#

my channel create event works but not the delete event

#

idk why it wont work ive been at it the past 40 mins

amber fractal
#

can you just copy paste the code real quick?

#

I know the picture

#

But I'm going to try it in mine

soft eagle
#
module.exports = (bot, channel) => {
    let logs = channel.guild.channels.find("name", "server-logs");
    
    channel.guild.fetchAuditLogs({'type': 'CHANNEL_DELETE'}) 
    .then( logs => logs.entries.find(entry => entry.target.id == channel.id) )
    .then (entry => {
        author = entry.executor;


    const embed3 = new RichEmbed()
    .setColor("RANDOM")
    .setTimestamp()
    .setDescription(`**Action:** Channel Deleted \n**Target:** ${channel.guild.name}\n**Staff:** ${author.tag}`)
    .setThumbnail(channel.guild.iconURL);
    
    logs.send(embed3);
    })
}```
sudden geyser
#

you could try logging entry in the find block and see the difference where target is undefined, or simply check if the prop exists as I assume that's what's throwing

soft eagle
#

channel.id is what is coming undefind from what i belive

amber fractal
sudden geyser
#

you did channel.guild.<...> so I don't think that'd be it

soft eagle
#

what was it?

amber fractal
#

nothing, that's the issue

#

it worked for me

soft eagle
#

strange

amber fractal
#
const {MessageEmbed} = require("discord.js")
module.exports = (client) => {
  client.on("channelDelete", (channel) => {
    if(channel.guild.id != "501853552835297280") return
    let logs = channel.guild.channels.find(c => c.name == "staff")
    
    channel.guild.fetchAuditLogs({'type': 'CHANNEL_DELETE'}) 
    .then( logs => logs.entries.find(entry => entry.target.id == channel.id) )
    .then (entry => {
      author = entry.executor;
      const embed3 = new MessageEmbed()
      .setColor("RANDOM")
      .setTimestamp()
      .setDescription(`**Action:** Channel Deleted \n**Target:** ${channel.guild.name}\n**Staff:** ${author.tag}`)
      .setThumbnail(channel.guild.iconURL);

      logs.send(embed3);
    })
  })
}``` I changed it to meet how I set up my events and that I'm on master, but that shouldn't matter
soft eagle
#

ugg this is stressfull

sudden geyser
#

can you try logging entry to see what you get

soft eagle
amber fractal
#

It doesnt get to entry

sudden geyser
#

it does though, it's line 6

soft eagle
#

^

#

it errors at line 6

amber fractal
#

yeah, line 6 is .then( logs => logs.entries.find(entry => entry.target.id == channel.id) )

#

where it says it cannot read property channel of undefined

#

meaning channel is undefined

#

which it was used before so it shouldnt be

sudden geyser
#

yeah, so it gets to entry, which I assume target does not exist, and throws Cannot read property 'id' of undefined.

soft eagle
#

its id of undifined

sudden geyser
amber fractal
#

Ah yes, there are 2 there

#

Yeah, it's that

#

considering its column is 60

soft eagle
#

so why would it error for me but not u?

amber fractal
#

So target is undefined however entry is not

#

could be cache

soft eagle
#

how would i clear cache ?

amber fractal
#

do what they said and log entry

#

not clear it

#

for some reason your target is undefined

#
    console.log(entry)
    return entry.target.id == channel.id
  })
)``` should suffice for that I believe, it will most likely still error but after logging the entries
#

I have no idea if that is syntactically correct

sudden geyser
#

actually it doesn't really need to be logged, more just guarded with checking if .target is valid

soft eagle
amber fractal
soft eagle
#

still errors

amber fractal
#

did it log the entry

soft eagle
#

i think thats it

amber fractal
#

yeah target is undefined

#

but why

sudden geyser
#

docs bad

soft eagle
#

taget is defined for Steven but not my side for some odd reasson

amber fractal
#

yeah idk

soft eagle
#

this is a mess oof

#

let me try putting it in the main file instead of its own

#

ok same error :/

#

ok i got it

#

sort of

#

i just removed the target and cvhanged it to this bc thats the only way it workd

#

at least it logs now

late hill
#

The api purely returns the id of the target

#

Don't know how discord.js handles that

#

I'd assume they simply use the target id and grab the "target" from your cache

#

The channel is deleted so it isn't there anymore

#

I'd expect it to at least give you the target id but guess not shrug

vital parrot
#

does anyone have a good string for messaging

#

i want my bot to be able to message some a response instead of putting it in a chat

glad charm
#

msg.author.send()

onyx sonnet
#

yee

wooden lance
#

Does anyone know how to find the difference between two arrays in js?

modest maple
#

Wdym

#

Difference in size or what

wooden lance
#

any changes made, i'm trying to finish the logging feature on my bot and it would be quite helpful to be able to say what happened to a given channel/role

#

o wait figured it out

['muffins','are','cool'].filter(x => ['muffins','are','yum'].includes(x)) //['muffins', 'are']
#

now for me to figure out how to get the ones that have changed

digital wagon
#

for docs discord.js version master, it's normal that we don't see the event raw ?

hollow saddle
#

That’s because raw is an undocumented event

digital wagon
#

ok

slim heart
#

how do i find something that's 0 in mongo?

#

i tried { "punishment.amount": 0 } but it doesn't work properly

vital lark
#

hm

earnest phoenix
#

Can anyone give me a best example for making a toggle switch button working with database boolean value(if db data is false then switch should be off and if db data true then switch should be on)
And can change db data with that switch

ruby talon
#

Language, db ect?

earnest phoenix
#

Html, js firebase

ruby talon
#

Oh for in a website xo

earnest phoenix
#

Yea

#

I have that boolen switch value there

ruby talon
#

If your hosting has an API you can probb fetch the status.
Else maybe try to exe a fetch or smth from ur db and check if it raises any error.

#

Β―_(ツ)_/Β―

earnest phoenix
#

But have that data value and i want to make a switch for change it and show for switch status

#

@ruby talon

#

Can discord bot maker bots become 7/24 active?

ruby talon
#

oh, I believe this should work.
(I don't have experience in js)
mybool = ! mybool

earnest phoenix
#

Ah

ruby talon
#

@earnest phoenix that discord bots are online 24/7?

#

Or the makers?

summer torrent
#

@earnest phoenix buy a VPS

earnest phoenix
#

Ok

summer torrent
#

for make 24/7 online

ruby talon
#

@summer torrent that isn't required.

#

You just need to run your program 24/7.

earnest phoenix
#

damn 7 hours per 24 days

ruby talon
#

xDD

slender thistle
#

Normal humans: 24/7 and DD/MM
Americans: 24/7 and MM/DD
Turks: 7/24 AND DD/MM

ruby talon
#

xD

#

Β―_(ツ)_/Β―

summer torrent
#

πŸ€¦β€β™‚οΈ

chilly prairie
#

shivuwu πŸ˜„

earnest phoenix
#

How do I get the top 10 players with the most Int value in MongoDB normal driver NodeJS?

#

like the top 10 players with the most points or something

late hill
#

sort by that field

#

and limit by 10

ruby talon
#

Sort DESC and indeed use LIMIT 10

blissful scaffold
#

It might get a bit harder if you want to get users from one guild, but that depends on how you set up your db tables

ruby talon
#

just add a WHERE filter

quartz kindle
#

nobody noticed he said MongoDB?

storm bluff
#

anyone help me

(node:4860) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:4860) UnhandledPromiseRejectionWarning: #<Object>
(node:4860) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)
(node:4860) UnhandledPromiseRejectionWarning: #<Object>
(node:4860) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 6)```
eager spoke
#

Who pinged?

#

@storm bluff if it's using async/await you should wrap it with try/catch block, if you use the .then() syntax then you need to append a .catch()

storm bluff
#

ok thnx @eager spoke

earnest phoenix
#

How do i make a bot online

fleet chasm
#

what library do you run your bot on?

earnest phoenix
#

discord.js

fleet chasm
#

run node . or node <start file> in your bots directory

earnest phoenix
#

also <client>.login('token here');

#

ive tried that

fleet chasm
#

what is the output*

earnest phoenix
#

both?

#

Wdym?

#

the file name is index.js

fleet chasm
#

did you put <client>.login('token here'); in your start file, and run node index.js?

#

if so, what is your command lines output?

earnest phoenix
#

your token needs to be there yes

#

the bot's token

#

I had to hide cuz u know

fleet chasm
#

well

earnest phoenix
#

oh

fleet chasm
#

is the bot outputting an error?

earnest phoenix
#

no when i type node . it doesnt do anything

fleet chasm
#

try node index.js

earnest phoenix
fleet chasm
#

in your bots dir*

earnest phoenix
#

Ive tried

#

weres that at?

modest maple
#

where ever your directory is?

fleet chasm
#

(the folder of your start file, and libraries)

earnest phoenix
#

' Error: Cannot find module '

fleet chasm
#

npm i discord.js

modest maple
#

@earnest phoenix i suggest you learn the basics of js before attempting bot making

earnest phoenix
#

Were dat at?

wide nest
#

I have a question. I've just finished updating my bot and made some big changes. I'd really like a message to be sent to guild owners with info regarding the changes.
I remember speaking to someone about a month ago here regarding sending a DM to the guild owner on bot join and was told that it's bad practise. I'm not sure if broadcasting like that would also fall into bad practise?

modest maple
#

thats not bad practice thats API abuse

sudden geyser
#

a single user/only the guild owner shouldn't be api abuse

#

wdym by broadcasting?

modest maple
#

i mean it is

fleet chasm
#

i think by broadcasting, sending a message to all guild members

modest maple
#

you would be sending potentially hundreds or thousands of messages to users in a go

earnest phoenix
#

it would depend on the amount of guilds the bot is in

wide nest
#

72 and Guild owner only.

modest maple
#

that would be API abuse then

sudden geyser
#

Oh, every guild owner. I didn't see that. api abuse

wide nest
#

I didn't think about API abuse blobfacepalm

fleet chasm
#

you could try updating your bots page, or maybe warn in its status

wide nest
#

I could just use the playing status

#

Yeah, Lol. Thank you

earnest phoenix
#

I'm trying to make a dashboard
I have a boolean value in my db
And i have a toggle swith on/off button
How can i show my switch default status with that boolean value
Like if my value true then switch should be shown default on automatically
Im using html,css and js

#

do you have a backend server

#

Yes i defined my boolean value correctly there

#

then just add an endpoint in the backend to return the values

#

on page load make a request to that endpoint and give the checkboxes/switches a default value that the request returned

#

Can you give me example plz actually im very noob in html

#

uh

#

...no?

#

do you even know what a backend is

#

Im stuck there from morning

#

No

#

😳

#

then why are you saying you have it

#

a backend server is mandatory for something like a dashboard

#

you cannot just give the end client your database credentials

#

I have that

#

Ill dm u a link u can check

#

i don't have my dms turned on

#

Can you accept my req please

#

I really need help

#

i accepted it

#

but i won't spoonfeed you anything

knotty steeple
#

fun fact

#

(for something that was talked about earlier)

#

if your bot got updated, dont "broadcast" whatever changes there were

#

you can just say in the help command that there are new changes that you can view with a specific command

#

thats what i do anyway

earnest phoenix
#

broadcasting updates does more harm than good

#

i just used a central server for all updates

#

etc

stark dune
#

looks at broadcast command

#

oh

earnest phoenix
#

i want to get back into public bot deving but i dont wanna deal with low iqs that dont know how to use the bot

#

despite it literally saying how to

stark dune
#

yeah i just put instructions on the extensive commands but honestly most of the times people just do whatever

#

so sticking to the mainstream ways of command usage instead of implementing other ways rip

knotty steeple
#

if they cant use it

#

not my problem

#

even though im the dev

#

so i just tell them to read if its basic

amber fractal
#

basically same

#

But in a more friendly way of putting it mmLol

grave mist
#

How would I align an <a> tag to center in html using css

#

I tried text-align: center; doesn't work

#

<center><a></center> does work but w3schools says it isn't available in html5, how would I do it in css

amber fractal
#

center of what

#

a div

#

the screen

#

content justification?

grave mist
#

screen

#

horizontal center

amber fractal
#

I believe you can use the top property

#

but that's relative to the ancestors

grave mist
#

I'm not much familiar with top, can you tell me how I would do that?

amber fractal
#

you can do percents as well

#

you can do left as well

#

which moves it from left to right mmLol

grave mist
#

I guess I need left then

#

Cuz I just want to do horizontal center, not vertical

amber fractal
#

Ah, well it's basically the same thing in the other directions

royal herald
fleet chasm
#

thats an extra parenthesis, is there something above that needs a parenthesis?

royal herald
#

code ^

#

but code has 32 lines? and error at 34th line?

#

@fleet chasm no

amber fractal
#

yes

#

you're missing one at line 19

#

to close exports.run function

#

wait

#

why do you have module.exports.run and exports.run inside of it

royal herald
#

umm idk

#

oh i fixed,no problem

glacial anchor
#

hey so how do i check if a voice channel has no other people?

#

is there something like <VoiceChannel>.size?

fleet chasm
#

<VoiceChannel>.members

glacial anchor
#

doesnt work :(

fleet chasm
#

you have to get the size of vc.members first

#

since it returns a collection

glacial anchor
#

so what is it

#

<VoiceChannel>.size.members?

fleet chasm
glacial anchor
#

@fleet chasm whats the script?

#
const vcSize = new VoiceChannel.members()```
#

or whatever it is

amber fractal
#

wtf

fleet chasm
#

i cant spoonfeed, but vc.members returns a collection, from which you can get the amount of people in the vc

glacial anchor
#

and then how to fetch its size from that collection?

#

vc.members.length?

#

might sound stupid

amber fractal
#

A collection extends a JavaScript Map

earnest phoenix
#

How can I delete someone's user id from a map he's in when i use a command? (with no args, normal command e.g !close)

grizzled raven
#

<Map>.delete(key)

#

hey how do i figure out if an emoji is a normal emoji and not a custom emoji in discord.js

earnest phoenix
knotty steeple
#

ur fast arent u

grizzled raven
#

say if someone was to input "πŸ‘" it would pass but "mnp_flooshed" wouldnt

earnest phoenix
#

it contains every unicode emoji usable in discord

grizzled raven
#

oh ok

#

hey uh

earnest phoenix
#

ur fast arent u
well... 😏

grizzled raven
#

how would i use it

knotty steeple
earnest phoenix
#

@grizzled raven i know mate

#

I try to make a ticket system which you can close with reaction or you can force close it

#

how would I do a command that when like 2ppl in a public voice channel and they run the command that it gets locked till they leave the vc?

grizzled raven
#

message.member

#

lol

earnest phoenix
#

parse the json, go into the emojiDefinitions array and check if any of them contain an object whose surrogates property is your emoji

#

and if you open one, you get registered in the map so you don't spam it.

#

And when I close it, i want the guy who got registered to be deleted from that map.

#

I can use mentions.members.first but I don't want to, that's why I don't know how to do it.

grizzled raven
#

well if they are linked, do <Map>.get(message.author.id).persontalkingwith.id or whatever

earnest phoenix
#

That's the problem

#

I'm the author of !closeticket

#

And I want his id to be deleted.

grizzled raven
#

so in the map, have their name

earnest phoenix
#

use a database to store the important info

grizzled raven
#

user*

earnest phoenix
#

I suck with databases

#

tried for a xp system

#

well, get better at it

#

bruh sounds simple eh?

grizzled raven
#

if youre gonna have a 4 week ticket then use a database

earnest phoenix
#

mkay

#

in memory maps or relying on discord channel names isn't reliable and you're asking for your bot to be broken

#

i've made just that in c#

#

the ticket with reactions i mean

grizzled raven
#

ok

earnest phoenix
#

the reactions went perfectly

#

But i want to add additional commands.

#

i can point you on how i structured my database models

#

for the sake of it

#

Its okay.

#

I'm gonna use the member.mention.first until i advance to databases

#

just keep in mind that relying on channel names or on just maps isn't really advised at all

#

Which would you recommend? I used mysql in the past.

#

for something as small as tickets i think sqlite is good enough

grizzled raven
#

hatebin

#

ok how would i get the info off of that website anyway

earnest phoenix
#

make a GET request to it and parse the body of the (returned) request as json

restive furnace
#

what lang

earnest phoenix
#

c#

restive furnace
#

k

grizzled raven
#

so like

#

what

#

with http?

#

http.get?

#

cause if so, that didnt work

earnest phoenix
#

i don't know

#

use literally anything that supports getting the body out of a request

grizzled raven
#

or i could type out every single emoji thonkku

#

yeah nah nvm 2.8k emojis

earnest phoenix
#

this is only a small implementation and shouldn't be followed though

grizzled raven
#

well that is c#

#

http doesnt work with https, and changing the https to http and getting it doesnt work

#

but

grave mist
#

That's minified + did something to be like that. It is hard to understand

#

Lots of sites are like that

earnest phoenix
#

obfuscate it

grave mist
#

That goes different than that

earnest phoenix
#

because you googled js obfuscator and went to the first website that does it for you

grave mist
#

Ye

#

Give me one that everyone uses

earnest phoenix
#

i don't know lol

grave mist
#

All those sites' js files starting with !function(e){

earnest phoenix
#

i don't work with js nor do i obfuscate it when i work with it

grave mist
#

Ok

#

Btw, deobfuscating is possible?

#

Is it good to put api keys in it?

earnest phoenix
#

yes

#

no

grave mist
#

Oh then no

earnest phoenix
#

never, and i mean never, expose any credentials or important information to the end user

grave mist
#

Why are the obfuscating it then

earnest phoenix
#

so people can't easily steal it

grave mist
#

But I can't get a way to hide it

earnest phoenix
#

use cookies

grave mist
#

Noob in using cookies :/

earnest phoenix
#

ok and

grave mist
#

If I use cookies, I can put api keys?

earnest phoenix
#

what's your end goal here

grave mist
#

What I'll do is basically let's say you click a button, it'll make a request to my api which must be used only by me using an api key to verify its me, and then return response

earnest phoenix
#

there's not really a reliable way to do that other than make a secure logging in system or require the user to manually input their api key

grave mist
#

that button is in my website btw

#

The end user is a user of my website which has to display a data from my server when the user clicks a button

#

I can hide the api key, api link by making an internal request but still the user can exploit it by sending a request to my website

earnest phoenix
#

there's not really a reliable way to do that other than make a secure logging in system or require the user to manually input their api key

#

require the user to log in first

#

either with discord (which is an easier implementation just using oauth2) or make your own

grave mist
#

Well, what would I do after they log in?

#

I mean, my code is visible to the user

earnest phoenix
#

they can't see the backend

grave mist
#

They can just request it using code, can't they?

earnest phoenix
#

what

#

logging in is a part of the backend

#

they can't see the backend code

grave mist
#

Not logging

#

After logging, they click a button

#

I need to get data and display it

#

That code will be visible

earnest phoenix
#

make an endpoint in your backend that returns said data

#

you'll know whether the user is logged in or not in your backend

grave mist
#

But when they click login, I just want to login them and then they can click a button that will display data

#

More like dashboard

#

Let's say they update prefix

#

They put the prefix in input and then click button

earnest phoenix
#

yes and

#

it's the same principle

grave mist
#

Then the website would make a request to my bot server which will return a response to verify the process is done correctly

#

But I don't get how it gonna work in your way. What you say is this right

earnest phoenix
#

you have to have a backend for this sort of stuff

grave mist
#

Me as a user > clicks login > authorizes > backend stuff display data > i see it

earnest phoenix
#

basically, yeah

grave mist
#

But what I say is me as a user > clicks login > autorizes > goes to prefix update page > enters prefix > clicks "update" button > send data and receive successful response > display "success"

#

Whatever I put in button onclick code, it's visible to them

earnest phoenix
#

yes and

#

that's the point of having a backend

grave mist
#

Ok, tell how I'm going to go to backend from clicking button?

earnest phoenix
#

what?

#

your backend serves everything

#

you simply add an endpoint which allows prefix updates

#

while in your frontend your onclick just calls that endpoint

grave mist
#

That "endpoint" is visible to the user right

earnest phoenix
#

yes

grave mist
#

So my question is can't a random user send a request to that endpoint?

earnest phoenix
#

they can

#

but

topaz fjord
#

just add auth to it

earnest phoenix
#

you can choose how you handle it

#

if you implement oauth you can check whether the user's logged in or not

grave mist
#

Tell me more about that please

#

Oh

earnest phoenix
#

there are a lot of documentation online explaining how oauth works

grave mist
#

So if I make it like the user should be logged in, no code can send a request right?

#

Can you get me a good doc? There's like tonnes and I may end up finding a wrong one and come here again

earnest phoenix
grave mist
#

Thanks

earnest phoenix
#

ok i am not sure where to ask for help so i am going to ask here anyways i got this error Detailed description too short. Minimum 300 characters. If you use iframes, you need to add something extra... and i am useing an i frame shuld i just spam the rest of the description with dots...?

nocturne dagger
#

What bot was that.

earnest phoenix
#

check if zero width space works

nocturne dagger
#

I can't find any bots being declined for that reason under your name all I can see is your bot was offline.

earnest phoenix
#

no i am trying to update the bot info on the site

west raptor
#

just add a massive comment mmlol

nocturne dagger
#

I might suggjest added a list of commands or something

#

but im not the expert. Spider is

west raptor
#

ted no

earnest phoenix
#

yes i have re applyed but now i am trying to update the info of the bot

west raptor
#

they mean their

#

bot desc

earnest phoenix
#

have you read their message at all Ted

west raptor
#

they're using an iframe

#

but they cant submit it because 300 char min

earnest phoenix
#

like i said try using zero width space

#

it has zero width but is counted as a char

#

i dunno if dbl filters it though

west raptor
#

i dont think so

earnest phoenix
#

idk what zero width space is and how to get it

#

google exists

#

yeah that doesn't help

#

it very much does

#

you're just lazy to do it yourself lol

#

u know what i am raging rn from what u said!

#

good for you!

west raptor
#

lol

earnest phoenix
#

sdfgdesx

#

cfd

west raptor
#

the audacity of this bitch! they told me to do something i am perfectly capable of doing!

earnest phoenix
#

no i am not lazy the problem is google

#

do u have any idea of how hard it is to try to remove google from your life

nocturne dagger
#

This is what Grovy did for there long decription

earnest phoenix
#

alternatives exist...?

nocturne dagger
earnest phoenix
#

yes

#

alot

west raptor
earnest phoenix
#

ddg/bing...

#

so i dont get what is the problem here

#

yes there u go duck duck go boom best thing ever

west raptor
#

im guessing you have an issue with ddg also

earnest phoenix
#

the problem is that we are in 20 20 and people (me included and you too) get very esaily offended

#

every search engine sucks

#

VERY ESAILY

#

you spelled easily wrong

#

no suck

#

i am blocking you

#

also no i literally never get offended

west raptor
#

you dont get offended over someone telling you to google something lol

earnest phoenix
#

good for you

#

yes i do

#

help vampire much

west raptor
#

if you cant handle that then i dont know how you get around the internet

earnest phoenix
#

i hope you're aware discord is on google's servers

#

u say search it insted of google it very ease thing to do

#

ok anyways thanks for the help april

#

i will try the blank icon char

west raptor
#

I didnt do shit

#

cry laid it all out for you

earnest phoenix
#

well not anymore i blocked them and now i can't see any of there messages

#

their

#

tfw you don't know the difference between their there and they're in 2020

slender thistle
#

Just like your and you're

#

My slide typing tends to fuck it up

loud salmon
#

@earnest phoenix google it mmLol

spark star
#

This would probably be a less used feature but it would make your bot more moddable without people seeing your code, you could use websockets and allow people to add commands with an open websocket, they would make a command, and the bot would be able to run it, as soon as they close the websocket connection, the command is removed from the bot until they open the socket again, and this feature could be toggled for servers that want to use extra commands made by people, also, if you get your bot on top.gg that would be even better cuz more people will use it
It would probably use an on_message event
And when the command, lets say I made coolio a command, if {prefix}coolio was ran, it would send message to the websocket client
And it would send data whenever it sends a message
Then the output data (e.g. messages to be sent) are sent back to your bot, and then sent to the server that uses the command

#

I'm planning on implementing this in python

#

Would this class as a big feature btw?

#

Please ping me if you actually read it, and tell me what you think

slender thistle
#

To be quite honest, I don't think you would need a separate websocket connection

#

Fairly sure you could just make a dict that you would edit whenever a command is added/deleted

spark star
#

But the person who made the command is hosting the actual command @slender thistle

slender thistle
#

"Hosting"?

spark star
#

They would be running the command on their own machine or repl.it probably

slender thistle
#

Huh

spark star
#

The websocket is just sending the data it needs back and forth

slender thistle
#

Well I can definitely say it isn't a simple feature

spark star
#

Yeah, do you think it would be a good idea/feature tho?

slender thistle
#

Trusting average Discord users to use websocket connections... I wouldn't really say it's good because of that

#

But if it's an actual programmer that is using your bot, it might come in handy

spark star
#

Yeah, and I'ma probably add a rate-limiting system that prevents people from spamming messages, so I wouldn't spam the discord API

slender thistle
#

Sounds better

spark star
#

Nice, anything else you think I should add to prevent abuse?

slender thistle
#

Prevent stuff like while True etc ig

livid pier
#

I know someone already made a bot that does something similar to this. It allows you to add your own commands written in JavaScript. It has a 10ms timeout on all commands and some other stuff to prevent abuse. @spark star

spark star
#

Nice, thanks

livid pier
#

np

spark star
#

Nice

#

Thanks

earnest phoenix
#

Can anyone give me a example in html js
If my a value is true then my toggle switch always shown at on else off

amber fractal
#

an if statement?

west raptor
#

@earnest phoenix js if (condition) { // do thing here ... }

#

not hard

earnest phoenix
#

ik about statements but didnt know much about html, css@west raptor

amber fractal
#

javascript is javascript

#

it works the same in html

earnest phoenix
#

hi im new

valid frigate
#

what's up new

#

have any questions

earnest phoenix
#

how do u add cmds?

valid frigate
#

assuming you're using discord.js

earnest phoenix
#

ye

valid frigate
earnest phoenix
#

ok

valid frigate
#

it covers everything about discord.js

#

well most stuff

heavy grotto
#

Anyone here good with PHP/Python?

valid frigate
#

read through it cuz it has some dank content ded

slender thistle
#

Python intermediate here

lapis yew
#

Me too

fallen gulch
#

(JDA) Hmm How someone how can i get Youtube API ? πŸ€” For music Bot (Unlimited or sth)

restive furnace
#

you cant get unlimited yt api key.

#

get from google cloud youtube api v3 key, and you can use it 10k times/day

late latch
#

Help to understand I can not understand how to make a comparison of the role of the bot with the role that link

modest maple
#

@green kestrel didn't you make sporks

#

@late latch I would say check if the IDs of the role you're comparing matches up with the Id of the role you want to compare it against

vital lark
#

@modest maple brain did make sporks

restive furnace
#

Is there any space that discord wont detect on channel names? (not really developement question, but anyway)

modest maple
#

Dont think so

#

To get the space you might Be able to use like a blank space unicode or a black space emoji

restive furnace
#

found Β \u2009

modest maple
#

Not sure if the discord channel names will actually accept unicode but maybe

surreal sage
#

Does json { "a": "b" }

const a_and_b = require("./json.json").a``` work?
modest maple
#

Wouldn't that just give you "b"

vital lark
surreal sage
#

y i wanted to know

modest maple
#

Well it's a dictionary

vital lark
#

if you want to know, then run the program

modest maple
#

a is the key

surreal sage
#

okok

#

i know now

late latch
#

What I need is to get the position of the bot role and compare it with the position of the role that they want to choose through the argument

#
function checkPermission(message, minID) {
    return message.member.highestRole.comparePositionTo(message.guild.roles.find(io => io.id === minID)) >= 0;
}
#

Something similar, but a little different

hushed glacier
#

Anyone Use Discord.js I Need Help

#

?

modest maple
#

@hushed glacier dont ask2ask just say your issue

timber cairn
#

Hey

hushed glacier
#

Ok

timber cairn
#

Does anyone know how to use ffmepg?

hushed glacier
#

How I tag A Member

timber cairn
#

I am tryna download it but I don't know how

#

@hushed glacier message.reply

hushed glacier
#

??

#

It's This Right

timber cairn
#

If you want then tagged at the begining then say message.reply

#

How do you download ffmpeg?

modest maple
#

what programming language

timber cairn
#

discord.js

#

node.js

modest maple
#

are you trying to use it for music?

timber cairn
#

Yes

modest maple
#

use Lava link rather than ffmpeg

timber cairn
#

I'm not sure how to use lava link

#

Is the command npm i lavalinj

twilit rapids
#

There are many guides on how to use LavaLink

#

Might wanna look into that

timber cairn
#

Is it python or js?

modest maple
#

both

twilit rapids
#

LavaLink itself is in Java, but you can use wrappers in nearly every language

timber cairn
#

I am familiar with ffmpeg

twilit rapids
timber cairn
#

But I don't know how to download it

twilit rapids
#

How to download FFMPEG itself?

timber cairn
#

Yes

#

I don't know how to install it

#

But I know how to. Code ut

twilit rapids
green kestrel
#

@modest maple yeah sporks is mine

timber cairn
#

I have chocolatey

green kestrel
#

Hi!

twilit rapids
#

yes

restive furnace
#

@timber cairn fun fact: you can use normal cmd for installing npm packages if youre o right directory.

timber cairn
#

?

#

I am using normal cmd

wary onyx
#

is this of bot development?

#

if so, I MADE A NATSUKI BOT

knotty steeple
#

of development

wary onyx
#

ok

knotty steeple
#

its not to say what bot u made

#

no one cares

wary onyx
#

offensive

knotty steeple
#

its to look for help in developing the bot

wary onyx
#

yeah i need help

knotty steeple
#

ok then

#

what

#

do u need

twilit rapids
#

It's to talk about bot development, so talking about your bot is included in that

knotty steeple
#

oh yes my new bot is the most revolutionary bot that ever exists

wary onyx
#

can you give me tips on what to use for communicating bots

modest maple
#

wdym

wary onyx
#

ones that can speak to you

modest maple
#

well what do you want it to respond with

#

and what lib

knotty steeple
#

if u mean cleverbot u can use the api

#

its paid tho

wary onyx
#

i use botghost

modest maple
#

oh

knotty steeple
#

stop right now

modest maple
#

sad times

wary onyx
#

why stop

knotty steeple
#

well ur bot wont be accepted here

wary onyx
#

ok

knotty steeple
#

and im not gonna help with that

wary onyx
#

i'll just ask one thing though

modest maple
#

and botghost also doesnt support much and allow any real modification

#

like

wary onyx
#

did the discord developers make this place

modest maple
#

no

#

and we also dont support botghost here

wary onyx
#

well that's basically being rude to botghost

modest maple
#

well yes

#

its a bad bad bad system

wary onyx
knotty steeple
#

its easier to just

#

learn

#

programming

wary onyx
modest maple
#

if you want any sort of modifications you cant use botghost

wary onyx
#

ok

#

thonkku do you support the one on steam

modest maple
#

not really

knotty steeple
#

no

modest maple
#

like

knotty steeple
#

just learn to code pls

modest maple
#

learn a programming language and learn a skill for life

wary onyx
#

ok

knotty steeple
#

u can actually get a job if ur good at it

wary onyx
#

OH MY FRICKIN' GOD I'M IN

modest maple
coral trellis
#

We do not provide support for discord bot maker here however we do allow the bots to be submitted here as they have a level of modification that is alright

wary onyx
#

OK

west spoke
#

easy on the caps.. lol

small prairie
#

What Is The "limit" Of Characters In Activity /Status

modest maple
#

probably 128 or 256 chars

knotty steeple
#

how do i set a bot status on eris

#

i cant find it on the docs thonkeyebrows

#

nvm found it

formal shoal
#

Out of curiosity, I know a lot of people make their database on mongo, I have a windows server and was wondering how to properly set one up on there?

#

Not how to do it, just if it's possibly for someone who is a basic at coding discord bots in discord.js

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

formal shoal
#

Oh wait, I already own a windows server ._.

#

oh well I guess I can open another

sage bobcat
#

One message removed from a suspended account.

modest maple
#

its not an OS @formal shoal

#

its the server side program for the DB

formal shoal
#

oh

#

I'm slow sorry I'm so new to this

#

I appreciate it thank you, and thank you DVSAEZI for the screenshots. :D

onyx sonnet
#

eep

near ether
#

is there really even a point in having more than one shard if your hosting service doesnt have multiple cpus?

#

im required to shard with my bot bc it is in over 2500 servers, but i dont have multiple cpus in my hosting service so havign more than one shard seems kinda useless

modest maple
#

you can do it so it doesnt use an entire new core per shard

loud salmon
#

sharding just splits up the bot into multiple processes, its not the same as splitting over multiple cpus/processors @near ether

modest maple
near ether
#

ah ok

modest maple
#

otherwise Pokecord and rythm would be screwed xD

near ether
#

lmaoo true

small prairie
#

Weird Thing Is Happening to me
So when I am using pm2 start <File Name> The Bot does Start But It doesnt "dm" Me For A Command
But If I Use node <File Name> The Bot Works As It Should
(If Both Methods Are Working Then Normal On Channel Commands Work Twice)
d.js
Vultr VPS

onyx sonnet
#

oe

fleet glen
#

eo

modest maple
uneven wyvern
#

const fetch = require("node-fetch");

var url = "https://www.worldometers.info/"
var res = await fetch(url).then(url => url.json())

console.log(res)
}

world().catch(e => console.log(e))                   


#

Anyone can help me xD

modest maple
#

you're not getting a JSON as a response youre getting something else

uneven wyvern
#

how would I get the json as a response?

modest maple
#

well that kinda depends on what ever the site is doing

uneven wyvern
#

yeah

modest maple
#

and expecting a JSON back

#

is it supposed to be sending a JSON back

#

or is doing somthing else

#

hint: Its not giving you a JSON its just a website

uneven wyvern
#

When I try it with Instagram it gives me the thing I want.

modest maple
#

not every site is gonna give you back a JSON just cuz you want it

uneven wyvern
#

so there's nothing I can't do about it?

slender thistle
#

Does that website have an API

modest maple
#

if not

#

Webscrape it

uneven wyvern
#

@slender thistle nope else I wouldn't try that.

slender thistle
#

Understandable

#

Yeah, as cf8 said, scraping the website is the only viable option left

uneven wyvern
#

How would I do that

modest maple
#

its probs gonna be best to search it up

#

cuz you could

#

use a load of requests get html throw some inputs read the html etc...

#

use selenium

#

etc...

#

etc...

#

like theres alot of options