#development

1 messages · Page 1333 of 1

still cliff
#

We can swear in here? Wow.

opal plank
#

fuck yeah

rotund vale
#

We can swear in here? Wow.
@still cliff yea

pale vessel
#

not in my christian server

rotund vale
#

lol

opal plank
still cliff
#

I don't like to swear so I'll restrain from doing that.

#

It's very tempting though.

opal plank
#

bruh this is so fun to watch

earnest phoenix
#

I am still very very very hyped that i got my own daomin

opal plank
#

seeing each shard get populated with streams

earnest phoenix
opal plank
#

the code is working just fine now

#

finally this shit is stable and usable

cinder patio
#

Puppeteer takes up A LOT of resources, you are basically opening multiple chrome processes, but you don't see them

still cliff
#

I remember that excitement too, @earnest phoenix. It gets lesser when you get more. 😂

#

I have like 19 domains lying around now. 😂

earnest phoenix
#

I have like 19 domains lying around now. 😂
@still cliff lemme guess namecheap

opal plank
#

now the question is:
Do i move everything from the main branch onto the test branch with shards?
Or do i move the test branch shards to the main branch?

Thats what i get for not doing modular stuff 02dumb

still cliff
#

Not entirely.

misty sigil
#

Freenom

earnest phoenix
#

Puppeteer takes up A LOT of resources, you are basically opening multiple chrome processes, but you don't see them
@cinder patio why are you explaining us the science of how RAMs burn from Chrome we already know that mate

#

I have like 19 domains lying around now. 😂
@still cliff Lol

still cliff
earnest phoenix
#

Hostinger, Namecheap, Name.com and Tech.
@still cliff there's a site named Tech?

pale vessel
#

for .tech domains

main trench
#

This is a html related question but you know how some sites have a embed that displays with the link do any of you know how to get something like this setup?

still cliff
#

Freenom is the scummiest of all, @misty sigil. Would never get a domain from them.

#

Get.Tech, I guess.

quartz kindle
#

@main trench google opengraph tags and twitter tags

main trench
#

Thanks

still cliff
#

Search for twitter summary cards, @main trench.

earnest phoenix
#

twitter tags?
don't they just use vanilla OpenGraph?

still cliff
#

No.

#

For embeds they use Twitter summary cards.

opal plank
earnest phoenix
#

@opal plank stahp ddosing twitch else i call 911 Tim da saviour

opal plank
quartz kindle
#

discord uses twitter cards for their "large" embed preview, but they fallback to opengraph to display the small version, with an image thumbnail

opal plank
#

sharding is working really nicely now

still cliff
#

What. Is. That?

opal plank
#

my sharding

#

for Twitch

earnest phoenix
#

a fun fact about twitter embeds, you can force the behaviour of having multiple images in an embed without twitter

still cliff
#

O k a y.

quartz kindle
#

erwin is a racist, he has lots of slaves

earnest phoenix
#

What. Is. That?
Not Erwin's bot which is also a nice way to ddos twitch

opal plank
#

im racist

earnest phoenix
#

only possible with webhooks though since twitter images are just separate embeds

opal plank
#

i love races. I also like to play Forza a lot

earnest phoenix
#

He races using race cars, he's racist

still cliff
#

Let's all be racists.

earnest phoenix
#

can you make d3.js run a loop on a transition

#

Development more peek of shitpost

opal plank
#

looks code, its not my fault twitch doesnt have sharding and allow people like me to connect 100k IRC connection JOINS within 40 seconds while in voicechat streaming this 100% Twitch API abuse

earnest phoenix
#

can you make d3.js run a loop on a transition
@earnest phoenix What's d3.js

#

dumbos, they could have used js.org domains and they would only need an extra dot in the URL but save basically all of the money on the domain

quartz kindle
#

djs vs d3js

#

who wins

pale vessel
#

d3js

quartz kindle
#

h8ter

opal plank
#

by logic, one has 3 in name, therefore its better

quartz kindle
#

xD

misty sigil
#

djs-light wins

carmine summit
#

Imagine using discord.js v1

opal plank
#

didnt it start at 8 or something?

restive furnace
#

why did they start from that

#

while eris did start from 0.1.0 or something

earnest phoenix
#

Discord.js started from 1.0.0 but it was hidden and not officially published so it had seen a lot of changes and improvements when it was released at v8

quartz kindle
#

imagine waiting until v8 to release something

#

meanwhile steam is like "buy this pre-alpha early access game which is in v0.0.0-beta5 for 50 bucks"

solemn latch
#

I'm on v3 of an auto typer that people have been bugging me constantly for.

#

Still won't release it because its not good enough

quartz kindle
#

if it works and does the job, release it

solemn latch
#

Maybe v3.7
Its got some issues with profile switching that I'm too lazy to fix or remove

carmine summit
#

Imagine coding a bot without discord.js

#

axios.post()

blissful coral
#

Wait what is the webhookAuth supposed to be?

#

Is that our server password

boreal iron
#

What’s the issue to not use djs?

blissful coral
#

What?

boreal iron
#

Imagine coding a bot without discord.js

blissful coral
#

Just banter

rotund vale
#

@boreal iron i don't see a problem coding a bot without using discord.js. Discord.py is also a good language to code with

blissful coral
#

It is preference

boreal iron
#

Or just Js

#

Imma using pure js and php

#

Sure a framework is nice to have but doing it yourself is still better, in my opinion

#

It just consumes a little more time

next flax
boreal iron
#

But doesn’t require you to update the code all the time if you have to update the library in case it changes things

restive furnace
#

axios.post()
cpr::Post()

misty sigil
#

axios

carmine summit
#

So webhook is like api but no rate limit?

restive furnace
#

yesn't

#

they have limits too

tulip ledge
#

Alright so I'm working on this feature in my RPG bot that you can have multiple "profiles" you can basically start over on a diff profile and swap back to ur original, now the profiles have an ID property and name property, I've already managed to make it so the ID's are always unique now the issue is getting a unique name as it's taken from a list for example: ["Apple", "Pear", "Banana"]. The way the profiles of a user are stored is like this: ["ID1", "ID2"]. What I tried to do is have a do while loop and inside of that a for loop that loops over the profile, gets the data from the db then compares the name if they are the same I'd generate a new name and start the loop all over again, although this results in an infinite loop. Any other ideas or ways I could do this?

restive furnace
#

just fewer

stable snow
#

im trying to post to my own api, but there is a 405 error

#

how do i get past it

tulip ledge
#

I think that means ur post-method is wrong

#

not sure tho

earnest phoenix
#

I just bought a domain, how do I host my site on it? I am new to this

#

(NameCheap)

tulip ledge
#

U also need to buy a web hosting service

