#development

1 messages ยท Page 1189 of 1

forest drift
#

anyone have a better command system than

const args = message.content.slice(prefix.length).trim().split(/ +/);
    const command = args.shift().toLowerCase();

? I only realised now that if my prefix was dbr!, then even aaaa would register...

Or is the old

if(message.content.startsWith(prefix + "(command)")){}

still one of the best?

frail ocean
#

Command handlers are the best...

#

Rather than having one long file.

real nacelle
#

Oh Yeah, I am invisible. ** @real nacelle LEAVES THE CHAT**

frail ocean
#

@real nacelle Only talk in here if you need development help, please.

real nacelle
#

No one is responding my call

#

for help

frail ocean
#

You aren't even asking a question.

#

You are saying I am invisible.

real nacelle
#

I am asking if somebody knows coding a discord bot with python

forest drift
#

Rather than having one long file.
@frail ocean its only a 5 command bot, thats why im trying to find a better command system

real nacelle
#

I got no answers

frail ocean
#

@frail ocean its only a 5 command bot, thats why im trying to find a better command system
@forest drift Still, a command handler is best.

forest drift
#

mkay

frail ocean
#

Even for a 1 command bot, command handler's are how you should do it.

#

Easier to read, less nesting overall.

real nacelle
#

see again, no response. So I am leaving.

forest drift
#

I tried command handlers but my knowledge of code isnt good enough for it yet

earnest phoenix
#

see again, no response. So I am leaving.
@real nacelle If you got no response means no one here uses python ๐Ÿ‘€

frail ocean
#

I tried command handlers but my knowledge of code isnt good enough for it yet
@forest drift I can't recommend command handlers enough, easier for debugging, easier for readability and what is considered the "standard" - your code also looks more professional.

real nacelle
#

That's why I am leaving

frail ocean
#

@real nacelle Part of the reason I haven't responded is since you haven't bothered to do work yourself. There are MANY tutorials out there, search on google first.

forest drift
#

ok...

frail ocean
#

We aren't here to code it for you, you need to do research as well.

real nacelle
#

@real nacelle Part of the reason I haven't responded is since you haven't bothered to do work yourself. There are MANY tutorials out there, search on google first.
@frail ocean ur mod, u should read the pin comments of this channel

#

Do not assume people haven't already Googled their problem. If they're asking here, they've likely already Googled their problem. Telling someone "google it" is run and unhelpful.

#

this is written

#

read in the pin comments

frail ocean
#

How come once I search how to code a discord bot in python, many many results walking you through it show up?

real nacelle
#

but they aren't answering my question

#

ur not a good helper or mod

quartz kindle
#

lmao

cinder patio
#

You haven't asked any specific questions. You shouldn't ask to ask, just post your problem

real nacelle
#

๐Ÿ˜ก

frail ocean
#

Your question is somebody knows coding a discord bot with python - so you gotta give more information buddy if you want help.

real nacelle
#

bro, I can't get help from a guy who doesn't know python

#

You leave it

#

You'll say anything to defend yourself.

quartz kindle
#

lmao

opal plank
#

the balls of some people....

frail ocean
#

Lol - where have I said I don't know python.

#

my brain hurts

real nacelle
#

So, ur not responding

frail ocean
#

I'll just go and review more bots I guess.

real nacelle
#

Yeah, cuz you don't know helping anyways.

frail ocean
#

I'll say this once more, no one is responding as you didn't ask a question. Ask a question and people will respond. @real nacelle

quartz kindle
#

^

real nacelle
#

leave it

#

You'll say anything to defend yourself.
read this again

quartz kindle
#

right back at you

frail ocean
#

I'm being really patient with you here, if you don't want help I'll just continue reviewing bots.

real nacelle
#

Yeah sure, go on.

#

There're more members that can help.

#

Ig.

opal plank
#

first: this is a community channel, no one is in any obligation to help you.
second, the pins clearly state to ask your question -asktoask. State your problem and if someone knwos they'll answer
third. at this point you just blindly lashing out at a mod for pointing you out
fourth. none of what TheReal said is wrong at this point

quartz kindle
#

didnt you say you were leaving because there wasnt anyone responding? then leave lol

frail ocean
#

-ask2ask

gilded plankBOT
#

Don't ask to ask.
Just ask your question, it wastes time if you say "i need help" or "can someone help me?" instead of just saying what the problem is. Save your time and other people's time and just ask the question.

Please read https://dontasktoask.com/ for an explanation on why this is an issue.

real nacelle
#

@opal plank I asked, no one replied I thought no one know, so i left the chat. Now what's bad here?

opal plank
#

nothing, just leave without causing drama, come back later if someone who knows python know your answer

quartz kindle
#

90% of people who know X will never reply to the question "does someone here know X?"

earnest phoenix
#

Well the truth is, somebody knows coding a discord bot with python isn't a question

#

example

#

I ask

#

How to make my bot idle?

real nacelle
#

90% of people who know X will never reply to the question "does someone here know X?"
@quartz kindle i asked someone knows python, that doesn't mean. I need to ask a question

opal plank
#

dont ask if someone knows something

frail ocean
#

More information specific to the issue you have had @real nacelle :

#

-bigask2ask

gilded plankBOT
#

Every now and then, someone pops in and says something in the lines of:

Foobar123:Any Java experts around?
This is bad form, for several reasons. What the person is actually asking here is,

Foobar123:Any Java experts around who are willing to commit into looking into my problem, whatever that may turn out to be, even if it's not actually related to Java or if someone who doesn't know anything about Java could actually answer my question?
There are plenty of reasons why people who DO have the knowledge would not admit to it. By asking, you're asking for more than what you think you're asking.

You're asking people to take responsibility. You're questioning people's confidence in their abilities. You're also unnecessarily walling other people out. We often answer questions related to languages or libraries that we have never used, because the answers are generally common sense.

Alternatively, it can be seen as..

Foobar123:I have a question about Java but I'm too lazy to actually formalize it in words unless there's someone on the channel who might be able to answer it
..which is just lazy. If you're not willing to do the work to solve your problem, why should we?

The solution is not to ask to ask, but just to ask. Someone who is idling on the channel and only every now and then glances what's going on is unlikely to answer to your "asking to ask" question, but your actual problem description may pique their interest and get them to answer.

So, to summarize, don't ask "Any Java experts around?", but rather ask "How do I do [problem] with Java and [other relevant info]?"

opal plank
#

just ask your question

faint prism
#

@real nacelle How do I represent a negative number in binary?

earnest phoenix
quartz kindle
#

so you actually dont have a question? you just want to know if someone else knows python?

opal plank
#

^^

pale vessel
#

gosh that embed

real nacelle
#

i need to ask a question but if no one knows python here, how can they help me?

#

anyways, leave this drama

opal plank
real nacelle
#

It will nvr end

glacial sun
#

How do i make a code where people who voted will get bot currency?

real nacelle
#

imma just ask ma question

opal plank
#

i'll take the bullet

quartz kindle
#

many programming problems are universal. a good programmer can solve problems without knowing the language

twilit rapids
#

Did you not even read the embeds that TheReal send?

frail ocean
#

People do know python here, we are happy to help. We need to know the specific issue to help however.

don't ask "Any Java experts around?", but rather ask "How do I do [problem] with Java and [other relevant info]?"

opal plank
#

@real nacelle i know python

#

whats your question?

#

i'll take the bullet

earnest phoenix
#

python is same as everything you just need a launguage, that's not the point of your question.

real nacelle
#

can u tell how to put the outcome in the embeds, cuz it is causing errors if I do normally

opal plank
#

there we go

quartz kindle
#

finally

opal plank
#

now people know what you needed help with

faint prism
#

Nvm the 1st bit in the byte being 1 makes it negative