stable snow
#
    @commands.Cog.listener()
    async def on_ready(self):
        payload = {
            "server_count": len(self.bot.guilds),
            "user_count": len(self.bot.users)
            }
        async with aiohttp.ClientSession() as aioclient:
                await aioclient.post('myapi.net', data=payload)```
#

thats what i have

tulip ledge
#

I don't know python sorry

stable snow
#

ooof

earnest phoenix
#

U also need to buy a web hosting service
@tulip ledge can't you just selfhost it?

stable snow
#

.

tulip ledge
#

u could

earnest phoenix
#

That's what I want

#

Atm

tulip ledge
#

using XAMPP

opal plank
#

probably running apache alone would be fine

#

xampp is good when you need multiple things

#

php, databases, etc

tulip ledge
#

I've always used xampp

opal plank
#

using xampp ONLY for apache is a bit overkill

tulip ledge
#

🤷

#

Erwin, do u perhaps know a solution to my problem

ionic dawn
#

whts you issue

opal plank
#

LEPP > XAMPP

#

about what?

tulip ledge
#

Alright so I'm working on this feature in my RPG bot that you can have multiple "profiles" you can basically start over on a diff profile and swap back to ur original, now the profiles have an ID property and name property, I've already managed to make it so the ID's are always unique now the issue is getting a unique name as it's taken from a list for example: ["Apple", "Pear", "Banana"]. The way the profiles of a user are stored is like this: ["ID1", "ID2"]. What I tried to do is have a do while loop and inside of that a for loop that loops over the profile, gets the data from the db then compares the name if they are the same I'd generate a new name and start the loop all over again, although this results in an infinite loop. Any other ideas or ways I could do this?

opal plank
#

wait WHAT?

#

i didnt even understand the question

#

i got that you want profiles

#

so your MASTER is your userID presumably

#

so no issues there

tulip ledge
#

how would I make the name of the profile unique

opal plank
#

for each profile you want to generate unique ids, correct?

tulip ledge
#

a user can't have 2 profiles wit hthe name: Apple for example

#

I already have the unique ids working

opal plank
#

UUID is one route, there are other smaller ones , though database indexes also handles that for you

#

okay, so you got both of them done

#

now what?

tulip ledge
#

the names of the profile

#

I can't get that to work

opal plank
#

i did not understand a single thing about the while or for loops that you did

#

what exactly do you WANT to do?

tulip ledge
#

ok I'll send u the code

#
        let profileNames = ["Apple", "Pear", "Carrot", "Watermelon", "Tomato", "Mango", "Banana"]
        let profileName;
        let foundName = true;
        do {
          profileName = profileNames[Math.floor(Math.random() * profileNames.length)];
          for(let i; i < message.author.settings.profiles.length; i++) {
            let name = await this.client.db.get(`profile-${message.author.settings.profiles[i]}`).name;
            if(name === profileName) foundName = true;
            else foundName = false;
          }
        }
        while (foundName)
#

This is what I tried

#

but it resulted in an infinite loop

opal plank
#

why you even doing that though?

tulip ledge
#

idk thats the first thing that came into my head

#

and also the last thing

opal plank
#

generate a dummy name once the profile is created BLANK or PLACEHOLDER or something

#

make a command so the user can change if they want

#

the profiles, as you said, are already uniquely identified

#

so whats the point of worrying about name duplicates?

tulip ledge
#

yes, the ID is unique but the user can swap between their profiles doing -profile apple for example

#

If they have 2 profiles with the name "apple"

#

U see the issue?

opal plank
#

then once you create the profile, generate a name, if it exists, append (1) on it, if it exist, 1++, etc...

stable snow
#

t h i s

blissful coral
#

Is message.channel.me.hasPermission('SEND_MESSAGES') a correct way to check if I can send messages in a channel?

opal plank
#

just like files that we have on windows

#

whenever there are duplicates, append a number onto it

#

file
file(1)
file(2)

tulip ledge
#

But I don't rlly want that...

opal plank
#

while will keep running constantly

#

its a pain in the ass

#

be performant

#

just run a name check on creatiuon

blissful coral
#

nvm it isn't a correct way

#

hmmm

opal plank
#

thats it

#

no need to worry about it later down the line

earnest phoenix
#

@blissful coral js <GuildChannel>.permissionsFor(<client>.user).has("SEND_MESSAGES") // it also can be <Array of permissions>

tulip ledge
#

what if I take the names of all the profiles the user has, then remove these names from the array?

opal plank
#
function generateProfile() {
let names = [random,names,array]; //random default names
let _name = names[Math.random()]; //pick a random index name from array

let profiles = await db.get(allProfiles where ID = user.id); //get all profile names from a specified user
 
if(profiles.has(_name)) { //check if the profile exists
let tempName = _name;
let modifier = 1;
if (profiles.has(tempName + `${modifier}`)) genNameAGain() => {  //if name + modifier exists, loop a funciton until it doesnt
      modifier++
     if(profiles.has(tempName + `${modifier}`)) getNameAgain();      
   }
} 
//there we go, you got a name that isnt duplicate to insert on your database
}```
@tulip ledge
earnest phoenix
#

I'm sure that database returns an array instead of a map

#

Array.prototype.has() isn't a thing tho

opal plank
#

includes()

#

you get the point

#

thats a framework, not a spoonfeed code

pure lion
tight plinth
#

if im in a function, but i put a try catch block and do a return in the catch thing, will it stop the function? just wanna be sure b4 being stupid

#

@pure lion what

cinder patio
#

I'm pretty sure it will

tight plinth
#

ok, thanks

earnest phoenix
#

Fck can I get problems, Nutella has copyright on their name and my website is: "Nutella-dev.xyz"

#

is that a problem

#

.

#

@pure lion Clap

thin turret
#

Name it nutello then pogey

opal plank
#

@tulip ledge you got the gist of what i said?

earnest phoenix
#

but is it fine

#

or not

#

;((

opal plank
#

dunno, ask nutella if they plan to copyright you under copyrighted names

main trench
opal plank
#

doubt anyone here is a lawyer either to give you advice on that

pure lion
#

I'm a lawyer

opal plank
#

then tell them about copyright and cyber laws about it if you know

pure lion
#

Copyright laws are very stinky

tight plinth
#

and btw, if a message is deleted, is the MessageReactionsRemoveAll event triggered too if it contains reactions?

earnest phoenix
#

heyall making a application bot was wondering on how to make the questions NOT hard coded. basically can someone give me a idea on how to fetch them from a database and have a waitfor check for each question. im using discord.py library

pure lion
#

Try it and see

#

It should tho

earnest phoenix
#

I don't think so @tight plinth

restive furnace
#

then tell them about copyright and cyber laws about it if you know
everyone knows them

earnest phoenix
#

But try <client>.emit("event", callback) and see

opal plank
#

ah yes, 2020, the year where everyone reads something for 5 minutes and call themselves lawyers to give legal advice

#

sounds like a great time

tight plinth
#

ok

pure lion
#

@earnest phoenix it's not that one emitter triggers another

tight plinth
#

thank

earnest phoenix
#

Wot

pure lion
#

It's that if a bot deletes a message with reactions, does discord emit removedallreactions

earnest phoenix
#

I mean, he can try to see if it emits with that

pure lion
#

No that's not-

#

Sudusjfosjdj

earnest phoenix
#
  • Delete message
  • Emit
pure lion
#

O r g a n i c

earnest phoenix
#

If it returns anything that means it emits

pure lion
#

Yes but a client emission stinky poo

earnest phoenix
#

Stinky just like xig

main trench
#

Dont wanna ask again but anyone know how to get a opengraph embed to have color? (Html related)

misty sigil
#

I know this

#

gimme sec

#

SSHes into server

main trench
#

Lel

pure lion
#

Wait you do know it?

misty sigil
#

<meta name="theme-color" content="HEX CODE WITH #">

pure lion
#

Oh

#

Hot

main trench
#

Ah thanks

pure lion
#

Matt how do we do embeds

#

mAtT

misty sigil
#

What platform you springboarded eejit

queen schooner
#

Someone has a template for discord bot dashboard with mongodb so i can learn with it and make my own

faint prism
#

What a polite way of asking for code lol

queen schooner
#

😂

main trench
#

Lmao

queen schooner
#

i cant learn with docs

#

dk why

earnest phoenix
#

xD

main trench
#

But isn't asking for code the same as reading a doc they have the same information lmao

pure lion
#

What platform you springboarded eejit
@misty sigil discord you tomato flavoured piece of cheese

blissful coral
#

no

misty sigil
#

WEB OR BOT EMBED

#

YOU TWATISSON

pure lion
#

example

blissful coral
#

oh my lord

pure lion
misty sigil
#

with meta tags ye edjit

pure lion
#

Example?

misty sigil
#

look in pee pee poo poo’s code

pure lion
#

Ok brb

misty sigil
#

you ‘ave access to it

#

as do I

main trench
#

Like with mine you can out meta tags into the head element to make a link embed

pure lion
#

I'da've access to it

thick gull
#

would i have to use php or something to access all the images in a folder on the server

#

i would like to display all images in a folder withotu making seperate image tags

#

but i am a complete noob when it comes to web shit

#

:)

cinder patio
#

Creating img tags is quite easy with js

thick gull
#

i mean

#

i have a folder

#

on the server

#

n i dont think js can access that based on what i googled
n looked for

#

i can do it,
just idk how to do it on a webpage

cinder patio
#

Are you using node.js and express as a backend?

thick gull
#

yea

#

but i dont really understand express

#

im just using this to learn lol

cinder patio
#

Then you can make the folder public, or put it inside a public folder

sick apex
#

Please I'm making an config command that includes configs for prefix but when I change it bot doesn't response to it

        const prefix = db.get(message.guild.id + "-prefix")||configs.prefix;
        if(!message.content.toLowerCase().startsWith(prefix)) return;
configs.prefix

is string "f!"

And db is quick.db

thick gull
#

meaning

#

right

sick apex
#

No its guildid with string "-prefix"

thick gull
#

2313213-prefix

sick apex
#

Ye

thick gull
#

is that how its stored

#

okay

sick apex
#

like it

thick gull
#

how are you saving it

sick apex
#
if(subcommand === "prefix"){
            const contenterror = new discord.MessageEmbed()
            .setTitle("**Error**")
            .setColor("#0000")
            .setDescription(`Invalid prefix use ${prefix}config prefix <new prefix>`);
            if(!content) return client.guilds.cache.get(message.guild.id).channels.cache.get(message.channel.id).send(contenterror);
            const lengtherror = new discord.MessageEmbed()
            .setTitle("**Error**")
            .setColor("#0000")
            .setDescription("New prefix cant be bigger than 6 characters.");
            if(content.length > 6) return client.guilds.cache.get(message.guild.id).channels.cache.get(message.channel.id).send(lengtherror);
            if(content === confighandler.global().prefix) db.delete(message.guild.id + "-prefix");
            const sucessemb = new discord.MessageEmbed()
            .setTitle("**Sucess**")
            .setColor("#0000")
            .setDescription(`Prefix sucess changed to "${content}".`);
            if(content === confighandler.global().prefix) return client.guilds.cache.get(message.guild.id).channels.cache.get(message.channel.id).send(sucessemb);
            db.set(message.guild.id + "-prefix", content);
            client.guilds.cache.get(message.guild.id).channels.cache.get(message.channel.id).send(sucessemb);
        }
#

the content is third argument in message

#

like: f!config prefix <prefix>

thick gull
#

what is content

#

is that message.content

#

because then your saving it

#

as

#

prefixconfig prefix prefix

sick apex
#

No its 3rd argument of message

#
const content = message.content.toLowerCase().split(" ")[2];
solemn latch
#

why is this code so hard to read

sick apex
#

xd

thick gull
#

^

sick apex
#

Cuse I make it Woo xd

solemn latch
#

using vsc?

thick gull
#

beautified it

#
if (subcommand === "prefix") {
    const contenterror = new discord.MessageEmbed()
        .setTitle("**Error**")
        .setColor("#0000")
        .setDescription(`Invalid prefix use ${prefix}config prefix <new prefix>`);
    if (!content) return client.guilds.cache.get(message.guild.id).channels.cache.get(message.channel.id).send(contenterror);
    const lengtherror = new discord.MessageEmbed()
        .setTitle("**Error**")
        .setColor("#0000")
        .setDescription("New prefix cant be bigger than 6 characters.");
    if (content.length > 6) return client.guilds.cache.get(message.guild.id).channels.cache.get(message.channel.id).send(lengtherror);
    if (content === confighandler.global().prefix) db.delete(message.guild.id + "-prefix");
    const sucessemb = new discord.MessageEmbed()
        .setTitle("**Sucess**")
        .setColor("#0000")
        .setDescription(`Prefix sucess changed to "${content}".`);
    if (content === confighandler.global().prefix) return client.guilds.cache.get(message.guild.id).channels.cache.get(message.channel.id).send(sucessemb);
    db.set(message.guild.id + "-prefix", content);
    client.guilds.cache.get(message.guild.id).channels.cache.get(message.channel.id).send(sucessemb);
}
#

not much differen

#

tin code block

#

pain

sudden geyser
#

my eyes

sick apex
#

xd

solemn latch
#

still a ton better though

sick apex
#

😂

#

no Im using vs code

#

xd

thick gull
#

please use whitespace

#

despair

sick apex
#

xddd

sudden geyser
#

I swear erwin is about to walk in

solemn latch
#

shift + alt + f
auto formats in vsc

thick gull
#

why are you getting the channel from cache

#

this looks like djs right

sick apex
#

yep

thick gull
#

so just use <message>.channel.send?

drifting wedge
#

how do i with flask make a redirect to the current domain but with another /

#

so like for example

#

how can i make the newredirect

sick apex
#

cuse its 5 bots in one and client is client from connection-handler and client just making action and I cant use message.channel.send cuse it sends message from another bot that I want

#

xd

#

its 5 bots on 1 aplication

#

on 1 prefix

thick gull
sick apex
#

String of prefix

#

if it's set

drifting wedge
#

like how do i get the current domain

thick gull
#

yes but what is it

sick apex
#

if not returns nothung

drifting wedge
#

basically?

thick gull
drifting wedge
#

the one the user is one

#

on*

thick gull
#

frankenstein of a bot

#

5 bots 1 application

sick apex
#

yes but what is it
@thick gull i'm using quick.db npm module

const db = require("quick.db");
thick gull
#

yes

#

i am aware

#

what is the prefix being set as in the database

#

like

#

when you run the command

#

is it being set properly

solemn latch
earnest phoenix
#

It's set to whatever you provide as a parameter

#

hello who pinged me

thick gull
#

i am aware voltrex

sick apex
#

f!config prefix <prefix>
it sets 3rd argument of message so it sets string of prefix waht u set

thick gull
#

im not sure if he did it right

drifting wedge
#

thanks @solemn latch

earnest phoenix
#
<quick.db>.set(<key>, <value>)```
sick apex
#

Yep

thick gull
sick apex
#

😄

#

there is the problem that when i run command with custom prefix it doesn't work

#

soo

        const prefix = db.get(message.guild.id + "-prefix")||configs.prefix;
        if(!message.content.toLowerCase().startsWith(prefix)) return;
#

this is bad

#

cuse when prefix is not edited and i use normal f! prefix it works

#

but when I use custom prefix and message starts with it it returns

earnest phoenix
#

The reason is because quick.db also caches stuff

#

db.fetch

sick apex
#

I temporary edit the code and test somethis wait

#

somethink*

earnest phoenix
#

Try

const prefix = (await db.fetch(`${message.guild.id}-prefix`)) || config.prefix;```
surreal sage
drifting wedge
#

@solemn latch so like basically i want to get the current url the person is one

#

on*

#

and add a /(new thing)

surreal sage
#

Like Oauth2

#

But having everything done by a external service

solemn latch
#

take the parameter you got from the <var> and put it in the return redirect(url) @drifting wedge

sick apex
#

@earnest phoenix it doesn't work

drifting wedge
#

take the parameter you got from the <var> and put it in the return redirect(url) @drifting wedge
@solemn latch wait wut

solemn latch
#

yeah

#

the link i gave showed how to get a variable from a path

earnest phoenix
#

@sick apex Have you tried what it logs when you try to use a command

sick apex
#

@earnest phoenix and tho it corupted the normal prefix

solemn latch
#

yesterday you asked how to redirect, which uses return redirect()

earnest phoenix
#
console.log(prefix)```
solemn latch
#

which i linked yesterday

earnest phoenix
#

Try this and see what it logs

sick apex
#

@earnest phoenix I tryed it just 1 min. ago it returns prefix what set in db and if not set returns f! what is normal prefix configs.prefix

earnest phoenix
#

I mean, did you log what it returned

sick apex
#

yes

#

Idk why it doesn't work im confused im trying to fix it something like 1 day and dont understand why it doesn't work

drifting wedge
#

the var isnt working

#

1 sec

earnest phoenix
#

Wait oh my god, why are you using

<client>.guilds.cache.get(message.guild.id).channels.cache.get(message.channel.id).send(successembed)``` instead of just ```js
message.channel.send(successembed)```
#

LULW Wtf

sick apex
#

Cuse its 5 bots on 1 prefix

dusky moon
#

Hi

earnest phoenix
#

It doesn't even matter

sick apex
#

and client is bot what executing the action and message.channel.send when I use it other bot send it

#

like the bot what must execute the action is bot1 and when I use message.channel the bot5 execute the action

earnest phoenix
#

I mean, what i said will work on all bots

sick apex
#

it's problem becouse its 5 MUSIC bots on 1 prefix

earnest phoenix
#

You don't have to do that

sick apex
#

I have

#

Jsut

#

Just

#

I have only problem with that prefix

#

it returns it when I dont wait to

earnest phoenix
#

What is content defined as in your code

sick apex
#

its 3rd argument of command

#

f!config prefix <prefix>

earnest phoenix
#

No i mean what's it defined as

sick apex
#

string

earnest phoenix
#

Defined as in

<const|let|var> content = ???```
sick apex
#

const

earnest phoenix
#

No i mean the value

#

"???"

sick apex
#
const content = message.content.toLowerCase().split(" ")[2];
drifting wedge
#

its not wokring rip

#

how can i get the url the person is on

#

with flask?

earnest phoenix
#

You realize that won't work on all prefixes right, f!prefix something is undefined, bruh prefix something is something

solemn latch
#

whats your code look like thats not working @drifting wedge ?

drifting wedge
#

whats your code look like thats not working @drifting wedge ?
@solemn latch 1 sec

sick apex
#

f!config prefix <prefix.

solemn latch
#

and what parts not working, the dynamic path, or the variable

drifting wedge
#

both i think

#

lemme get code

solemn latch
#

you should check your path is working with a specific response, or logging it

drifting wedge
#
<li class="nav-item">
              <a class="nav-link" href="/../guild/?edit=/{{ variable }}/vanity">
                <i class="ni ni-circle-08 text-pink"></i>
                <span class="nav-link-text">Vanity URL</span>
              </a>
            </li>``` this is in the .html file
#
@app.route('/../guild/?edit={{ variable }}/vanity', methods=['GET'])
def vanity(variable):
    variable = request.args.get('?edit=')
    return redirect(url_for("control-panel.vanity.html"))```
#

and this is the flask

#

i dont get it tho

#

how do i pass it

earnest phoenix
#

uh

#

that isn't valid html

solemn latch
#

your code looks extremely different than what i linked to

earnest phoenix
#

html doesn't have variables

#

or string concatenation for that matter

solemn latch
#

and,
@app.route('/../guild/?edit={{ variable }}/vanity', methods=['GET'])
should look more like a flask style variable rather than whatever {{ variable }} is.

#

<variable> or such

drifting wedge
#

hmm ok 1 sec

faint prism
#

html doesn't have variables
@earnest phoenix unless you're using a js fe framework

earnest phoenix
#

it still won't have variables

#

you can use js to render html with a variable

#

but html never will have variables

faint prism
#

yeah that's what I meant

earnest phoenix
#

(unless you're using SSR)

drifting wedge
#
@app.route('/../<var>/vanity')
def vanity(var):
    return redirect(url_for("control-panel.vanity.html"))``` this is what its at rn
#

id need to make var the ?edit=(guildid)

#

but i would need to get the url the person is on?

solemn latch
#

it looks like to me, your trying to put a query parameter in the middle of your path

drifting wedge
#

yep

#

should it just be the entire thing?

solemn latch
#

i dont think query parameters go in the middle

#

they go at the end

#

and query parameters are not paths

#

they are just parameters

drifting wedge
#

so id need to be /../<var>?

solemn latch
#

diffrent concepts

#

well no

#

see you originally asked your question like you wanted a dynamic path

#

but you want just a normal query parameter

#

which in flask is
request.args.get('edit')
in your case

#

with the query in the right location

drifting wedge
#

?edit= ? or edit?

solemn latch
#

if its a path of edit its edit?

fringe axle
solemn latch
#

if its a parameter its ?edit=

earnest phoenix
#

@fringe axle are you on centos or

drifting wedge
#

yea but @solemn latch it doesnt get the guild id

#

thats the issue

solemn latch
#

becuase your putting a query param

#

in your path

#

that makes no sense

drifting wedge
#

well how can i just get the entire path then?

fringe axle
#

@fringe axle are you on centos or
@earnest phoenix whot?

solemn latch
#

the entire path wont have that data either, since your putting a query param in a path

#

it wont see it

earnest phoenix
#

what distrib are you using, vale

fringe axle
#

npm

earnest phoenix
#

??????????

drifting wedge
#

i can get enttire urlm and add /vanity at its end?

fringe axle
#

Idk what you mean

earnest phoenix
#

i'm asking about your linux distro

fringe axle
#

Ok

#

Wait

solemn latch
#

why not just make the url
/guild/vanity?queryparams

#

like they are supposed to be

#

or /guild/edit/vanity or however you want with query params in the correct location

#

or
/guild/edit/:id/vanity

#

and use a dynamic path

drifting wedge
solemn latch
#

you cant put that there

drifting wedge
#

and i add /vanity?

#

my brain melting

#

exe.exe has crashed

earnest phoenix
#

the whole way you're doing this seems super insecure and exploitable

#

my suggestion for this would be to use an SPA for your frontend (react/angular/whatever) and just expose API endpoints on flask

#

you'd obviously serve the SPA files from flask too

drifting wedge
#

my suggestion for this would be to use an SPA for your frontend (react/angular/whatever) and just expose API endpoints on flask
@earnest phoenix we're doing it so it checks if u have access to it

#

thats not an issue

earnest phoenix
#

i'm aware

#

the whole way you're serving the files seems insecure

drifting wedge
#

o ok

#

hmm

gentle lynx
solemn latch
gentle lynx
#

craft is WOODEN_SWORD, but if I do items[craft].type.toUpperCase() it changes to SWORD

#

user.set() takes 3 variables, table, column, input

#

and user.get() takes 2, table and column

cold canyon
#

Does anyone know how to make ssh work on ubuntu

earnest phoenix
#

what

gentle lynx
#

this is inventory_tools

floral wasp
#

This must be sql

gentle lynx
#

also

#

items[craft].category.toLowerCase() is tools

#

ok so the error is coming from here

#
                user.set(`inventory_tools`, items[craft].type.toUpperCase(), craft);
#

its this line

#

so this is the set function

#

items[craft].type.toUpperCase() is SWORD

#

but it says it's WOODEN_SWORD

#

what

stable snow
#

how do i add authorization to my api

#

someone help pLs

solemn latch
#

what are you having trouble with

stable snow
#

ok so basically i get a 405 when trying to post to my own api

#

so how do i fix it

gentle lynx
#

nvm fixed

earnest phoenix
#

@stable snow you're using the wrong HTTP method for your endpoint

solemn latch
#

405 isnt an auth issue is it

#

🤔

earnest phoenix
#

it isnt

sudden geyser
#

[Rust] I have this function:

async fn perform_query<T: GraphQLQuery>(variables: T::Variables) -> Result<impl Deserialize, reqwest::Error> {
  // ...
}```
The Rust compiler does not allow this to compile with the error message, `implicit elided lifetime not allowed here`. It suggests I indicate the anonymous lifetime around `Deserialize` in the return type, but I don't know how I'd do that. In the function body, it makes an HTTP request, parses it into a struct, and returns it. How could I solve this issue?
#

Also @gentle lynx just wondering, but is there any protection against SQL injection in the source code you shared

versed igloo
#

hi so I have a command on discord py that runs a while true loop I want to know if I can hive it so that the while true loop ends after ruining a !endloop command

earnest phoenix
#

why

gentle lynx
#

Also @gentle lynx just wondering, but is there any protection against SQL injection in the source code you shared
@sudden geyser i honestly have no idea what this is so no

earnest phoenix
#

what are you doing

#

because a while true is often indication of bad code

versed igloo
#

its a private bot log that alerts on changes to a text document that works like this

#

while True: with open('server.log') as f: for line in f: pass last_line = line m= open("lastline.txt","r") oldline =m.read() m.close() m= open("lastline.txt","w+") m.write(last_line) m.close() if last_line == oldline: pass else: await ctx.send(last_line)

sudden geyser
#

@gentle lynx SQL injection relates to security. Take this for example: sql SELECT * FROM users WHERE id = ${input}
A malicious user could set input equal to 5; DELETE FROM users;--, which would look like: sql SELECT * FROM users WHERE id = 5; DELETE FROM users;--
There are measures to protect against SQL injection as it can introduce security vulnerabilities into your code, such as deleting the entire table/database or dumping all user data.

stable snow
#

@stable snow you're using the wrong HTTP method for your endpoint
@earnest phoenix wdym

sudden geyser
#

Get/post/patch/delete/etc.

earnest phoenix
#

for example

#

you can't GET a POST endpoint

knotty yew
#

what do you guys like to use for hosting?

#

ive been with AWS for a while

earnest phoenix
#

i was the happiest with scaleway and galaxygate

#

scaleway changed up their plans recently though so it's not as "you get your moneys worth" as it was before

knotty yew
#

i'll look at those, thank you

#

wow galaxygate is $5 a month

solemn latch
#

$3 when their other stuff will be in stock(sometime in the next week probably)

knotty yew
#

god damn

#

and their latency is good?

solemn latch
#

its reasonable

knotty yew
#

it's worth trying out

#

i can always just stop my AWS instance and boot it back up if i want it back

earnest phoenix
#

GCP has super powerful machines and servers all around the world but... GCP is meant more for companies than personal use

#

which means expensive

#

but you do get $300 in credit when you sign up

knotty yew
#

yeah google cloud is too expensive for what it offers

#

AWS is a better deal

fringe axle
#

@earnest phoenix it‘s Debian 10

earnest phoenix
#

uh what was your issue again

#

g++?

fringe axle
#

This

#

Yea

#

g++

earnest phoenix
#

install it via apt

main trench
#

Phone coding?

fringe axle
#

apt?

earnest phoenix
#

sudo apt install gcc

knotty yew
#

gyp rebuild, my favorite error

fringe axle
#

Ok

#

And then npm install?

earnest phoenix
#

idk

fringe axle
#

bruh

pure lion
#

What's going on?

earnest phoenix
#

i dont know what you ran to get the error

fringe axle
#

npm install

#

¯_(ツ)_/¯

earnest phoenix
#

then yeah rerun it after installing g++

pure lion
#

Just install gcc

#

Yeah do that seems logicc

earnest phoenix
#

if anything else complains

#

just install the whole build essentials suite

#

sudo apt install build-essential

pure lion
#

What is build essential suite

#

Just a bunch of compilers?

earnest phoenix
#

metapackage yeah

pure lion
#

Ok

#

Also

#

Do you know where I can find an asm compiler

#

uwu

earnest phoenix
#

we use DJGPP at school for intel chips

#

but that's kind of an iffy subject because well, instruction sets

pure lion
#

Say I'm starting to write asm

earnest phoenix
#

look into AVR assembler

#

it's what we use for atmel chips but i'm not sure if it works with modern day chips

pure lion
#

Okay I'll have a look

#

Thankuu

gentle lynx
#

@gentle lynx SQL injection relates to security. Take this for example: sql SELECT * FROM users WHERE id = ${input}
A malicious user could set input equal to 5; DELETE FROM users;--, which would look like: sql SELECT * FROM users WHERE id = 5; DELETE FROM users;--
There are measures to protect against SQL injection as it can introduce security vulnerabilities into your code, such as deleting the entire table/database or dumping all user data.
@sudden geyser hmm

#

How do I fix this

pure lion
#

Use regex

gentle lynx
#

Or prevent it

fringe axle
#

@earnest phoenix error:


make: g++: Command not found
make: *** [better_sqlite3.target.mk:123: Release/obj.target/better_sqlite3/src/better_sqlite3.o] Error 127
rm b857c92884e9598d609f6be182a2595df7a8e00f.intermediatemake: Leaving directory '/Vale/Boatz/node_modules/better-sqlite3/build'
blissful coral
gentle lynx
#

@pure lion most of my values in the database are numbers, and if they arent theyre probably strings that I have set in my code so I think no one can inject my database

#

I cant really explain it but there is no way that anyone can inject my db considering the way I use it and how people can interact with the db through commands

haughty bough
#

Hello. Recently, I put my bot on three different servers and something happened that I already knew would happen, but I still don't know how to solve it. Example: When a person places a song on the X server, that song is also added on the Y and Z server. How to solve this problem?

fringe axle
#

Okay cry

solemn latch
#

A queue for each individual guild @haughty bough

haughty bough
#

Okay, but how do I do that?

solemn latch
#

I would make a map of all the guilds, and put an array for each ones queue

earnest phoenix
#

a more OOP way:
create a player class, the player is going to contain your queue, guild, dispatcher, anything you want

have a map of guild ids as keys and players as values

#

i think you'll need js for that

#

i think there's an old school trick to make your inputs radio buttons and then style them with css, however i'd recommend going the js way

stable snow
#

anyone know how to fetch from an api in nodejs

earnest phoenix
#

use node-fetch

stable snow
#

module?

earnest phoenix
#

yes

stable snow
#

k

earnest phoenix
#

Can someone help me make it so when my bot crashes it send the crash log into a discord channel?

#

why not use something like sentry instead

stable snow
#

i had an error

#
C:\Users\Mythify\Desktop\education\coding\javascript>node .
internal/modules/cjs/loader.js:968
  throw err;
  ^

Error: Cannot find module 'C:\Users\Mythify\Desktop\education\coding\javascript'       
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)        
    at Function.Module._load (internal/modules/cjs/loader.js:841:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}```
earnest phoenix
stable snow
#
const fetch = require('node-fetch');

fetch('https://api.github.com/users/github')
    .then(res => res.json())
    .then(json => console.log(json));``` is my code
#

wdym

#

im sorta new to js lol

#

javascript is the folder

earnest phoenix
#

@stable snow what is the file called with the code

stable snow
#

apitest.js

earnest phoenix
#

then run

#

node apitest.js

#

or node apitest

stable snow
#

o it workd

#

lol im dumb

earnest phoenix
#

node . only looks for index.js file

#

lol

stable snow
#

lol

cinder sandal
#

main.js > index.js

pure lion
#

node . only looks for index.js file
No it looks for the main file in the package.json

cinder sandal
stable snow
#

not rlly

cinder sandal
#

can confirm

earnest phoenix
#

do you have jquery

#

no idea then

pure lion
#

How are you including jquery

#

Then define it

cinder sandal
#

then define it lmao

pure lion
#

Doesn't look very defined

#

Just because you use the word doesn't make it defined

#

Where do you define jQuery

quartz kindle
#

@queen crescent load the page in your browser, right click it, click "view source" copy and paste the source to pastebin or some other bin, and post it here

cinder sandal
#

then define it somewhereKEKW

quartz kindle
#

ok

pure lion
#

In retrospect I didn't think xfortnite would have been available but there you go

quartz kindle
#

@queen crescent you're loading your main.js before jquery

#

move <script src="../public/assets/js/main.js"></script> to after the line that loads jquery

#

works fine for me

#

when i open the second one, the first one closes

#

did you refresh the page properly? disable/clear caches, etc

#

are you on chrome, firefox, or other?

#

try clearing cache

solemn latch
#

disabling cache is really useful when making sites(f12, network, disable cache)

honest perch
#

Use svelte

#

It makes things a lot shorter

#

100% recommend

quartz kindle
#

im gonna use svelte on my next project

#

whenever that may be

honest perch
#

Currently working on this

#

Do need to push latest to gh though

quartz kindle
#

nice

honest perch
#

That macos terminal was a pain ngl

#

Also routing is a pain

#

Apart from that svelte is great

stable snow
#

how do i change content of text in html using javascript

quartz kindle
#

if you have a <p> tag with an id bla you can do document.getElementById("bla").innerText = "new text"

stable snow
#

ok thanks

arctic hemlock
#

henlo how do i code an embed pages in js

sudden geyser
#

Are you using Discord.js?

arctic hemlock
#

ye

solemn latch
#

honestly, i thought he was talking about embeding webpages

sudden geyser
#

Use the MessageEmbed class from the library, but making the pages is a bit of a tricky process. You'll need to create a reaction collector and listen for reactions while keeping the state of the page you're on (e.g. a variable/property number of the current page, and the last page).

#

I recommend you create a class for your embed page handler.

arctic hemlock
#

im a beginner at coding and im so confused

sudden geyser
#

Then making an embed page handler is probably not going to be an easy task (or a good one to start with).

round obsidian
#

Hi

sudden geyser
#

hi

arctic hemlock
#

ty

round obsidian
#

I was wondering if anyone could help teach me how to code a discord bot?

sudden geyser
#

Learn a programming language, then learn to use the library you want to use.

solemn latch
#

this isnt a teaching channel, might be a little much for someone to teach you here

sudden geyser
#

If you're a beginner to programming, I recommend JavaScript or Python.

round obsidian
#

I have a deep understanding of Python but not sure how to incorporate it into discord

solemn latch
#

do you know how to read docs?

sudden geyser
round obsidian
#

Jeeze no need to be rude

#

@solemn latch

solemn latch
#

?

#

what was rude

#

its a genuine question

#

some dont know how to read documention

round obsidian
#

Im not even argue

solemn latch
#

???

round obsidian
#

Im not gonna argue

#

Thank you @sudden geyser

solemn latch
#

why are people so disrespectful 😦

arctic hemlock
#

cuz ppl r angry

loud flare
earnest phoenix
#

🆒

stable snow
#

im stuck lol

#
document.getElementById("stats").innerHTML = `${json.server_count}` ``` isnt working
solemn latch
#

is your elements id stats?

remote wharf
#

ksfhoadlkfns

#

jyes

#

yes

#

finally

#

my iq increases to 10

#

I figured out how to do these webhooks and stuff

#

and now i need to use cogs for the rest of my code 😭

#

I need to convert all 5k lines

#

😭

solemn latch
#

where you a repl user @remote wharf i forget

remote wharf
#

yeah

solemn latch
#

what did we use for your port?

earnest phoenix
#

Can anyone help me make a unban command in python?

remote wharf
#

I just used 5000

#

and that was it

solemn latch
#

ok

remote wharf
#

uban command

solemn latch
#

thanks

celest creek
#

Punch punch

remote wharf
#

these cogs make a lot more sense

#

and I understand how the webhooks work now

celest creek
#

I get an error

solemn latch
#

what error

earnest phoenix
#

so my bot post its stats and analytics to my api, im debating taking that into its own process

#

thots?

solemn latch
#

imo, a good idea

earnest phoenix
#

yea probs better practice to go the whole microservice route

blissful coral
#

Good idea

pure lion
#

Is there a way to fetch a message without cache (d.js)

quartz kindle
#

messages.fetch(id,false)

young flame
#

^^^

earnest phoenix
#

i'm trying to get the guild's id when my bot joins it, but i don't know how, any help? (discord.py)

sudden geyser
#

Listen to the on_guild_join event. The first argument is a Guild instance, so you can just get its ID via .id

earnest phoenix
#

i have tried @client.event async def on_guild_join(guild): ServerID = discord.Guild.id print(ServerID)
but it just prints <member 'name' of 'Guild' objects>

solemn latch
sudden geyser
#

It prints that because discord.Guild.id is not an instance of the class.

#

The guild parameter you received is an instance of discord.Guild

earnest phoenix
#

isnt it just
guild.id
@solemn latch fuck me

#

it is

ionic dawn
solemn latch
#

are emojis cached by default?

earnest phoenix
#

hello 🙂

solemn latch
#

heya

earnest phoenix
#

i pretty much gave up on the Database 😂

solemn latch
#

awh

earnest phoenix
#

it wouldn't execute peoples ID's into the db, and then it messed up and wouldn't work, so i gave up with it Db's aren't my thing 😂

ionic dawn
restive willow
#
    try:
        voted = await DBL_CLIENT.get_user_vote(ctx.message.author.id)
        print(voted)
    except Exception as e:
        print(e)
#

seems to hang on get_user_vote, any ideas

quartz kindle
#

@ionic dawn cant you just... guild.emojis.cache.get(id) ?

ionic dawn
#

nope thefuck

#

it returns undefined

quartz kindle
#

what if you console.log(guild.emojis.cache)

ionic dawn
#

returns all the emojis

#

like.. the objects

quartz kindle
#

@restive willow ask @slender thistle

ionic dawn
#

but when I try filter or find by id it returns undefined, but "name" seems to work

slender thistle
#

I'm a barbie girl

#

in a barbie worldddddd

quartz kindle
#

this is #dev lmao

stable snow
#

I just used 5000
@remote wharf bruh

#

i’ve been trying for so long

slender thistle
#

rtfd

stable snow
#

hoW dId you dO iT

quartz kindle
#

@ionic dawn what is the structure like?

slender thistle
#

nvm it is get_user_vote

quartz kindle
#

like what are the keys

slender thistle
#

@restive willow What is DBL_CLIENT

ionic dawn
#

the "keys" ?

#

of the object?

earnest phoenix
#

ooh next question @blissful coral should i handle votes on the analytics process OR should it be on the engines api

quartz kindle
#

when you console.log the entire collection it should show something like this ```
Map {
[2834702834] => {
name:bla,
etc:bla
},
[23425334634] =>
}

#

correct?

ionic dawn
#

that

quartz kindle
#

and using.get() doesnt work?

ionic dawn
#

nope

quartz kindle
#

are you sure the id is correct?

ionic dawn
#

100%

#

ill try again

quartz kindle
#

try copying one of the ids that were logged there, and use that id

blissful coral
#

ooh next question @blissful coral should i handle votes on the analytics process OR should it be on the engines api
@earnest phoenix hmmmm

#

Engine

ionic dawn
#

undefined

main trench
#

yo anyone know how to detect if a specified user is a bot in d.js?

opal plank
#

user has that property

#

user.bot => bool

quartz kindle
#

^ check if user.bot is true

opal plank
#

5th time in 1h

quartz kindle
#

banned by your own vps

opal plank
#

internet is fine

#

it logs, stays on for 10 minutes, then dc's

ionic dawn
#

okay, i can get it by ID if I do filter

opal plank
ionic dawn
#

but cant with .get

#

this is stupid

main trench
#

so like if (user.bot === true)return?

quartz kindle
#

@ionic dawn that makes 0 sense

opal plank
#

if(user.bot) return

main trench
#

aight

opal plank
#

thats already a boolean

main trench
#

thanks

opal plank
#

if(true) =>
if(false) =>

main trench
#

ok

ionic dawn
#

I don't know why

quartz kindle
#

what about emoji = server.emojis.cache.find(emoji => emoji.id === "id")

main trench
#

ok so for context im fixing warn to dm the user and i keep having trouble with a specified user being a bot i did this code and it still wont work correctly any ideas on how to fix it?

            if(true) return;
        } else {
            user.send(embed2)
        }```
kind thicket
#
if (!user.bot) user.send(embed2)```
main trench
#

hmm ok

#

nope

#

still giving me the dm error

blissful coral
#

if(message.author.bot) return

main trench
#

ok ill try it

#

now bot is undefied hmm

kind thicket
#

I'd give you what I have for my bot but I'm on phone now

main trench
#

thanks but i just need to figure out how to specify bot

blissful coral
#

Wait

#

What is this in

#

Like a message event or what

main trench
#

d.js

#

nah command

blissful coral
#

Show me how you do it

#

So I can see how to help you

main trench
#

if (!message.user.bot) return user.send(embed2)

#

im trying to fix my mod commands to dm a user but not dm them if they are a bot

blissful coral
#

In your message event, do if(message.author.bot) return

main trench
#

wouldnt author look for the person who executed the command then?

kind thicket
#

That command checks if the user that sends the message is a bot, and if it's a bot it will return

placid iron
#

😩

main trench
#

im trying to get it to check if a specified user is a bot for example if *ban @bot_here reason if that user is a bot dont dm them but if they arent then do dm them

placid iron
#
async def ban(ctx, user):
  # ban user
  if not user.bot:
    await user.send("banned")
#

?

quartz kindle
#

hes using js

#

if(!user.bot) user.send(embed2) is correct, how did you define user?

main trench
#

let user = message.mentions.members.first() || message.guild.members.cache.get(args[0]) || message.member;

#

i tried what you sent and i still got the "cant dm this" user error

quartz kindle
#

that is the problem

#

message.mentions.members.first() is a member, not a user

#

same with message.guild.members.... and message.member

ionic dawn
#

I found out what I wass doing wrong

#

I want to hit my balls

main trench
#

ok so just change member?

quartz kindle
#

if you define user like that, then this user you created is actually a member, and therefore you will need to do member.user, or in your case it would be user.user.bot and user.user.send() lol

#

@ionic dawn do share

#

using .get() without quotes?

ionic dawn
#

well... I was taking the ID right clicking and "Copy ID"

#

and... that was giving a bad ID

#

it wasnt copying the actual ID

main trench
#

it works now thanks

ionic dawn
quartz kindle
#

i cant even right click an emoji, it just gives me the regular browser right click lmao

#

(using browser discord)

ionic dawn
#

on the desk app show the "Copy ID" section

#

I did \ near the emoji instead

#

sry Tim for bothering you with that thing

main trench
#

you can do \and emoji to get its information

ionic dawn
#

thats what I did

pliant needle
#

@ionic dawn that emote kinda breaks the rules here, ngl

ionic dawn
#

wich one

astral yoke
#

quick question

#

would it be

#

or (name)[url]

#

so then why dosent it work on embeds

crystal socket
#

k

quartz kindle
#

it does work on embeds, but not on titles

#

only values and descriptions

astral yoke
#

what about a field?

pale vessel
#

yep

#

works

astral yoke
#

weir

#

d

#

its not working for mine

pale vessel
#

only field values

#

not the name

#

for title you have to set the url as a property

astral yoke
#

thats in description^

pale vessel
#

what did you put?

astral yoke
#

.setDescription(args[0], '[name](https://www.youtube.com/watch?v=eE7CSQOZn9E)')

#

its just a random youtube url

pale vessel
#

it should be the first parameter

#

what's args[0]?

compact echo
#

I want to define t in payload as event because I'm making a deno discord lib but when I define it as this, const { t: event, op } = payload; on line 21, and I try to console.log the event, it's not defined. Is there anyway that I can define it as event without taking more lines? Typescript btw
Code: https://srcb.in/7f27c8aeeb

sudden geyser
ionic dawn
#

show code

#

nvm

compact echo
#

@sudden geyser yes

#

I'm just testing it

quartz kindle
#

line 21 looks good, nothing wrong with it

#

that if(event) is indeed out of place

compact echo
#

@quartz kindle I figured it out. Have to put it after the switch

quartz kindle
#

yes

opal plank
#

@ Tim hilp

cloud girder
#

Sup

#

İ have a bot

#

How i can add it here

opal plank
agile lance
#

Why is it anyone can use the command when i did

let cmdRan = `${prefix}seteco`
if(!message.author.id == "ID ONE" || "ID TWO") return message.reply(`You can not trigger the ${cmdRan} command.`)
quartz kindle
#

you cant compare multiple ids like that

agile lance
#

Ah. I'm not familiar with using the for loop with arrays

quartz kindle
#

you dont need a for loop with arrays

agile lance
#

I've been making my life harder than needed ;-;

ionic dawn
#

dsnt message.author return the User object?

#

why isnt the same as the discord docs?

agile lance
#

I'm using message.author then using .id to find the UID

quartz kindle
#

whats happening is this:
!authorid == "ID ONE" || "ID TWO"
becomes
false == "ID ONE" || "ID TWO"
becomes
false || "ID TWO"
becomes
false || true
becomes
true

agile lance
#

So maybe something like this:

let cmdRan = `${prefix}seteco`
if(!message.author.id == "ID ONE") return message.reply(`You can not trigger the ${cmdRan} command.`)
if(!message.author.id == "ID TWO") return message.reply(`You can not trigger the ${cmdRan} command.`)
```?
quartz kindle
#

you're still doing !message.author.id == "ID ONE"
which becomes false == "ID ONE"

#

what you want is message.author.id !== "ID ONE"

#

aka: NOT EQUALS

agile lance
#

Ohh, Thanks

quartz kindle
#

and you can use both together in one line

#

but you have to repeat the entire comparison

#

if(a !== b || a !== c)

agile lance
#

It's better than doing more complicated stuff

quartz kindle
#

yup

agile lance
#

So this will work:

let cmdRan = `${prefix}seteco`
let UID = message.author.id
if(UID !== "ID ONE" || UID !== "ID TWO") return message.reply(`You can not trigger the ${cmdRan} command.`)
quartz kindle
#

yes, just one thing, you probably want to use an && here, not an ||, assuming you want only those 2 IDs to be able to use the command

agile lance
#

Yeah, Only those 2 because it's a Global Economy bot

quartz kindle
#

if ID is NOT EQUAL ID1 AND ID is NOT EQUAL ID2

boreal iron
#

I would say identical instead of equal since it has to be the same type def as well

#

If message.author.id is an integer and you compare this to a string it will return false of course.

random maple
#

Just a little question:
Is there a way to make a command that can make commands for the bot?

boreal iron
#

Sure why not if you save your input into a database for example the bot could listen to it

#

As soon as you add a new command it will be added to the database for example and also to your cache, to make the bot listen to it without the need to read the database to get the latest commands the bot has to listen to

viscid badger
#

umm

boreal iron
#

And if you restart your bot it will request the lastest commands saved n database n once to be up to date again

random maple
#

Hmmm... Thanx

boreal iron
#

Instead cache let’s say commands array

#

Array is being created on bot init and you can add or remove new commands of course at any time

random maple
#

OK. I will try this a bit later.

#

It's going to take a long time

earnest phoenix
#

hey

#

im new to vs

#

and i am making a bot in js

#

so how would i be able to turn it off

#

if i start it with node .

normal sage
#

anyone know what’s the mee6 level api?

dawn harbor
#

yes

#

kinda

toxic acorn
#

Mmm anyone know a good way to have a trigger have an extremely rare chance? Example, you send a message and theres a 1/10000 chance you get a response back. Or if theres a bot that could do something like this already?

normal sage
#

kinda
@dawn harbor link?

ionic dawn
#

how do I write ` inside another one

normal sage
#

idk

dawn harbor
#

\ `

#

`E`

normal sage
#

`` a ``

ionic dawn
dawn harbor
#

@ionic dawn Try \`

chilly bison
#

Mmm anyone know a good way to have a trigger have an extremely rare chance? Example, you send a message and theres a 1/10000 chance you get a response back. Or if theres a bot that could do something like this already?
@toxic acorn bruh don't you have a custom bot already lol

random maple
#

Mmm anyone know a good way to have a trigger have an extremely rare chance? Example, you send a message and theres a 1/10000 chance you get a response back. Or if theres a bot that could do something like this already?
@toxic acorn generate a random number from 1 to 10000 and, If it is equals f.e. 7729 bot will react. If it is not - stop sequence

chilly bison
#
if(Math.floor(Math.random() * 10000) == 1) //do stuff
random maple
#

In theory it is going to work