opal plank
#

fyi i dont know python

#

thats all you needed to ask

real nacelle
#

-_-;

fringe axle
#

How can I get the authors role color? (discord.js v12)

opal plank
#

can u tell how to put the outcome in the embeds, cuz it is causing errors if I do normally

#

just ask this next time

real nacelle
#

ok

opal plank
#

replace 'u' with 'someone'

real nacelle
#

can someone tell how to put the outcome in the embeds, cuz it is causing errors if I do normally

opal plank
#

that's it

#

๐Ÿ‘

pale vessel
#

How can I get the authors role color? (discord.js v12)
@fringe axle their display name color you mean?

opal plank
#

there we go

warm marsh
#

Show code?

fringe axle
#

@fringe axle their display name color you mean?
@pale vessel they're highest role color.

fringe axle
#

Thanks

pale vessel
#

actually never mind

#

the highest role color can be different than the display name color

quartz kindle
#

@real nacelle show your code, and the errors it causes

faint prism
#

can someone tell how to put the outcome in the embeds, cuz it is causing errors if I do normally
@real nacelle post error

cobalt furnace
real nacelle
#

ok

#

the errors aren't the system errors

#

I can't figure the way

pale vessel
#

use member.roles.highest.hexColor @fringe axle

real nacelle
#

to do it

#

Wait lsten

#

i want to ask

quartz jewel
#

Salt.

real nacelle
#

how to embed a code?

fringe axle
#

use member.roles.highest.hexColor @fringe axle
@pale vessel thanks

pale vessel
#

how to embed a code or how to code an embed

warm marsh
#

Elucidate?

faint prism
#

A code

real nacelle
#

how to embed a code or how to code an embed
@pale vessel the thing I asked is correct

quartz kindle
#

this is the signature of TextChannel.send() in discord.py: await send(content=None, *, tts=False, embed=None, file=None, files=None, delete_after=None, nonce=None, allowed_mentions=None)

real nacelle
#

Ig

quartz kindle
#

as you can see, there is an embed parameter

real nacelle
#

but

#

lord

#

can I send my code here?

quartz kindle
#

yes

#

please do

fringe axle
#

use member.roles.highest.hexColor @fringe axle
@pale vessel but if they have no role?

real nacelle
#

OK

fringe axle
pale vessel
#

@fringe axle they always have at least one role

#

which is @everyone

fringe axle
#

See above

pale vessel
#

you might have used a user instead of a member

quartz jewel
#

@pale vessel Reported.

pale vessel
#

what

real nacelle
#

my primare coed

#

if message.content == 'Say LOL':
myplace_channel = client.get_channel(740881166906687549)
await myplace_channel.send('LOL')

    #THIS IS CONTENT BUT DON'T WRITE ANYTHING UNDER IT OR TOUCH THIS

async def bal(self, ctx):
    embed = discord.Embed(title = "EMBED", description = "Description", color = discord.Colour.blue())
    embed.add_field(name = "EMBED GOOD", value = "LALALALA", inline = False)
    await ctx.send(embed = embed)
warm marsh
#

Code blocks?

#

```lang
code here
```

real nacelle
#

python

warm marsh
#

I know what language I meant for formatting in Discord.

real nacelle
#

Ok

warm marsh
#
print(True)
real nacelle
#

Sry

#

how do u type these kind of messages?

frail ocean
#

```language
CODE HERE
```

quartz kindle
#

he just showed you

faint prism
#

lol

sudden geyser
#

so close

warm marsh
#

Make sure there isn't a space after the language name and that you only have three back ticks

quartz kindle
#

you're using 4 ticks instead of 3

warm marsh
#

Auger python is supported

fringe axle
#

Working, thanks @pale vessel.

real nacelle
#
if message.content == 'Say LOL':
        myplace_channel = client.get_channel(740881166906687549)
        await myplace_channel.send('LOL')

        #THIS IS CONTENT BUT DON'T WRITE ANYTHING UNDER IT OR TOUCH THIS

    async def bal(self, ctx):
        embed = discord.Embed(title = "EMBED", description = "Description", color = discord.Colour.blue())
        embed.add_field(name = "EMBED GOOD", value = "LALALALA", inline = False)
        await ctx.send(embed = embed)
#

yay

quartz kindle
#

there you go

real nacelle
#

Lmao

quartz kindle
#

now, you want it to say LOL in an embed?

real nacelle
#

yes

quartz kindle
#

you dont need the bal function

real nacelle
#

So do I have to write it in the description?

quartz kindle
#

just put the embed code directly in there

quartz jewel
#

Finally reads with his eyes.

real nacelle
#

@quartz kindle needs to define ctx

warm marsh
#

I think the bal method is incorrectly copied as it looks to be part of a class.

quartz kindle
#

you dont need to define ctx, you should be able to use message.channel.send()

violet haven
#

where can i get all discord flags in unicode version?

warm marsh
#

Country flags?

violet haven
#

badges

#

hypesquad etc

faint prism
#

:flag_ac: = ๐Ÿ‡ฆ๐Ÿ‡จ
@violet haven

quartz kindle
#

there is no unicode for them

violet haven
#

ah

quartz kindle
#

they are custom images created by discord

#

unicode is only available for universal symbols and glyphs

violet haven
#

so how do i show them?

quartz kindle
#

you need to save them as images, and upload them to your server as custom emojis

#

hes talking about user flags, not country flags

violet haven
#

:HOUSE_BALANCE:

real nacelle
#

it was close but not exact.

faint prism
#

gotcha

violet haven
#

no like this

real nacelle
#

the code isn't coming in the embed

quartz kindle
#

whats your current code?

earnest phoenix
#

Um

warm marsh
#

If it's what you sent prior. It's due to a couple of reasons.

real nacelle
#

whats your current code?
@quartz kindle to get the bot say LOL

warm marsh
#

๐Ÿ˜‚

earnest phoenix
#

can someone give me this emojis code to put it on a embed

emoji : dblMod

#

escape it

#

\

real nacelle
quartz kindle
#

@real nacelle i mean show your current code

real nacelle
#

Ok

earnest phoenix
#

escaping doesn't work on mobile

#

i'm on mobile too so uh i can't help

real nacelle
#
if message.content == 'Say LOL':
        myplace_channel = client.get_channel(740881166906687549)
        await myplace_channel.send('LOL')

        #THIS IS CONTENT BUT DON'T WRITE ANYTHING UNDER IT OR TOUCH THIS

        embed = discord.Embed(title = "EMBED", description = "Description", color = discord.Colour.blue())
        embed.add_field(name = "EMBED GOOD", value = "LALALALA", inline = False)
        await message.channel.send(embed = embed)
quartz kindle
#

and what happens when you use the command?

real nacelle
#

the lolthing is out of embed

#

and the description and everything is in the embed

quartz kindle
#

you're sending the LOL part in a different message to a different channel

quartz jewel
#

Best command handler of 2020 is that above.

opal plank
#

nothing better than a switch case as a handler

real nacelle
#

you're sending the LOL part in a different message to a different channel
@quartz kindle how

earnest phoenix
#

ok so, can someone help me change the server page' background color in top.gg?
never tried this so have no idea how to do this ๐Ÿ˜‚

quartz kindle
#

you're getting a specific channel by ID, and sending LOL to it, independently from the embed

faint prism
#

ok so, can someone help me change the server page' background color in top.gg?
never tried this so have no idea how to do this ๐Ÿ˜‚
@earnest phoenix https://w3schools.com has a great tutorial on that in CSS

earnest phoenix
#

hmm

pale vessel
#

LOL

quartz jewel
#

@opal plank Eww.

opal plank
#

i'll go for if else if chains if you complain

real nacelle
#

you're getting a specific channel by ID, and sending LOL to it, independently from the embed
@quartz kindle so should I remove the channel id?

quartz kindle
#

if you dont want to send it separately, delete both lines

faint prism
#

@opal plank Having logic with the handler is a bad idea in general. If/else or switch/case is mostly subjective

quartz kindle
#

both myplace lines

pale vessel
warm marsh
#

In Python.

pale vessel
#

yes

#

they have ctx and message?

warm marsh
#

Idk, we'd require to see more code.

#

Or are you asking in general?

pale vessel
#

any pythoners in chat

#

lul

quartz jewel
#

@opal plank I don't use if statements or switch for command handler.

polar thunder
#

just do msg.channel.send(embed), that's what I always do

opal plank
#

@faint prism indeed, we, true cultured people, use one command per event, then repeat the events

client.on(message => if(message.content.startsWith(command a)) { /*du stuffz*/});
client.on(message => if(message.content.startsWith(command b)) { /*du stuffz b */});
client.on(message => if(message.content.startsWith(command c)) { /*du stuffz c*/});
quartz kindle
#

Lol

faint prism
#

having multiple handlers on message event

opal plank
#

the ultimate way to have multiple commands

pale vessel
#

discordbotlist/luca mmLol

earnest phoenix
#

hi guys

faint prism
#

I feel like that wouldn't even work

opal plank
#

worst part, it does

faint prism
#

Can you define client.on(message => multiple times?

opal plank
#

well, gotta warp shit in parenthesis n such

#

bubt it work

pale vessel
#

you can

faint prism
#

wtf...

opal plank
#

you can, its an event listener

polar thunder
#

yes but why NotLikeThis

faint prism
#

well yeah

#

but it's listening for the same event 3 times

opal plank
#

i wonder if Ts would screech at me for doing that

#

holdup

quartz kindle
#
client.on("message", message => { if(message.content.startsWith(command 1) && client.commands1.has(command 1)) { run command 1 from commands 1 } });
client.on("message", message => { if(message.content.startsWith(command 2) && client.commands2.has(command 2)) { run command 2 from commands 2 } });
client.on("message", message => { if(message.content.startsWith(command 3) && client.commands3.has(command 3)) { run command 3 from commands 3 } });
sudden geyser
#

what is this nightmare fuel

earnest phoenix
#

you forgot to check if message is defined

faint prism
#

I just use a delegate

#

welcome back from the mute @earnest phoenix

earnest phoenix
#

:kappa:

#

Every time I put on the Activity, like it shows, but few minutes its disappearing

real nacelle
opal plank
#

yikes, ts allows it

quartz kindle
#

how about this ```js
for(command of client.commands) {
client.on("message", msg => {
if(msg.content.startsWith(command)) { run command }
})
}

opal plank
#

i mean i guess i can see some cases where you'd be runnng shit around

earnest phoenix
#

That's my code

client.on("ready", () => {
  console.log(`----------------`);
  console.log(`PeroBot - Server`);
  console.log(`----------------`);
  console.log(
    `ON ${client.guilds.size} Servers '     PeroBot ' `
  );
  console.log(`----------------`);
  console.log(`Logged in as ${client.user.tag}!`);
  client.user.setGame(`Hi`);
  client.user.setStatus("idle");
});```
faint prism
#

how about this ```js
for(command of client.commands) {
client.on("message", msg => {
if(msg.content.startsWith(command)) { run command }
})
}

@quartz kindle NO

quartz kindle
#

:^)

opal plank
#

lets make it worse

faint prism
#

I definitly don't think the event would even fire correctly

#

It might work {1/TotalCommands}% of the time

#

lol

real nacelle
#

@quartz kindle can you help more?

#

that I sent u

earnest phoenix
#

get the EventEmitter and manually fire the message event :wesmart:

real nacelle
#

the pic

quartz kindle
#

i told you to remove the mychannel lines

#

did you remove them?

real nacelle
#

i did it

#

Removed it

quartz kindle
#

so now just edit the embed

real nacelle
#

how

quartz kindle
#

set the title and description to what you want it to be

real nacelle
#

oh

opal plank
#
commands.forEach({client.on("message", async (msg) => {await run(command).then(console.log('no error').catch((e) => {if (e) return e}))}})```
real nacelle
#

but it is what I want to be

pale vessel
#

what the fuck

real nacelle
#

tim

quartz kindle
#

lmao

#

if its already what you want it to be then its done lol

real nacelle
#

but the code

opal plank
#

the stakes are high nowadays for stars eh?

faint prism
#
commands.forEach({client.on("message", async (msg) => {await run(command).then(console.log('no error').catch((e) => {if (e) return e}))}})```

@opal plank Remind me of this
||```cs
using System ;
namespace IsThisPython {
public interface IA {
string Prop {
get ;}}

public class A                      :
    IA                              { 
    public string Prop              {
        get                         ; 
        set                         ;}=
        "Test"                      ;}

public static class ExampleClass    {
    public static void Main         (){
        IA a                        =
            new A                   ();
        Console.WriteLine           (
            a.Prop                  );}}}
quartz kindle
#

jesus

#

fucking

#

christ

opal plank
#

kill it

#

before it reproduces

faint prism
#

It's valid C# since it's whitecase-insensative mmLol

earnest phoenix
#

@faint prism did you see what c#9 brings us

real nacelle
#

?????????????????

earnest phoenix
quartz kindle
#

@real nacelle you said its already the way you want it to be, so then whats wrong?

faint prism
#

WOAHHH

real nacelle
#

the code isn't in my way

#

the title nd description is good

#

do I have to paste my code there?

quartz kindle
#

if you want me to understand whats wrong with it, yes

faint prism
#

Now, beginners can ignore class structure and main functions ๐Ÿ˜„ ||๐Ÿ˜ฅ||

earnest phoenix
#
lient.on("ready", () => {
  console.log(`----------------`);
  console.log(`PeroBot - Server`);
  console.log(`----------------`);
  console.log(
    `ON ${client.guilds.size} Servers '     PeroBot ' `
  );
  console.log(`----------------`);
  console.log(`Logged in as ${client.user.tag}!`);
  client.user.setGame(`-help`);
  client.user.setStatus("online");
});
#

c#9 is a mess

#

Is there something wrong with this code

quartz kindle
#

meanwhile js does this since 30 years ago

opal plank
#

i thought shit like that was the whole prupose of d.js

earnest phoenix
#

it kind of turns c# into a semi-functional language

faint prism
#

lient.on

quartz kindle
#

lient

#

lmao

earnest phoenix
#

ooof

#

we got the not operator which is literally fancy !

opal plank
#

imagine using newLines in console log

quartz jewel
#

@faint prism Or people could just avoid C# and use something worth using.

earnest phoenix
#

c# is worth using lmfao??

faint prism
#

@faint prism Or people could just avoid C# and use something worth using.
@quartz jewel That opinion sucks

restive furnace
#

true != false, cry u mean this?

earnest phoenix
#
client.on("ready", () => {
  console.log(`----------------`);
  console.log(`PeroBot - Server`);
  console.log(`----------------`);
  console.log(
    `ON ${client.guilds.size} Servers '     PeroBot ' `
  );
  console.log(`----------------`);
  console.log(`Logged in as ${client.user.tag}!`);
  client.user.setGame(`-help`);
  client.user.setStatus("online");
});
#

and now?

faint prism
#

Fortune 500 companies use dotnet all the time

opal plank
#

how about we merge those logs?

earnest phoenix
faint prism
#

true != false, cry u mean this?
@restive furnace true not = false I think is what he means??

quartz kindle
#

being rich !== having good code

quartz jewel
#

@earnest phoenix C# is horrible to use just like JS.

earnest phoenix
#

uh

faint prism
#

No it isnt

earnest phoenix
#

no?

#

where's that coming from

opal plank
#

being rich === pay someone for good code

earnest phoenix
#

oh nice

#

how about we merge those logs?
@opal plank k I did

restive furnace
#

C# is more hardware level

earnest phoenix
#
client.on("ready", () => {
  client.user.setGame(`-help`);
  client.user.setStatus("online");
});
#

now??

quartz kindle
#

you cant be rich if you pay for good code, you are rich because you underpay and get bad code

faint prism
#

C# is more hardware level
@restive furnace false you're thinking of C++

opal plank
#

not quite what i meant

earnest phoenix
#

still not working

#

damn

#

asp.net core is one of the most performant webservers out there (c#)
.net core technologies (now just .net) revolutionized the usage of c#

restive furnace
#

@restive furnace false you're thinking of C++
@faint prism no, note that more.

quartz kindle
#

ms fanboys smh

restive furnace
#

is .NET 5.0 out?

quartz jewel
#

@earnest phoenix It's coming from me because I hatr both languages.

faint prism
#

ASP.NET Core Runtime 5.0.0-preview.7 I think is

real nacelle
#

my output isn't in the embeds

earnest phoenix
real nacelle
#

Idk y

earnest phoenix
#

yes but that's subjective, i need objective facts on why c# sucks

#

(which it doesn't)

quartz kindle
#

@real nacelle you still didnt show your code

real nacelle
#

the same i showed

#

that pic

earnest phoenix
#

Tim

quartz kindle
#

@earnest phoenix setGame doesnt exist anymore, and setStatus("online") is the default anyway so it doesnt really do anything

real nacelle
earnest phoenix
#

oh

#

k

quartz kindle
#

@earnest phoenix and WHY THE HELL IS YOUR FILE 6k LINES LONG

earnest phoenix
#

Eh?

#

It's

#

server.js

ebon kelp
frail ocean
#

Are you using a command handler?

#

if not, thats why then

faint prism
quartz kindle
#

lmfao

earnest phoenix
#

yeah

opal plank
#

just remember that god doesnt forgive those major sins

#

6k lines dude

quartz jewel
#

@faint prism ๐Ÿคข

opal plank
#

thats a nightmare to edit

quartz kindle
#

@real nacelle so you didnt remove the myplace lines????

earnest phoenix
#

yeah ik

ebon kelp
quartz kindle
#

and you didnt edit the embed

#

๐Ÿคฆโ€โ™‚๏ธ

real nacelle
#

@real nacelle so you didnt remove the myplace lines????
@quartz kindle i sent the putcome by mistake

quartz kindle
#

you're still sending LOL separately

#

delete it

real nacelle
#

then where to post it?

quartz kindle
#

in the embed

real nacelle
#

or write

quartz kindle
#

edit your title and description

real nacelle
#

embed which place?

#

description/

quartz kindle
#

wherever you want

real nacelle
#

Oh

pine aspen
#

Hey, I've been working on a dashboard. I've been trying to get the guilds.join scope to work.

I keep getting this error.

{ message: '401: Unauthorized', code: 0 }

Code

axios.put(`https://discordapp.com/api/guilds/747143011695329451/members/${id}`, {
            headers: {
                "Authorization": `Bot ${config.secret.token}`,
                "Content-Type": "application/json"
            },
            data: { access_token: accessToken }
        }).then(res => console.log(res)).catch(err => console.log(err));

I'm using the passport-discord package. When I

console.log(accessToken)

I get a token.

opal plank
#

likely no access to that guild

earnest phoenix
#

401 is wrong token

pine aspen
#

The bot's in there with admin perms.

opal plank
#

isnt it unauthorizeD?

earnest phoenix
#

yes

pine aspen
#

Unauthorized

earnest phoenix
#

wrong token

pine aspen
#

Yes.

earnest phoenix
#

401 = wrong token
403 = missing perms

pine aspen
#

Hmm, how could I get the correct token?

opal plank
#

oh im thinking about twitch api

#

my bad

earnest phoenix
#

@earnest phoenix setGame doesnt exist anymore, and setStatus("online") is the default anyway so it doesnt really do anything
@quartz kindle I mean It works but like a while ago it goes ๐Ÿ‘€

#

have you checked whether your bot token is correct

pine aspen
#

I'll check it now.

earnest phoenix
#

ReferenceError: msg is not defined
at Object.<anonymous> (C:\Users\User\Desktop\BOGSCAMs Ultities\index.js:29:1)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47

restive furnace
#

msg not defined

earnest phoenix
#

What can I do to fix that error?

restive furnace
#

not an error, really

real nacelle
pale vessel
#

define it

opal plank
earnest phoenix
#

@pale vessel how?!

restive furnace
#

uhh @real nacelle

opal plank
#

imagine mistaking api code status

sudden geyser
#

What can I do to fix that error?
@earnest phoenix define it or look for what it should be called

real nacelle
#

uhh
@restive furnace ??

restive furnace
#

ive seen this before

earnest phoenix
#

@sudden geyser how is it supposed to be called?

restive furnace
#

if in embed

pine aspen
#

@earnest phoenix, the bot token is correct.

sudden geyser
#

It's your code. We don't know what it is

quartz kindle
#

@real nacelle thats so so so wrong i dont even know

real nacelle
#

what

quartz kindle
#

and i dont even use python

real nacelle
#

-_-,

earnest phoenix
#

are you sure you're using the token and not the secret

pine aspen
#

100% sure.

earnest phoenix
#

hm

real nacelle
#

token is in the bot section

#

not in the home

earnest phoenix
#

ReferenceError: msg is not defined
at Object.<anonymous> (C:\Users\User\Desktop\BOGSCAMs Ultities\index.js:29:1)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47

How can I define the msg?

pine aspen
#
      data: '{"headers":{"Authorization":"Bot mybottoken","Content-Type":"application/json"},"data":{"access_token":"not to share"}}',
quartz kindle
#

what you had before was correct, all you needed to do was edit the content of the embed, like change the description to "LOL"

#

nothing else

#

idk where you got that weird ideas

pine aspen
#

Might be the way I'm making the request.

earnest phoenix
#

it's a PUT request, yeah?

faint prism
earnest phoenix
#

everything seems correct there

quartz jewel
#

C# is shit.

violet haven
#

l$help

quartz jewel
#

C and C++ > C#.

faint prism
#

I'd argue that those aren't very secure in comparison

#

However, the speed I've heard is better

violet haven
#

shit sry

quartz jewel
#

@faint prism They're just fine compared to dogshit C#.

faint prism
#

What is this pent up resentment against C#?

#

My entire company uses C# so some degree on their projects

#

And it's fortune 500

earnest phoenix
#

Why can't I download quick.db?

#

@pine aspen you've got the wrong token for your bot token, it works for me (ignore the invalid oauth token)

#

invalid oauth token returns 403 as the status code

pine aspen
#

Hmm.

earnest phoenix
#

@quartz kindle why I can't download quick.db?

pine aspen
#

Maybe if I use JSON.stringify()?

earnest phoenix
#

try to

pine aspen
#

It worked.

#

Ty

real nacelle
#

hey my bot is spamming embeds.

faint prism
#

lol

restive furnace
#

@quartz jewel C# has it uses.

faint prism
#

Like ASP.NET APIs, Xamarin Apps, Console applications, Windows forms applications, etc

earnest phoenix
#

Why can't I download quick.db? @quartz kindle

quartz jewel
#

@restive furnace I'd rather use assembly over C# or JS.

restive furnace
#

assembly, lmao

earnest phoenix
#

.net 5/.net 6 is going to be amazing

#

they're merging everything into one single deving platform

restive furnace
#

asm isnt worth of using

faint prism
#

^ especially when high-level languages are available. You're wasting time in the SDLC

earnest phoenix
#

we were supposed to get java two-way interop in .net 5 but it got delayed for .net 6/.net 7 release :(

#

which means 2022

faint prism
#

we were supposed to get java two-way interop in .net 5 but it got delayed for .net 6/.net 7 release :(
@earnest phoenix Hype for that. That'll mean better android app dev

restive furnace
#

i heard in .net 5 u can compete with c++'s speeds

earnest phoenix
#

yeah

#

the JIT compiler is blazing fast

quartz jewel
#

@faint prism C# is waste of time as well.

faint prism
#

Just opinions. No meaningful information is conveyed by that ^

earnest phoenix
#

Why can't I download quick.db?

#

i dont know, why can't you?

#

you need to provide more context with your question

restive furnace
#

@quartz jewel if you really want to hear which is waste of time, its asm. since most compilers do better than human handwriting directly to asm.

faint prism
#

^ this, they apply better algorithms and implementations (usually)

earnest phoenix
#

i want to see exactly why c# sucks in your opinion

#

That is the error

eternal osprey
#

hey guys

#

just a question

earnest phoenix
#

just an answer

eternal osprey
#

what is the difference between numphy and numpy

faint prism
#

One has a typo

eternal osprey
#

this is my requirements.txt

#

dang frank castle in the building

faint prism
#

never heard of numphy

slender thistle
#

I'd Google it for you if my browser didn't decide to have an update

eternal osprey
#

billy better be outta ehre

#

shivaco

#

i did

#

and couldn't find it

#

so i thought that asking here would be a great idea

slender thistle
#

Lazy bum, search better mmLol

eternal osprey
#

yeah that's fun

faint prism
#

lol

slender thistle
eternal osprey
#

i am literally at page 7 of google

restive furnace
#

@quartz jewel also rule 4, didnt notice. (4c)

slender thistle
#

why the fuck do you need physics objects

quartz jewel
#

@restive furnace Yes asm is waste of time but would rather waste my time using it over C#.

faint prism
#

again, just hate against a language for no reason ^

restive furnace
#

just tell us why?

slender thistle
#

Rule 4 @quartz jewel, let's not go that way

#

If you are going to shit on X, at least don't be a dick about it

faint prism
#

Especially w/o reason

earnest phoenix
#

@quartz jewel all i see is shit talk on c#, i never saw why and the facts to back it up lol

eternal osprey
#

what is x

earnest phoenix
#

a mathematician's nightmare

eternal osprey
#

yeah i ma head pit

#

out

quartz jewel
#

@earnest phoenix I hate it's syntax and having to import from C++ to do something simple like write to memory.

#

@slender thistle Ban me then, problem solved.

earnest phoenix
#

you can write to memory natively in c# lol

eternal osprey
#

guys why do i get the error, modulenotfounderror : no module named six

earnest phoenix
#

you're probably thinking of getting memory to write to

#

...which yeah

#

you need to make a call to the kernel

restive furnace
#

and why you would need to import c++ to write to memory with c#, execuse me?

eternal osprey
#

you guys are typing fucking slow

#

dang hurry up

restive furnace
#

let them type

stable nimbus
#

Is there a way to make the code wait a damn day without bugging out?

eternal osprey
#

literally 1 word per minute

earnest phoenix
#

what is the code

stable nimbus
#

Dude knock your crap off.

oak cliff
#

@eternal osprey please dont be rude towards people who are trying to help you.

#

Follow rule 1.

quartz jewel
#

@earnest phoenix Last time I used C# had to import ReadProcessMemory and WriteProcessMemory and many other functions from kernel32.dll to use them.

earnest phoenix
#

yes

#

those are kernel calls

faint prism
#

Makes sense, it's a kernal module probably full of syscalls

earnest phoenix
#

writing to process memory != writing to memory though

eternal osprey
#

i wasn't talking to the people helping me

stable nimbus
#

@earnest phoenix So the code is a interval for 24 hours to reset something in the database.

eternal osprey
#

no-one was trying to help, which i understand.

oak cliff
#

Okay dont be rude to anyone.

restive furnace
#

even msvc (c++) needs kernel32.lib for doing operations such as malloc(size_t bytes).

oak cliff
#

Follow rule 1, as I asked.

eternal osprey
#

it was a joke

oak cliff
#

Being rude isnt joking.

#

Dont argue with me, just move on and follow the rules

stable nimbus
#
setInterval(function(){
    botdb.query(`UPDATE users SET commandsday = 0`);
    console.log(`Daily commands have been reset!`);
}, 5184000000)

This is the code for my interval.

slender thistle
#

no-one was trying to help, which i understand.
@eternal osprey because no one here is proficient in Python

#

Try to install six manually

#

when does that error occur anyway

eternal osprey
#

i wasn't mocking on anyone because they didn't help...

#

when i try to push it to heroku

slender thistle
#

Send full traceback

quartz jewel
#

@slender thistle People need to be able to help themself first instead of expecting to be spoonfed everything.

faint prism
#

I don't mind helping beginners in the right direction
I'd consider sending perfect code snippets for the issue to be spoonfeeding though

restive furnace
#

and we arent spoonfeeding btw

#

snippets != spoonfeeding

#

full code == spoonfeeding

stable nimbus
#

=== more like

restive furnace
#

=== for js

stable nimbus
#

Right. I do code in js myself.

quartz jewel
#

Most of people just copy paste from google and don't attempt to figure it out themself why it doesn't work.

earnest phoenix
#

Most of people just copy paste from google and don't attempt to figure it out themself why it doesn't work.
this is what you'll often see here lol, DBL is full of that

slender thistle
#

And if you're not going to be helpful, move on

quartz jewel
#

Anything relating to coding on Discord it happens @earnest phoenix

stable nimbus
#

I do have an issue currently, I am trying to set up a 24 hour interval (which I know how to but something went wrong) and I am unsure what happened. The 24 hour interval resets something in the database.

setInterval(function(){
    botdb.query(`UPDATE users SET commandsday = 0`);
    console.log(`Daily commands have been reset!`);
}, 5184000000)```
This is the code, that big string is 24 hours (I think)
restive furnace
#

1000 * 60 * 60 * 24 is a day in ms

pale vessel
#

24 hours is 86400000

stable nimbus
#

Okay, a better way to set it up is definetly nicer. Thanks mate.

eternal osprey
#

owh i just found out that heroku doesn't automatically support numpy and numphy

#

you have to use a buildpack

#

powered by pip

faint prism
#

pip is the package installer

slender thistle
#

That's the main pain of Heroku tbh

eternal osprey
#

i know

#

heroku makes things look so much easier

stable nimbus
#

Get yourself a hosting provider asap.

slender thistle
#

eh

eternal osprey
#

but in reality there relies errors in every corner

slender thistle
#

I'll have to disagree with that KEKW

earnest phoenix
#

setInterval works with numbers up to max value of signed 32bit ints, 5184000000 goes beyond that

floral creek
#

how do u put a bot in mobile mode?

dire obsidian
#

Anyone know any invisible hex color?

earnest phoenix
#

how do u put a bot in mobile mode?
@floral creek
you need to modify your lib to support it

#

Anyone know any invisible hex color?
@dire obsidian that doesn't exist

eternal osprey
#

#00FFFFFF

slender thistle
#

There's no invisible HEX color per se, there's ones that blend with Discord client backgrounds

stable nimbus
#

Ah, no wonder it shat itself ๐Ÿ˜†

dire obsidian
#

;-;

faint prism
#

how do u put a bot in mobile mode?
@floral creek Maybe there is an API call for Discord API for that

earnest phoenix
#

there isn't

eternal osprey
#

if i'm not wrong this was a transparent white hexcode

earnest phoenix
#

it's a field in the IDENTIFY payload sent through the gateway, hence why you need to modify your lib to support it

slender thistle
#

It's a header or something when sending WS identify call iirc

quartz jewel
#

setInterval is bad to use.

slender thistle
#

iirc d.js allowed it to be edited in the code itself

restive furnace
#

you need to set your browser and platform to Discord Android or Discord iOS.

slender thistle
#

...with a small trick that I have no clue about

restive furnace
#

its easier with custom libs

earnest phoenix
#

ReferenceError: message is not defined
at Object.<anonymous> (C:\Users\User\Desktop\BOGSCAMs Ultities\index.js:29:3)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47

#

How can I fix this error?

slender thistle
#

Show your code

eternal osprey
#

sned your code

faint prism
#

message is null at index.js line 29

stable nimbus
#

Thanks for the help @earnest phoenix, @pale vessel and @restive furnace

earnest phoenix
#

const client = new Discord.Client();

const PREFIX = "b!"

client.once('ready', () => {
    function randomstatus() {
      bot.user.setStatus("dnd");
      let status = ["BOGSCAM", "Prefix = b!", "Golf Blitz", "BOGSCAM's Cave"]
      let rstatus = Math.floor(Math.random() * status.length);
      client.user.setActivity(status[rstatus], {type: "STREAMING", url: "https://www.twitch.tv/bogscam"});
    }; setInterval(randomstatus, 600000)
  
      console.log('Logged in as BOGSCAM!');
  })

let memberlog = "737658405296144510"

client.on("guildMemberAdd", member => {
  if (member.guild.id !== "737658404868194365") return;


  client.channels.cache.get(memberlog).send(`Hello and welcome to the **${member.guild.name}**, <@!${member.user.id}> !!!`);
  member.roles.add("737658404868194366");
})


  if (message.startsWith(prefix + prune) || message.startsWith(prefix + purge)) {
  if (!message.member.hasPermission("MANAGE_MESSAGES") || !message.member.hasPermission("ADMINISTRATOR")) return message.channel.send("You don't have the permissions to do this!")
  if (isNaN(args[0])) return message.channel.send("Please input a valid number!")
  if (args[0]> 100) return message.channel.send("Insert the number less than 100!")
  if (args[0] < 2) return message.channel.send("Insert the number more than 1")

  message.channel.bu1kDelete(args[0])
  .then(message => message.channel.send(`Deleted ${message.size}/${args[0]} messages!`)).then(d => d.delete({timeout: 10000}))
  .catch(() => message.channel.send("Something went wrong, while deleting messages!"))
}```
frail ocean
#

@earnest phoenix Once again, probably your message event - I helped you with this ages ago. Have you got a message event now?

#

Once again, you still do not have a Message Event

earnest phoenix
#

How can I add one?

slender thistle
#

client.on("message", message => your code here)

frail ocean
#

Like I also said earlier.

faint prism
#

A message handler

frail ocean
#

Learn the language, and read the docs as well, it's on the front page.

stable nimbus
#

A message event would be nice for ya mate, I also reccommend getting yourself a command handler, and an advanced one so you can use more than one folder.

eternal osprey
#

can't you also make a command with If message.Content.Startswith ....

floral creek
#

hm

quartz jewel
#

@frail ocean People don't know what learning the language means.

restive furnace
#

you can

stable nimbus
#

I retract.

eternal osprey
#

did you really just say that this was python

slender thistle
#

Are you going to actually be helpful or just shit on everyone and everything, Frank

frail ocean
#

<ping> People don't know what learning the language means.
@quartz jewel I don't really understand what there isn't to understand about "learn the language" but ok.

eternal osprey
#

it's okay

#

frank has dem balls

stable nimbus
#

I learned it and I understand it really well.

#

Well, I say that.

eternal osprey
#

tbh the punisher was a really good series

stable nimbus
#

Getting better every day.

pale vessel
slender thistle
#

Stay on topic of development

eternal osprey
#

sorry

quartz jewel
#

@frail ocean Yeah there isn't much that needs to be understood but majority that post code asking for help haven't done that step or started but not finished doing it.

earnest phoenix
#

So like im off 1 day and ppl are fighting i c

eternal osprey
#

that heroku gives when pushing my bot

slender thistle
#

Let me get my loop rq

earnest phoenix
#

I dont use py sry

slender thistle
eternal osprey
#

it's okay ๐Ÿ˜‰

drifting wedge
#

{max_age}

#

is this correct?

#

for invite info

#

im usong python

slender thistle
#

Under what context

delicate shore
#
msg.channel.fetchMessage('748198453363998833').then(msg => msg.delete());```
drifting wedge
#

like invite deleted

delicate shore
#

it gives me an error

slender thistle
#

what's the error

delicate shore
#

msg.channel.fetchMessage is not a function

earnest phoenix
#

Yo @slender thistle quick question is a way to track messages like obv with collector but like messages from 10 days ago lets say

drifting wedge
#

me?

delicate shore
#

dont tell me its cache

earnest phoenix
#

Not rn after i do on collector and turn the collector on

drifting wedge
#

max age not defined

slender thistle
#

I'm not familiar with message collectors in JS per se

earnest phoenix
#

Oh i c

delicate shore
#

not

earnest phoenix
#

But like u got my point right?

pale vessel
#

you can fetch an old message and create a collector for it

delicate shore
#

@slender thistle you know and js and py both??

pale vessel
#

wait nm

slender thistle
#

Basic JS, more of a Python person

pale vessel
#

i'm stupid

earnest phoenix
#

you can fetch an old message and create a collector for it
@pale vessel ok

pale vessel
#

that was for reactions lol

slender thistle
#

But the way I would do it is cache them independently of my library's caching system, then probably check if message.createdAt - date.now is more than or equal to 10 days ago

eternal osprey
#
Because it is google translation, I'm sorry if it turned funny. I was addicted in exactly the same situation. I do not know why it went well, but I replaced it to describe "six == 1.10.0" at the beginning of "requirements.txt" and deployed it. by the way, but my version of python is 3.6```

do they mean that i have to downgrade my six version to 1.10.0 in the requirements.txt
slender thistle
#

or try to explicitly state the latest version

earnest phoenix
#

But the way I would do it is cache them independently of my library's caching system, then probably check if message.createdAt - date.now is more than or equal to 10 days ago
@slender thistle oooh i c

eternal osprey
#

yeah i already have the latest version

#

so i think downgrading would work?

slender thistle
#

ehh, TIAS tbh KEKW

faint prism
#

Ohhhh there is a LatencyChanged event. I could do something with that. Anyone know how often that is fired typically?

slender thistle
#

what's it even used for nekothinking

faint prism
slender thistle
#

Oh, websocket latency

faint prism
#

But I was thinking of using it in the status, similar to how TheReal#1781 has his status

earnest phoenix
#

can't you periodically update it instead of on the event

slender thistle
#

I mean, there's the option of setting an interval where you get the websocket latency

#

yeah

faint prism
#

Well yeah I could. But i want to know how often that event is fired first

earnest phoenix
#

it's on every heartbeat iirc

faint prism
#

If it's constantly, then I probably won't use it

#

ah

sand skiff
#

hi

delicate shore
#

message.CreatedAt

pale vessel
#

no

minor tusk
#

anyone

#

do u know how to host bot with glitch?

tight plinth
#

sorry, but glitch is not viable to host discord bots

minor tusk
#

wait

tight plinth
#

congrats u just downloaded your bots file

#

ig

quartz jewel
#

@minor tusk You need a web server running pinging your project website url every 5 minutes to keep it online.

minor tusk
#

yeahh

#

but what should i do

tight plinth
#

@minor tusk You need a web server running pinging your project website url every 5 minutes to keep it online.
@quartz jewel that wont work

#

read pinned messages

minor tusk
#

@tight plinth can u help me about it?

quartz jewel
#

@tight plinth It does work, that's how I used to do it when would use glitch, unless things have changed on it since then.

earnest phoenix
#

@quartz kindle you may or may not know me but im @earnest phoenix, are you decent with api security by any chance?

#

im writing a "secure-as-possible" express api boilerplate and wanted input on if there is any blatant security flaws

tight plinth
#

@tight plinth It does work, that's how I used to do it when would use glitch, unless things have changed on it since then.
@quartz jewel that's illegal according to glitch tos

#

@tight plinth can u help me about it?
@minor tusk get a vps for less than 5 bucks a month and ur good to go

quartz kindle
#

@earnest phoenix depends on what the api does

quartz jewel
#

@minor tusk If you live in Europe get VPS on contabo.

earnest phoenix
#

its just a boilerplate to throw up api's quickly that i know will be secure for the most part

tight plinth
#

not only if you live in Europe

earnest phoenix
minor tusk
#

im asian

tight plinth
#

just get a vps at contabo if you want to

earnest phoenix
#

if you see any blatant probls lmk

#

made it a few hrs ago

tight plinth
#

4$ a month for a good vps

faint prism
#

$3/mo for galaxy iirc

minor tusk
#

i just want a free vps-,-

quartz jewel
#

AWS is free for a year apparently.

faint prism
#

i just want a free vps-,-
@minor tusk You mean you want some sketchy guy to have access to your bot's code and token for free?

quartz jewel
#

^

minor tusk
#

....

faint prism
#

Because that's what free VPSes typically are

quartz jewel
#

Free ones are usually shared.

topaz fjord
#

aws free vps aren't shared

earnest phoenix
minor tusk
#

is that good?

faint prism
#

๐Ÿคทโ€โ™‚๏ธ I've never heard of it

quartz jewel
#

Try it and see for yourself.

minor tusk
opal plank
#

i dont see many ads and that scares me

#

it would've been fine if it was filled with advertisements

quartz jewel
#

^

#

@opal plank Just about everything is ad infested nowadays though.

opal plank
#

nono

#

its BAD that it does NOT have ads

#

i would've liked it to have ads

topaz fjord
#

not all vps providers put ads

#

digital ocean doesn't put any

#

same with galaxygate

opal plank
#

each company needs to make money somehow, the fact that they are free means they are profitting somewhere else

quartz jewel
#

It's a free though so you'd expect it to have ads.

quartz kindle
#

@earnest phoenix i dont see any blatant problems, but i would do a lot of things differently

earnest phoenix
#

like?

quartz kindle
#

like not exposing node.js directly to the internet

#

and use an nginx reverse proxy, with ssl termination

earnest phoenix
#

yea reverse proxy ssl stuff would probably be better

quartz kindle
#

rate limits can also be controlled by the reverse proxy

earnest phoenix
#

yea someone else suggested that

#

i debated taking them out and stating in readme that

#

but at the same time its like i want to bundle it in the app so that you can jsut throw up an api easily and not assume the user knows to setup a reverse proxy

#

i put that in the foreword in the readme

quartz kindle
#

i see

#

the security features can be a problem

earnest phoenix
#

still debating if i want to remove it entirely and just saying that

quartz kindle
#

for example, if your security is too tight, the api wont work from cross-domain browser js for example

#

xss is also only relevant if the api is outputting html code

#

a json api for example doesnt suffer from xss

earnest phoenix
#

i imagine api will store input data to a database

#

which is why the xss filter is there

#

because if later down the line that data is presented on web

#

or elsewhere

quartz kindle
#

yes

#

i think security-wise its fine, but it does seem a bit bloated

#

not that beginners care

#

they just want stuff to work out of the box

earnest phoenix
#

yea its kind of a weird mix of like i want it to be a one in all solution to just throwing up a simple but secure api

#

but at the same time it feels a bit bloated

#

its getting a bit of traction though which is nice

quartz kindle
#

the user still needs to know how to generate ssl certs, why cant they learn how to use nginx lul

earnest phoenix
#

fair lol

quartz kindle
#

a good addition would be more database options

#

not everyone is comfortable with mongoose

earnest phoenix
#

yes but at that point i might just write a cli that generates file based on a db param deal

#

like express-generator

quartz jewel
#

Could implement multiple database types so people can use whatever one they're most comfortable with.

earnest phoenix
#

having multiple databases added would be really clunky

#

ideally either a generator where you could pick one, have one static on the repo, or just none

quartz kindle
#

most libs rely on plugins for database selection

modest smelt
#

lol

#

Anyone need help with embeds?

green bison
#

can anyone give me the link for the docs

warm marsh
#

What docs?

green bison
#

client.channels

warm marsh
#

For what library?

pale vessel
#

discordie

warm marsh
green bison
#

you mean discord.js?

misty sigil
#

there

#

client.channels

green bison
#

ty

#

is this correct?
client.channels.get

nimble kiln
#

If using discord.js v12 then you have to use client.channels.cache.get(channelid)

faint prism
#

having multiple databases added would be really clunky
@earnest phoenix not if you design the db contexts using interfaces

#

The CRUD part wouldn't be too bad at least
See #development message for how I implement something like handling multiple db contexts

green bison
#

thank you

restive furnace
#

not deprecated 100%, believe me!

#

go use it

quartz jewel
misty sigil
green bison
#

is this correct?
client.channels.cache.get("channelid").sendEmbed(embed)

misty sigil
#

no just .send

faint prism
#

I use an interface to define the required functionality, then I get more specific with the model I'll be getting or returning via an abstract class, and finally a concrete implementation that I supply using dependency inversion

quartz jewel
#

client.channels.cache.get("channelid").send({ embed: embed });
@green bison

green bison
#

no just .send
@misty sigil Message instead of send?

misty sigil
#

client.channels.cache.get("channelid").send(embed)

green bison
#

oh ok

#

thank you

earnest phoenix
#

how was the role mention? <@${role.id}>

#

tagged

#

was something like this

misty sigil
#

its <@&>

earnest phoenix
#

oh thx

nimble kiln
#

Or you could use role.toString()

misty sigil
#

@Bot Developer

nimble kiln
#

if it's a role object

quartz jewel
#

Or could just mention a role and add a backslash to the start.

green bison
#

__Server Count__ โ†’ ${client.guilds.size}**);
is not working

earnest phoenix
#

what is not working

nimble kiln
#

client.guilds.cache.size is what you want - if using discord.js v12

misty sigil
#

what is not working
@earnest phoenix oH hey welcome back

green bison
#

so every code in v12 has to have .cache?

misty sigil
#

no?

nimble kiln
green bison
#

thank you

earnest phoenix
#

in v12 everything related to cache had moved to cache managers, the collections are in their respective manager.cache property

misty sigil
#

message.author.roles.add

nimble kiln
#

Can you even add roles to an author?

#

yeah gotta be a GuildMember object

karmic compass
#

wait, if i have a set "a", "b", "c" and i want to check if a message HAS one of those values, how would this be done?

#
const letters = new Set()
letters.add("a")
letters.add("b")
letters.add("c")
client.on('message', (message) => {
  //Thing I don't know
})
pale vessel
#

use set.has()

#

set.has("a")

#

that returns a boolean

misty sigil
#

i dont think thats what they wanted

karmic compass
#

yeah

#

i mean if i said

#

fskljdfs a sfldkjsdf i want that to return true

#

lsdfkjs sdlfkj should return false, same with b and c

pale vessel
#

what like split it by "" and use .some()?

karmic compass
#

what doees .some() do?

#

is there a page for the docs that i can check that out

cinder patio
#

You can loop through the set and check if any of the values are included in the message., only do this if you HAVE to use a set. Otherwise you should store the values in an array and use some

misty sigil
#

yes there is

cinder patio
#

There's no some to Sets

safe kelp
pale vessel
#

just ask

misty sigil
safe kelp
misty sigil
#

like code or how you would do it

safe kelp
#

@client.command

#

Ik you are saying it spoon feeding

wanton dew
quartz jewel
#

Custom client > default client that comes with lib.

safe kelp
#

?

misty sigil
#

default client best

pale vessel
#

who asked

quartz jewel
#

@misty sigil No.

misty sigil
#

well its not against tos

quartz jewel
#

Inherit from default client then can expand it's functionality and make things easier to do.

cinder patio
#

It depends on what functionality you need

earnest phoenix
#

Why would

{ ...[ ..."Bruh" ] };``` would return an error while
```js
let someArr = [ ..."Bruh" ];
let someObj = { ...someArr };

someObj;``` wouldn't?
Is this some kind of syntax problem or the array of pass through the spread operator Should be done beforehand
karmic compass
#

i got the whole array.some thing but whatdoyouput in the ()'s to check if it includes? i tried doing message.content, includes?

cinder patio
#

The first snippet works fine when I place it in the dev tools console

earnest phoenix
#
["Bruh", "Something", "nah", "huh", "hmm"].some(e => message.content.toLowerCase().includes(e));``` is how you would use it @karmic compass
#

@cinder patio really

karmic compass
#

thanks

hazy sparrow
#

how can i restrict code to only work in a specific server? is it same as users?

earnest phoenix
#

check for the guild id

warm marsh
cinder patio
misty sigil
#

or something

earnest phoenix
#

I used the first one it threw an error of js SyntaxError: unexpected token '...' @cinder patio

hazy sparrow
misty sigil
#

yea

#

wait no

hazy sparrow
#

the opposite*

misty sigil
#

!==

warm marsh
#

Although you probably don't want to return

stone birch
misty sigil
#

oh wait

#

shit i misread

#

wait no i didnt

#

fuck im confused

cinder patio
#

I dunno, works fine in chrome dev tools, I don't see a reason it wouldn't work in node, they use the same engine

hazy sparrow
earnest phoenix
#

silent, well, have you read the error, it clearly says the address is already in use

hazy sparrow
#

@misty sigil lol

earnest phoenix
misty sigil
#

no?

earnest phoenix
#

@cinder patio i believe that ... is es6 syntax

misty sigil
#

or am i insane

earnest phoenix
#

!==

warm marsh
hazy sparrow
#

!= exists?!?!?!

misty sigil
#

yes?!

hazy sparrow
#

why didnt i knew that before

sudden geyser
#

what were you doing before

earnest phoenix
#

because you don't know the language

pale vessel
#

true

earnest phoenix
#

logic operators are something you should cover

hazy sparrow
#

because you don't know the language
@earnest phoenix i guess?

sonic lodge
#

nice to see you again cry

hazy sparrow
#

i always used !message.guild === () not message.guild !=== (0

earnest phoenix
#

So != is just the negator of ==? Or it's same as !==

stone birch
#

silent, well, have you read the error, it clearly says the address is already in use
@earnest phoenix yes i did, but every number i try is invalid

earnest phoenix
#

former, voltrex

#

A wot

hazy sparrow
#

wait guys !message.guild.id === x will also work or am i confused

earnest phoenix
#

no

#

that doesn't do what you think it does

sudden geyser
#

! turns it into a boolean

earnest phoenix
#

^

hazy sparrow
#

im trying to see if a guild doesent have that id

earnest phoenix
#
message.guild.id !== "ID"```
sudden geyser
#

as in if the guild ID is equal to x

hazy sparrow
#

yup

earnest phoenix
#

you need to incase the comparison in parentheses, but why would you do that when you can just negate the equality operator, see what voltrex sent

stone birch
#

do I just have to try a different number all the time or do I have to get the number from somewhere?

robust arrow
#

How can I get the bot to leave voice channel after the mp3 file ends?

Current code:

            case "omd":
                const { voice } = message.member

                if (!voice.channelID) { 
                    return message.reply("no.")
                };
                
                voice.channel.join().then((connection) => {
                    const dispatcher = connection.play(path.join(__dirname, 'audio.mp3'));
                    dispatcher.on('end', end => {voice.channel.leave()})
                })
            .catch(console.error);
break;

discord.js v12

earnest phoenix
#

StreamDispatcher doesn't have a end event

warm marsh
#

^

earnest phoenix
#

It's finish

robust arrow
#

oh

warm marsh
#

It used to be end

earnest phoenix
#

If js VoiceChannel.leave() doesn't work there's also

VoiceChannel.disconnect()```
#

<Idk what's the difference though>

misty sigil
#
Promise { <Probably the same thing> }
robust arrow
#

I don't think it has a "finish" event

sudden geyser
#

@earnest phoenix the second one is supposed to be VoiceConnection.disconnect(), which is like a little different.

earnest phoenix
#

@robust arrow it has a finish event, it's what i use

#

@sudden geyser yea didn't realize that

robust arrow
#

it gives me a "finished" event

dawn plaza
#

Do bots automatically have different memories for each server?

earnest phoenix
#

uh

#

what

misty sigil
#

what

earnest phoenix
#

@dawn plaza You mean shards

dawn plaza
#

I'm new, sorry

earnest phoenix
#

Or the main client as master process shard

misty sigil
#

no they dont have shards automatically

dawn plaza
#

How do you make shards?

misty sigil
#

with a sharding manager

earnest phoenix
#

Every bot has a shard, it's the main one

#

you probably don't need shards yet

misty sigil
#

yea if you don't know what they are you dont need them

earnest phoenix
#

But to make more you need to use ShardingManager

#

2500 guilds is recommended to use shards when your bot hits it

misty sigil
#

its required

earnest phoenix
#

enforced*

misty sigil
#

you can shard early

earnest phoenix
#

recommended is at 2k for slow growth and 1.5k for fast growth

warm marsh
#

Tbh creating a bot with shards even if you're just starting is probably better, saves having to rewrite a load of things.

earnest phoenix
#

But then you have to manage the shards and the master process at the same time which is more pain

quartz jewel
#

@dawn plaza Bot's don't store memories, they're not humans.

earnest phoenix
#

Wot

warm marsh
#

Animals can store memories.

misty sigil
#

humans are animals

#

just finished my prefix caching too

earnest phoenix
#

Bots use memory like storing users in their cache, collections

quartz jewel
#

Human is just one of the many examples that can store memories.

sudden geyser
#

yes bots store memories. they have databases ๐Ÿ˜ 

ionic dawn
#

humans are animals
@misty sigil with a better software

solemn leaf
#
const Discord = require("discord.js");
const imageFilterCore = require('image-filter-core');

module.exports.run = async (bot, message, args) => {
    let color = '#' + ("000000" + Math.random().toString(16).slice(2, 8).toUpperCase()).slice(-6)
    let IMAGE_DATA = "https://cdn.discordapp.com/attachments/265156286406983680/748234621950492742/meme.png"
    imageInvert(IMAGE_DATA, nWorkers)
        .then(function (result) {
            // result === ImageData object
            let image = document.createElement('img');
            image.setAttribute('src', imageFilterCore.convertImageDataToCanvasURL(imageData));
            target.appendChild(image);
            const Embed = new Discord.MessageEmbed()
                .setColor(color)
                .setImage(result)
            
            message.channel.send(Embed)
        });
}

module.exports.help = {
    name: "invert"
}

why isnt this sending anything>?

misty sigil
#

and better hardware

stone birch
#

every webhookPort I try is already taken, how do I find one that hasn't been used yet?

misty sigil
#

try 6969