#development

1 messages · Page 1816 of 1

runic depot
#

;)

long crow
#

I wonder if this good enough for / command help, some of the commands have subcommands, and I don't want to clusterfk help command with it, waifupic for example have 25 subcommands

small tangle
#

should be fine imo, slash commands are pretty selfexplanatory since you can add information to each parameter

cinder patio
#

you don't need a help command for slash commands

long crow
#

Well, think of they add it, and slash won't appear immediately, so it kinda backup before they kick it 6min later

#

at least for me

#

I've seen some fellow add bot and didn't give permission for sending message though, type in help command then kick bot. That peeps kinda existKEKW

small tangle
#

there is no help for these people

stoic cypress
#

quite literally

#

cuz the help command doesn't send

small tangle
#

oh LULW that wasnt intended

regal creek
#

Anyone here knows python? If so do you know if i do a while True: thing or loop or whatever you want to say. Does it execute multiple at the same time or does it wait until the first has gone by

#

this was a bad explanation let me know if you need more in depth lol

quartz kindle
#

it waits until the first goes by

pale vessel
#

Aren't loops blocking

regal creek
pale vessel
#

Is there even such thing as a non-blocking loop

quartz kindle
#

you can sleep a loop yes

regal creek
#

alright

#

thanks

quartz kindle
slender thistle
#

Yeah

earnest phoenix
#

There has to be something yielding control to the event loop though

waxen bough
#

can i still use / as prefix even though it's reserved for slash commands?

slender thistle
#

Gonna be tough but it's possible

pale vessel
#

I think users would need to add a space before commands

#

/cmd or something

slender thistle
#

Nah

pale vessel
#

Or not

#

IDRK

slender thistle
#

It's possible, but make sure command names don't overlap

pale vessel
#

Just don't

#

It's annoying to use

#

@ / # are bad prefixes

slender thistle
#

^

waxen bough
#

i my implementation it's possible to add spaces because I use trim()

slender thistle
#

Use a dot at best

pale vessel
#

Use . 😎 👍

slender thistle
#

Or something that's easy to use both on phones and PCs

waxen bough
#

/ / / will work

pale vessel
#

I wouldn't recommend that

waxen bough
#

why

earnest phoenix
pale vessel
#

It overlaps with slash commands

slender thistle
#

Good luck listening to users' complaints about rough inaccessibility

waxen bough
#

i gave them option to change prefix they will be fine

pale vessel
#

That's fine I guess but most users CBA changing prefixes especially when the default one is trash

slender thistle
#

I hope you do realize that users will still complain

#

Exactly what flaze says

pale vessel
#

Just use . like me

#

Ez clap

waxen bough
#

ohh

slender thistle
#

A dot is just universal at this point

pale vessel
#

Simple and you could change it

slender thistle
#

Plus it doesn't force you to fuck around with the prefix to get a command to work

quartz kindle
#

yeah i use dot as well

lyric mountain
#

I use my bot's initial + !

#

most users change it to !! tho

pale vessel
#

s!

errant flax
#

imagine having a # as a prefix ytho

errant flax
#

is having the mention as a prefix a good thing hmm

cinder patio
#

if the only prefix is the mention then no

#

otherwise why not

lyric mountain
#

although it does add an extra step for command processing

errant flax
#

no like u have this one prefix as customizable and the other prefix is the mention which is permanently there bonk

lyric mountain
#

for example command !!hug <mention>

#

you'd need to filter out own bot mention

errant flax
#

i have a method for that pd_pepethumbsup

#

im just pretending the first part(mention prefix) doesn't exist and check if theres another mention for the bot

umbral lake
#
let audios = [
      "https://cdn.discordapp.com/attachments/681422909050322964/867017104015622174/michou-fier-lol.mp3",
      "https://cdn.discordapp.com/attachments/681422909050322964/867027410133319680/Arrete_de_me_faire_chier_bordel_de_merde.mp3",
      "https://cdn.discordapp.com/attachments/681422909050322964/867027435534811136/banana.mp3"
];

let audio = audios[Math.floor(Math.random() * audios.length)];
let thisaudio = new Audio(audio);
thisaudio.play();

after this, how to detect if the song is finished and play another song?

cinder patio
#

if you know the length of the chosen song you can use setTimeout

umbral lake
cinder patio
#

Instead of having only links in the array have an object with a link and the length

umbral lake
#

or I can do a .json

#

bruh

errant flax
#

or u can do a setInterval and stop it once the query is done pd_pepethumbsup

cinder patio
#

each song has a different length most likely

errant flax
#

oh ye forgot about that

umbral lake
#

I will do a .json

#

with names

#

links and time

errant flax
#

bruh dont plump_isee

umbral lake
#

why?

errant flax
#

storing json for data is unreliable bonk

lyric mountain
#

err...

errant flax
#

unless its like permanent

cinder patio
#

It's fine if it's static data

lyric mountain
#

in this case it's fine

errant flax
#

oh pd_pepethumbsup

umbral lake
cinder patio
#

that's static data

#

as long as your only reads the JSON file it's static

lyric mountain
#

json dbs are unreliable, but using them as actual lookup files are fine

errant flax
#

whats a static data wawa_huh_confused

lyric mountain
#

as long as modification through code is kept at a minimum

lyric mountain
errant flax
#

cant u just store it in object its the same thing for json wiggleflushed

lyric mountain
#

object is in-memory

cinder patio
#

yes

lyric mountain
#

json can be exported

cinder patio
#

but this way is more organized

lyric mountain
#

tbf both are the same thing inside js

#

the difference is that one can be edited externally

errant flax
#

how can i download my db's data as a json, just wondering

lyric mountain
#

you export

#

what database is it?

errant flax
#

mongodb

errant flax
#

oo thx

umbral lake
#

I have a problem wtf

#

require is not defined?

lyric mountain
#

you can't require that way afaik

#

switch var with let

umbral lake
#

nop :/

cinder patio
#

you can require json files

umbral lake
#

yes

#

I think its good

#

oh no

earnest phoenix
#
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'bot@3.0.0',
npm WARN EBADENGINE   required: { node: '14.x' },
npm WARN EBADENGINE   current: { node: 'v16.3.0', npm: '7.15.1' }
npm WARN EBADENGINE }
npm WARN deprecated node-opus@0.3.3: This project is unmaintained. See @discordjs/opus for an alternative.```
#

how solve this thig

small tangle
#

my very first bot used a json file as a db goaYikes

#

exactly two days until the first file corruption lmaoo

errant flax
earnest phoenix
small tangle
#

yeah same

earnest phoenix
errant flax
#

its easy just search in yt

earnest phoenix
# errant flax its easy just search in yt
npm WARN EBADENGINE   package: 'bot@3.0.0',
npm WARN EBADENGINE   required: { node: '14.x' },
npm WARN EBADENGINE   current: { node: 'v16.3.0', npm: '7.15.1' }
npm WARN EBADENGINE }
npm WARN deprecated node-opus@0.3.3: This project is unmaintained. See @discordjs/opus for an alternative.```
#

can you help here

errant flax
#

idk haven't encountered that

earnest phoenix
#

scam

errant flax
#

seems like it needs a specific node version

#

can u run
node --v

earnest phoenix
#

to node 16

errant flax
#

run node --v

#

in terminal

earnest phoenix
#

👀

errant flax
#

oh bonk

#

u cant

earnest phoenix
#

scam

errant flax
#

replit doesn't support node v14 iara_laugh

earnest phoenix
errant flax
#

thats why the repl community is complaining bc djs v13 requires v14 or up

earnest phoenix
#
npm WARN EBADENGINE   package: 'bot@3.0.0',
npm WARN EBADENGINE   required: { node: '14.x' },
npm WARN EBADENGINE   current: { node: 'v16.3.0', npm: '7.15.1' }
npm WARN EBADENGINE }
npm WARN deprecated node-opus@0.3.3: This project is unmaintained. See @discordjs/opus for an alternative.```
errant flax
earnest phoenix
#
npm WARN EBADENGINE   package: 'bot@3.0.0',
npm WARN EBADENGINE   required: { node: '14.x' },
npm WARN EBADENGINE   current: { node: 'v16.3.0', npm: '7.15.1' }
npm WARN EBADENGINE }
npm WARN deprecated node-opus@0.3.3: This project is unmaintained. See @discordjs/opus for an alternative.````
#

in terminal l of vps

umbral lake
#

and in my script.js idk how to define :/

solemn latch
errant flax
#

what does vps stands for

solemn latch
#

They don't support the version of node you require. Nothing you can do to fix that

#

Virtual private server

small tangle
#

virtual private server

errant flax
#

i only know a vps as like a hosting platform

earnest phoenix
errant flax
earnest phoenix
#

i try to deploy

#

but this comes

#
npm WARN EBADENGINE   package: 'KIRA@3.0.0',
npm WARN EBADENGINE   required: { node: '14.x' },
npm WARN EBADENGINE   current: { node: 'v16.3.0', npm: '7.15.1' }
npm WARN EBADENGINE }
npm WARN deprecated node-opus@0.3.3: This project is unmaintained. See @discordjs/opus for an alternative.```
solemn latch
#

Not sure what aws supports. They will have documentation to help with that

#

You'll have to go through that

solemn latch
#

Then you'll have to go through their documentation to know how to use v16

earnest phoenix
#

can you tell

errant flax
#

how do i import data in html?

#

like i want to display how many servers my bot is in via
client.guilds.cache.size

earnest phoenix
#

erro solve

#

wow

errant flax
#

how would i display that in html

cinder patio
#

it's not that easy

errant flax
#

tell me the process hmm

cinder patio
#

well first off you have to have an HTTP server running from the same process your bot's in. Then you'll have to create an endpoint which returns the guild count, and then in the client make a HTTP request to that endpoint and inject that into the HTML

errant flax
#

im gonna use express how do i "inject" that into html?

cinder patio
#
document.getElementById("IdOfTheElementWhichTheGuildCountWillbeIn").innerHTML = `Guild count: ${guildCount}`
#

for example

errant flax
#

and how do i define guildCount wawa_huh_confused

lyric mountain
#

client.guilds.cache.size?

cinder patio
#

you have to make a HTTP request to the endpoint

errant flax
#

wait im confused lookaround

#

how do i make a request and put that data in html?

solemn latch
#

typically with javascript

errant flax
#

aight im dead lost now sad

earnest phoenix
#

```npm WARN deprecated node-opus@0.3.3: This project is unmaintained. See @discordjs/opus for an alternative.````

#

what this

solemn latch
#

its unmaintained, and shouldnt be used

pure lily
#

How to make a bot auto leave a server thats not whitelisted

solemn latch
#

In the guild join event check if it's on the whitelist.
Probably will want to check all guilds on startup too

stoic cypress
#

In python, what protocol should I use to ensure the bot has guidl permissions.

#

I have a help command set up with reaction roles, however if the bot lacks manage messages command it has to default to a standalone page.

#

I have this, but fear it may be incorrect.

#

Well, I know it's incorrect because it doesn't work KEKW

wary forge
#

hey, I realized many bots have "About me" in their profile. how to do this?

lament rock
#

You should check discord.py docs for permissions systems

lament rock
stoic cypress
lament rock
stoic cypress
#

one thing I haven't tried is client.user, it might work

lament rock
#

client user is a user object. Users do not have permissions since Users do not have a guild relation. Members are what has guild relations

stoic cypress
#

alright, so how would i retrieve the bot as a member?

pliant copper
#

Why does the code run backwards?

lament rock
#

pass in self iirc

quartz kindle
#

its async

stoic cypress
#

so self.bot.etc

lament rock
#

just self

stoic cypress
#

alright i will try

pliant copper
quartz kindle
#

you dont

pliant copper
#

So I just have to deal with it? Fun

lament rock
#

return the bool value in the callback

slender thistle
#

@stoic cypress ctx.channel.permissions_for(ctx.guild.me) would return the channel permissions

lament rock
#

the point of async code is waiting for a task to finish and then continuing. You do not wait for that async function to complete, therefor, the code in the scope of the top level fn is running synchronously and goes as fast as possible

lament rock
#

perms for a guild channel is what they need

#

manage messages doesn't appear in a guild permissions collection

slender thistle
#

Then yeah, ctx.guild.me.permissions_in or ctx.channel.permissions_for

pliant copper
lament rock
#

manage messages on roles is a blanket permission value which only overrides if a channel's value isn't set. channel overrides take precedence over all role permissions

stoic cypress
#

Testing right now, might not have the gist yet.

#

looking @ docs

lyric mountain
#

user perms > channel perms > role perms > everyone perms

lament rock
#

Trying to test manage messages in the scope of just a guild and not a channel doesn't make sense

slender thistle
#

It does if you don't care about channel overwrites

#

Otherwise yeah, rely on the channel permission instead

lament rock
#

Then your value would be incorrect if channel overrides are present which conflict with the role permissions

stoic cypress
#

I got to here, but i'm not sure how to debunk this.

#

These are the channel permissions for the bot.

lyric mountain
#

debunk

stoic cypress
#

you know what i mean

#

as in to get a thing from it that says 'yes i have this permission' or 'no i don't'

lyric mountain
#

just check if the flag is enabled

stoic cypress
#

?

lyric mountain
#

or permissions_in

lament rock
#

There is a manage message property on that permissions collection you can access which is a boolean for if your client can manage messages in that channel

stoic cypress
#

yea ive confused myself now

#

I have it in member form, i think im tryna go off of that

#

i need this with the bot identified yes?

#

but with manage_messages

slender thistle
#

What's member set to?

stoic cypress
#

this is a different command

#

but member would be author in this command

#

or a mentioned user

slender thistle
#

And you want to get the bot's perms in current channel, right?

stoic cypress
#

that is correct.

#

it might be easier to explain what i'm actually trying to do.

#

idk

slender thistle
#

ctx.guild.me.permissions_in(ctx.channel).manage_messages

#

permissions_in on Member instance here returns a Permissions object, where you then can get the manage_messages flag

#

Guild.me returns Member version of your bot in that guild

stoic cypress
#

yeah i understand, i'll look more into properly understanding it once ive got it sorted

#

appreciate the help.

signal estuary
#

I am trying to make a bot "dashboard" and I am searching for "getting bot reference to website" but there arent any results. So how can I get a reference from my bot to my website so I can for example show the member count on the website?

#

<@&304313580025544704>

modern sable
gilded plankBOT
#

@signal estuary

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

Here are some examples of emergencies:

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

what would u have to type in ur stats cmd to get this

#

because me = dumb dumb

tired panther
lyric mountain
signal estuary
tired panther
lyric mountain
#

that's volatile

tired panther
#

the get MessageCount would be fetching it from your Database or stuff you want to do

lyric mountain
#

that's volatile

tired panther
#

thats pseudo code @wooden kindle btw

lyric mountain
#

if you don't use a database, restarting the bot will zero the count

copper cradle
#

Inb4 getMessageCount is not defined @tired panther

tired panther
copper cradle
#

I know...

#

That's what I said

#

"Inb4 they come saying getMessageCount is not defined"

#

That's what I meant to say at least

tulip ledge
#

Does anyone know why when I use a link to my express app (which contains an image) as the thumbnail for an embed it doesn't work?
.setThumbnail(image) -> When I log image it returns: http://localhost:8080/creators?id=creator-1626789169653.jpg

// ExpressHandler.js --> app.get()
res.sendFile(`${creatorId}.jpg`, options, (err) => {
        if (err) throw err;
        else console.log("Succesfully sent: ", creatorId)
      });

If I got to the link myself it shows the image

lyric mountain
#

well, you can't use localhost on a service

#

localhost doesn't exist nor is accessible anywhere else in the world except for your pc

sick agate
#

You can use ngrok for that or another some shit

lyric mountain
#

is that orcish?

#

wtf is ngrok?

wheat mesa
#

tcp tunneling program

#

easy to set up servers and stuff

lyric mountain
#

oh

inland turret
#

can someone help me with scripting/making a game

#

i dont know how to script dm me if u want to

lyric mountain
quartz kindle
#

you want to make a game but dont know how?

#

thats like wanting to build a car by yourself without any tools

lyric mountain
#

nonono, he wants to build a car but someone else does it for him

#

it's like "make a game for me as I say and I might let you put your name next to mine"

small tangle
tulip ledge
sick agate
#

Even heroku and similars should just work fine

tulip ledge
#

Wait how would I do that with heroku?

sick agate
#

Use the same code maybe?

tulip ledge
#

But I upload it to heroku?

sick agate
#

Yes

austere zealot
#

Is there something different for webhooks if you'r hosting from your pc? Cuz whenever i try testing my webhook it does not print anything.

lyric mountain
#

what url are u testing?

lyric mountain
#

and I suppose "myip" is the public ip right?

austere zealot
#

yea

lyric mountain
#

did you try seein if you're reachable?

austere zealot
lyric mountain
boreal iron
#

Hosting locally requires to set firewall rules to allow incoming connections as well as port forwarding in your router since incoming connections for non standardized ports being blocked by default.

lyric mountain
#

see if you get some kind of "found" or something status

boreal iron
#

It also requires to actually own a “real” public IPv4 address as these are DSLite tunnels nowadays meaning the ISP will identify you by that public IP address but it’s not accessible from the outside, the ‘net

lyric mountain
#

also if you're using windows you're in to a loooooong wrestle with the OS

boreal iron
#

Hosting from inside your network is not recommended if you’re not sure about the mentioned things

austere zealot
#

ok, ill look through that, thank you both.

boreal iron
quartz kindle
#

you shouldnt even need to do that

boreal iron
#

At least that’s more costumer friendly than on Unix systems

quartz kindle
#

when you bind a program to a port, windows will show you a pop up for you to allow connections to it

boreal iron
#

Should != Is okeh

boreal iron
quartz kindle
#

try running something like a minecraft server

#

it will show a pop up about it

#

at least it does for me

boreal iron
#

But that doesn’t matter anyways in his case as the router will drop incoming connections for the specified port anyways

boreal iron
lyric mountain
#

"How to setup public port with minecraft"

quartz kindle
#

yes it wont help with port forwarding, just avoids messing with the advanced firewall shit

boreal iron
#

Well yeah maybe but that’s something I’m not aware of

#

I mean the app still needs to broadcast it needs (in this case the port) to the network service anyhow

#

I wonder if that somehow just adds temporarily firewall rules as long as the app is running

#

Rules which aren’t listed

lyric mountain
#

imagine if there was ufw for windows

wary swan
#

is there a good music downloading solution i want to cut music video's intro i tried spotify downloaders but they are basicly a youtube-dl with a spotify apı resolver mounted into them so they dont work

boreal iron
#

Well ufw is just an interface using iptables

#

And tbh even if you can bypass the Windows firewall easily it is actually really consumer friendly

#

The package handling is working well even for rules you have set manually still blocking too much requests, syn floods, dos attacks etc.

#

But I prefer iptables, too

#

Which will be replaced by nftables in the future anyways

lyric mountain
#

tbf the only thing I miss in windows is bash as scripting lang

#

like bruh, who the hell codes in powershell's whatever lang it uses

boreal iron
#

lmao

#

I do

#

For most of the automated system tasks

lyric mountain
#

really?

modest maple
#

powershell is its own language

boreal iron
#

Related to anything from apps, to network etc.

lyric mountain
#

teach me the sacred paths master

#

I can't figure out how to read microsoft's docs

#

language is too cryptc

boreal iron
#

Oh never said I’m a pro,
Just need to look into the docs over and over again as the console isn’t really helpful printing errors with links to MSN sites

boreal iron
lyric mountain
#

really, whoever wrote their docs need to be fired

boreal iron
#

You may don’t do such complicated things KEKW

lyric mountain
#

even javadocs are more readable than that

boreal iron
#

Yes I agree

lyric mountain
#

also look at this

#

why

boreal iron
#

That’s another reason why I need to read it over and over again

#

But as Windows nowadays supports the Linux sub system bash should be supported as well

lyric mountain
#

ye, I did install it on my pc

#

but still feels weird since u cant just use directly from cmd or pshell

boreal iron
#

Hmm I agree

lyric mountain
#

the intro

boreal iron
#

Nothing really I wanna deal with since I’m always creating a test VM on my server at home,
More comfortable than working with a sub system

boreal iron
lyric mountain
#

I wonder if they'll add a native bash support in w11

#

since they already made it as a sub-system

boreal iron
#

Not like I would ever use it

#

More inbuilt restrictions and spy shit you can no longer get rid of

lyric mountain
#

ah true

boreal iron
#

As Windows is hard coding things nowadays instead of letting the users the ability to disable things in the registry for example

#

Which updates like H120/21 shown us

quasi shard
#

Does clickButton get emitted on selecting a MessageMenuOption in MessageMenu or is there something else that I'm missing?
discord-buttons ^

tulip ledge
#

Does anyone know if there's a way to use a base64 string as an embed thumbnail without using heroku or message attachment?

tulip ledge
#

it's saved like a base64 string in the API I'm using

lyric mountain
#

Well, you do need to host the api somewhere

tulip ledge
#

it's not my api

lyric mountain
#

Heroku, replit, vps, etc

#

Not yours?

tulip ledge
#

no

lyric mountain
#

Can't u just access it directly then?

tulip ledge
#

wdym?

#

I'm getting data from an api which includes a profileIcon key with a base64 string as it's value

lyric mountain
#

Like, is the api a service hosted somewhere?

tulip ledge
lyric mountain
#

Does it require authentication?

tulip ledge
#

yes

lyric mountain
#

Your only option then is attachment

#

Then using attachments://name.ext

tulip ledge
#

but once I edit the embed the attachment is shown above it

lyric mountain
#

Well, you do need to refetence the attachment somewhere in the embed to not have it show above it

tulip ledge
#

wdym?

#

just reference it?

#

is there a way to hide it?

lyric mountain
#

Which will make the attachment "move" to the assigned spot

tulip ledge
#

what about

#

sending the attachment to a temporary channel and then taking the URL from there?

#

would that work?

pale vessel
#

yes

crimson vapor
#

is that a good idea tho?

lyric mountain
#

also "temporary" isn't really an option since let you delete the channel/image the link will become invalid

#

thus removing the image from your embed

errant flax
#

just convert it to a link
but not use discord's link for it pd_pepethumbsup

lyric mountain
#

doesn't github have a lib?

#

yk, you could just upload the image to a private repo

errant flax
#

i dont know github

#

i just have an account that i dont use

#

are the emojis property for client always cached?

lyric mountain
#

do you at least use git or other versioning sorftware?

earnest phoenix
#

Whats github?

errant flax
#

i only use github for backups

#

thats all

earnest phoenix
#

github is powerful if you use it properly

solemn latch
#

Even if you don't use it properly. Using it once every few weeks for 15 seconds can save you so much time

modest maple
#

(full disclaimer you dont have to use github, other system exist e.g. bitbucket, gitlab etc...)

fresh verge
#

On Javascript, MongoDB, when I add a new field to the main data file, how can I have it add the new field to all existing data?

modest maple
#

with yer favourite buddy iteration

regal jacinth
#
async def taskGenerator(task):
    autoActions = AUTOACTIONS()
    print("Waiting until ready")
    await client.wait_until_ready()
    print("Finished")```
the `await client.wait_until_ready()` is taking too long and `Finished` is never printed
how do i fix this?
boreal iron
lyric mountain
#

You're crazy

lament rock
#

all my homies use sftp to pull changes :)

wheat mesa
#

Nah I prefer to copy all my code onto a stone tablet and pass it around the village.

distant egret
#

very basic of you

boreal iron
earnest phoenix
#

Hello any one say how setup in active vc leave on MUSIC bot

lyric mountain
#

Also it allows collaboration and CI/CD pipelining

boreal iron
#

But yeah I know what u mean

#

I guess I will move forward in my next life

long crow
earnest phoenix
#

This man uses notepad++?

long crow
#

I use native Notepad weirdsip

earnest phoenix
#

Oh no

#

I couldn’t

sudden geyser
#

Emacs user

boreal iron
limber mica
#

-botinfo 866832123494006804

gilded plankBOT
#

tickNo That bot wasn't found

lyric mountain
#

With commits you don't need to go back step by step

#

You can grab any state of a file from any time before now

#

Basically revert any change independently of steps

boreal iron
lyric mountain
noble terrace
#

Hi

#

New to discord

crimson vapor
#

me when I make the happy little accident of deleting a file with 500 lines

boreal iron
noble terrace
boreal iron
crimson vapor
#

oh

#

fun

boreal iron
#

That was horrible

crimson vapor
#

I can imagine

#

thats why I never take backups

#

the pain is instant

#

not delayed

boreal iron
#

At least I’ve learned something by doing some mistakes

crimson vapor
#

yeah thats always a good thing about fucking up

#

or even just being careless

boreal iron
#

hopefully I will remember

#

Alright falling asleep… have a good one

crimson vapor
#

gn

fair cave
#

Killer
?

#

Staff

crimson vapor
#

?

fair cave
#

I need help someone killing me and I need someone to kick someone in the game

crimson vapor
#

I think you got the wrong server mate

fair cave
#

Meet me at the gas station when you get on okay

#

And someone is a lying about being a staff

crimson vapor
#

@scenic kelp job time

fair cave
#

You can please send a unit on the game

scenic kelp
#

no

#

wrong server

#

-wrongserver

gilded plankBOT
#

Hey! We think you have our server mistaken. We do not provide support, help, or advice for any bot. You need to click on the "Discord" button on the bot's page of the bot you need support for, not the "Join Discord" button at the top of our website. If there isn't a button that says Support Server, the server invite is invalid or you were banned from the bot's support server, then we can't help you. Sorry :(

scenic kelp
#

this is not bully hunters

fair cave
#

Meet me at the gas station in the past and left the game and I need tell you what I’m wearing okay

wheat mesa
#

Uh what

fair cave
#

Name is for use need to kick is knownJuju19

wheat mesa
#

You are not in the correct server

fair cave
#

I am at the gas station waiting

wheat mesa
#

Okay this guy is just trolling

fair cave
#

The game is connector state role play

#

What is your name on Roblox

scenic kelp
#

@fair cave you

#

have the wrong server

fair cave
#

I am on a bike

#

Meet me in the gas station

#

I am joining the game

#

Meet me in the gas station when you get on okay when you get on

craggy pine
fair cave
#

Yes I need someone to come down and help the kick

#

I got killed

#

I got killed

#

☠️☠️😢

#

I’m leaving at two hours

wheat mesa
#

Small children on discord 👍

snow niche
#

I am trying to find out how many requests I made to my api.
I have made an axios call to the URL and have received HTML code as my data.
https://gist.github.com/EliteHaxy/1237fc0307004137b6f72d9f3deea6cb
That is the data I received. I want to display the number "990" (line 115) in a discord message. is that possible?
Ping me if you know. c:

regal jacinth
#
async def function():
                    async with client.db.execute(f"""SELECT * FROM active_blacklist""") as cursor:
                        listOfAllItems = await cursor.fetchone()
                        try:
                            active_blacklist = eval(listOfAllItems[0])
                        except Exception as e:
                            print("ERROR-----")
                            print(e)
                            print(listOfAllItems)

                            print("ERROR ENDED------")
                        else:
                            print(active_blacklist)``` is there a way to check whether the table is none or not without getting errors?
latent heron
#

if so, you could do a very simple statement like this

if listOfAllItmes not in [None, []]:
  pass
regal jacinth
latent heron
#

i don't use sql verycool so can't relate

long crow
#

first time trying ts typechecking be like

long crow
#

All pointing to type of... doesnt have method...

#

So something to do with some setting I guess

#

While that method is exist and code working

cinder patio
#

everything is any

#

esp when you have all of your commans and events in different diles

#

files*

long crow
#

Anything I can look into instead of doing @ts-ignore? I dont think ts-ignore is a good solutions, since error mean something I need to look into

waxen bough
#

why not typescript

long crow
#

Well, care to explain to me like im 5 converting js to ts?

waxen bough
#

i'm not good at explaining

wheat mesa
#

Well, your first step should be swapping to Detritus

#

👀

long crow
#

Not even related shitritus

#

Or Dikjs

wheat mesa
#

How dare you insult detritus!

sly sierra
long crow
#

mjs, js extension file

flat copper
#
const { MessageEmbed } = require('discord.js');
const db = require('old-wio.db');
const ms = require('ms');
module.exports = {
	name: 'timer',
	aliases: ['countDown'],
	description: 'start a timer',
	category: 'General',
	execute: async (client, message, args) => {
		let Times = args[0];
		let time = ms(Times);

		db.set(message.author.id, Date.now());

		let i;
		let timePassed;
    let timeLeft;
		i = setInterval(async () => {
			let t = await db.fetch(message.author.id);

			timePassed = Date.now() - t;
		   timeLeft = time - timePassed;
		}, 5000);
		
		console.log(timeLeft);

		let int;
		let embed = new MessageEmbed()
			.setTitle('⏲️ Timer Started!')
			.setDescription(`>>> Time Left: ${ms(timeLeft)}`)
			.setColor('RANDOM')
			.setFooter(message.author.username, message.author.displayAvatarURL());

		let m = await message.Reply(embed).then(msg => {
			timeLeft = time - timePassed;

			int = setInterval(async () => {
				await msg.edit({ embed });
			}, 5000);
		});
		setTimeout(async () => {
			clearInterval(int);
			clearInterval(i);
			m.edit({
				embed: {
					title: '⏲️ Timer Stopped!',
					color: 'RANDOM'
				}
			});
			await db.delete(message.author.id);
		}, timeLeft);
	}
};

Why timeLeft is undefined

earnest phoenix
#

If it’s not defined that’s probably why

#

Somewhere along the lines you’re making it undefined

flat copper
#

But I defined it

wanton flicker
#

hm... does anyone know to do cooldowns?

#

i tried using Bucket but it seems the command is still executed...

earnest phoenix
#

Well you could check against a time stamp against the current timestamp and not execute the rest of the code if the time has not passed

wanton flicker
earnest phoenix
#

Wdym

wanton flicker
#

like uh

earnest phoenix
#

You’d probably have to do it in every command unless you make a handler of sorts

wanton flicker
#

@cooldown(1, 10, BucketType.user) doesnt not cancel the command being called

earnest phoenix
#

Is this a python thing

wanton flicker
#

??

#

its coded in python...

earnest phoenix
#

Then I’m afraid I can’t really help with the code itself

wanton flicker
#

hmm since this is a collab im actually not sure 🤦‍♂️

#

ill just do what i did for my previous bot which is what u suggested

earnest phoenix
#

I can only provide the concept

flat copper
#
let m = await message.Reply(embed).then(msg => {
			int = setInterval(async() => {
				console.log(msg);
				await msg.edit("hlo");
			}, 5000);
		});```
error : cannot read property edit of undefined
earnest phoenix
#

Well Reply isn’t a thing

#

Make sure it’s lowercase

flat copper
earnest phoenix
#

Yes but Reply doesn’t exist

flat copper
#

Its sending the message but not editing it

earnest phoenix
#

But reply does

#

I don’t see how it sends anything or has the js Lang changed that much that methods aren’t case sensitive

flat copper
#

But its not editing

earnest phoenix
#

Well then msg is undefined

#

So it’s probably not a message object

wanton flicker
#

isnt msg supposed to be m or smth

#

idk about javascript so :D

earnest phoenix
#

It doesn’t matter what you call it

#

It’s just a name

wanton flicker
#

maybe he meant m idk 🤷‍♂️

earnest phoenix
#

He very clearly did

wanton flicker
#

oh then idk anything about js

#

:(

earnest phoenix
#

But I’m raising a question as to why they are awaiting and then .then inside a variable

#

Just await and then use the variable to edit

#

.then with await just returns a promise iirc

flat copper
#

I console the msg and its consoling the msg

#

Then why not editing

earnest phoenix
#

Your code is inefficient to begin with but I can’t begin to understand what’s going on since the code looks incorrect to me anyways

earnest phoenix
#

Yes but you are setting something in a variable but then using .then

#

Makes no sense to me

#

Either set it in a variable and use the variable or just use .then but anyway I don’t know what the issue is to me that code looks like it shouldn’t work to begin with

wanton flicker
# slender thistle Show your code
@cooldown(1, 10, BucketType.user)
    @commands.command(
        name="trivia",
        description="Answer a trivia question using reactions! Provide a number from 1 to 3 specifying the difficulty of the trivia question you want.",
        usage="trivia <difficulty>",
    )
    async def trivia(self, ctx, difficulty=100000000000):```
slender thistle
#

P.S. could set difficulty's default value to None

#

Interestimg though

#

And how are you using it

wanton flicker
wanton flicker
#

this is collab btw so xD

slender thistle
#

the command

wanton flicker
#

uh you want me to show the code below?

slender thistle
#

How you use the command

wanton flicker
#

hmm

slender thistle
#

In Discord

wanton flicker
#

uh yeah quick update

#

apparently my friend kind of got it working lol
but do you know how to make it send an error message instead of just not executing the command @slender thistle

slender thistle
#

on_command_error event

wanton flicker
#

hmm apparently

#

we have this code

slender thistle
#

it will be raised for cooldowns too. Check for CommandOnCooldown or whatever it is

wanton flicker
#
async def on_command_error(self, ctx, error, bypass=False):
        if isinstance(error, commands.CommandNotFound):
            pass
        elif isinstance(error, commands.NotOwner):
            #stuff that i wont show

        elif isinstance(error, commands.MissingPermissions):
            #stuff that i wont show

        elif isinstance(error, commands.CommandOnCooldown):
            embed = discord.Embed(
                title="Command on Cooldown",
                description=f"This command is on cooldown. Try again in {error.retry_after:,.1f} seconds.",
                colour=self.client.primary_colour,
            )
            embed.set_author(
                name=ctx.author.display_name, icon_url=ctx.author.avatar_url
            )
            await ctx.send(embed=embed)

        elif isinstance(error, commands.BadArgument):
            #more stuff i wont show
#

but apparently the commandoncooldown isnt being sent :

slender thistle
#

The cooldown only applies to usage of the command

wanton flicker
#

hmm so what should be corrected

slender thistle
#

It's raised when someone uses a command that's on cooldown

wanton flicker
slender thistle
#

Did you add it as an event to your bot object

wanton flicker
#

hmm lemme see

#

um im not completely sure what you mean 😶

#

but we have ```python
class Client(commands.Bot):
def init(self, **kwargs):
super().init(**kwargs)
self.help_command = None
self.start_time = datetime.datetime.utcnow()

@property
def uptime(self):
    return datetime.datetime.utcnow() - self.start_time

@property
def config(self):
    return config

@property
def primary_colour(self):
    return self.config.primary_colour

@property
def error_colour(self):
    return self.config.error_colour

@property
def icon_url(self):
    return self.config.icon_url```
flat copper
#

Hey
I have time in ms : 300000
How can I convert that to min or sec
Like
TimeLeft : 2m 30sec

slender thistle
#

I'm not sure what you want to do here

pine grove
#

Raid this class

waxen bough
#

mods

near stratus
#

@ripe prairie

earnest phoenix
#

as well as ex...

ripe prairie
#

-b @pine grove

gilded plankBOT
#

dblMod Banned babluop#2534 (@pine grove)

waxen bough
devout vapor
#

is there a better way to get a channel id when someone tagged it in a reply, other than to use regex to take out the <# > at the sides?

like for example:
bot asks for channel
user tags channel
bot wants the id of the tagged channel

waxen bough
#

message.mentions.channels

devout vapor
#

OH

#

thank you!! O:

waxen bough
#

i assume you use node.js

devout vapor
#

yes!

quaint wasp
#

uhhh

#

My ping is litilery 2613

#

When my bot is in 56 servers..

#

And 75k users but I think that doesnt matter really..

#

Is there a way to decrease it without sharding?

round quiver
#

good vps ...

quaint wasp
#

I am in good vps lol.

#

It's ping is about 50

#

But mine is litilery 2600.

regal lotus
#

Could anyone please help me develop my bot?

quaint wasp
#

Uhh... I suggest learning JavaScript or Python, depending on what you like more, and then if you do discord.js read https://discordjs.guide

earnest phoenix
#

@quaint wasp how long did the bot take to reply to the ping command?

amber thistle
#

ok so i have a website, the website uses discord's oauth2 to login and store data by the user's id, i want my website to remember if users have previously logged in or not so i store the user's object data (their discord account user object data) in the local storage. But the thing with local storage is that users can also store/clear/modify the data in it, so the user can just store a different user's object data in local storage and my website wouldn't notice that the user wasn't the same user in local storage,

basically my question is how do i prevent the user from pretending to be other users

earnest phoenix
#

@amber thistle
two options:

  1. encrypt the data before storing it
    now unless someone gets hold of someone's computer they can't pretend to be them

  2. store their ip (discord uses this)
    if the user logs in from somewhere else they have to verify through email

flat mirage
#

Does anyone know for making a dashboard and buying ur domain.Like is it paid?

#

like for example mee6's dashboard

amber thistle
earnest phoenix
#

i love how this dude unnecessarily pinged a random guy with hm

regal lotus
flat mirage
regal lotus
#

do you know how to do them?

flat mirage
slender thistle
earnest phoenix
slender thistle
#

You can just store the user object tied to a session

#

That user object would also store a switch that indicates whether a user has logged in previously

#

User's cookies/local storage could be a good place to store the actual session ID

quaint wasp
#

its full code is just about 0.25 G.

timber fractal
#
const profileModel = require('../structures/profileSchema');
        let user = msg.mentions.users.first();
        let data = await profileModel.findOne({ userID: user.id });
        let amount = args[1];
        let xp = data.xp;
        let newxp = xp - amount;
        const response = await profileModel.findOneAndUpdate({
            userID: user.xp,
        }, {
            xp: newxp,
           }
        );
        if(response) return msg.channel.send(`Succesfully decreased \`${user.tag}'s\` xp from ${xp}xp to ${data.xp}xp.`);
        if(!response) return msg.channel.send(`Failed to decrease their xp.`);``` why this code doesn't decrease their xp?
eternal osprey
#

hey! Is there any npm package or method with the use to scrape lots of site links based on a certain keyword? So the keyword france would give me lots of articles about france?

small tangle
timber fractal
#

oh wait lol i tabnine did the wrong thing, thanks

small tangle
devout vapor
#

is it possible to do a while loop for awaitmessages? so something like this:

msg.channel.send(`Do you want to add one more names? Reply with "yes" or "no".`)
msg.channel.awaitMessages(m => m.author.id == author, {max: 1}).then(collected => {
  reply = collected.first().content.toLowerCase()
  while (reply != no) {
    msg.channel.send(`Do you want to add one more names? Reply with "yes" or "no".`)
    msg.channel.awaitMessages(m => m.author.id == author, {max:1}).then(collected => {
    reply = collected.first().content.toLowerCase()
  })
  }
})
eternal elbow
#

(React.js) I'm posting to the backend on some pages that don't need authorization. How can I make this safe? So it should not be posted to the same url by someone else.

devout vapor
#

oh wait hold up, you might have a point. i'll go try it out 🤔

earnest phoenix
#

does anyone know if there is a rate limit for fetching invites from servers also

#

huh

frigid warren
#

I misunderstood your question

earnest phoenix
#

its ok

eternal osprey
#

does anyone maybe know how i can get random sites on google based on a certain keyword

#

Like with the use of a npm packge or not. Doesn't really matter to me

quasi shard
#

You can use SerpAPI

worn sonnet
#

Hi

#

I'm trying to create some group commands

#

the problem is when calling the sub-command the parent cmd is being invoked

eternal osprey
timber fractal
earnest phoenix
timber fractal
#

look at my code

earnest phoenix
timber fractal
#

and this will appear

earnest phoenix
#

What is this a member

#

how I learn coding or from where

#

msg.author.displayAvatarURL()

topaz phoenix
#
.titleandvote > a:first-child > .votebutton{
    background: #80d8fc;
      color: #2d3436;
     animation: animateHeart 1.2s infinite;
 }

.titleandvote > a:nth-child(2) > .votebutton{
    background: #80d8fc;
     color: #2d3436;
 }

.serversshards .votebutton:nth-child(1) {
    background: #80d8fc;
        color: #2d3436;
}

.serversshards .votebutton:nth-child(2) {
    background: transparent;
       color: #80d8fc;
}

.code {
    background: #A6662D;
    color: #F9CA9E;
}

.botpagebutton {
        background: #A6662D;
        color: #F9CA9E;
} ``` 
why doesn't that work ? (its on top.gg btw)
timber fractal
earnest phoenix
#

No

timber fractal
#

why not?

earnest phoenix
#

displayAvatarURL

earnest phoenix
timber fractal
#

yes

#

it doesnt work with this

#

can you help me?

wooden kindle
#

Right now I’m hosting on repl.it hacker plan! And my bot turns offline and online every 14 ish hours. Does anyone recommend and hosting that will stay online 24/7

timber fractal
summer torrent
#

you don't need user after first()

timber fractal
#

ok thx

small tangle
#
  1. add it as the unique _id or 2) add it as an attional field to a document and then insert it, you should find it quickly in the driver docs of the programming language of your choice
nimble kiln
#

How would I go ahead and find the specific version if this is listed in the package.json as dependency:
"eris": "github:abalabahaha/eris#fce520513053eb1f4466130d8075126cf21024fc"

lyric mountain
#

fce520513053eb1f4466130d8075126cf21024fc

#

the version

nimble kiln
#

Yeah and how would I find that on github?

pale vessel
#

Isn't that the commit hash

lyric mountain
#

ye, that's technically the version

#

it'd be numeric if it was a release or a tag

nimble kiln
#

ah commit hash, ok

lyric mountain
#

may I ask, why are you using a commit instead of npm version?

nimble kiln
#

Dont ask me ¯_(ツ)_/¯

#

I'm trying to revert this commit:
https://github.com/SideProjectGuys/invite-manager-bot/commit/9ea3c89206ad7835bc8c9e9561df3dffc96f0039

But simply re-adding it into the code throws TypeScript errors

  Type '(content: MessageContent, file?: MessageFile) => Promise<Message<TextableChannel>>' is not assignable to type '(content: MessageContent, file?: MessageFile | MessageFile[]) => Promise<Message<TextChannel>>'.
    Type 'Promise<Message<TextableChannel>>' is not assignable to type 'Promise<Message<TextChannel>>'.
      Type 'Message<TextableChannel>' is not assignable to type 'Message<TextChannel>'.
        Type 'TextableChannel' is not assignable to type 'TextChannel'.
          Type 'Textable & PrivateChannel' is missing the following properties from type 'TextChannel': lastPinTimestamp, rateLimitPerUser, topic, createInvite, and 19 more.

9  public createMessage(content: MessageContent, file?: MessageFile): Promise<Message> {
          ~~~~~~~~~~~~~

So I'm trying to figure out what's going on since I have no clue about TypeScript

#

Do I have to read that from the bottom?

lyric mountain
#

looks like FakeChannel extends TextChannel

#

and createMessage is having a type mismatch in both

#

that's what I understood

nimble kiln
#

Looks right to me tho (left InviteManager, right eris)

lyric mountain
#

idk then, will need a ts dude to help with that

amber thistle
#

it would be different if each web browser had their own unique id tho

amber thistle
lyric mountain
#

you can get the ip

amber thistle
#

i mean yea but i dont wanna

lyric mountain
#

or some other unique identifiable stuff

nimble kiln
#

Ok it seems that I can build it.

Old:public createMessage(content: MessageContent, file?: MessageFile): Promise<Message> {
"New": public createMessage(content: MessageContent, file?: MessageFile): Promise<Message<TextChannel>> {

lyric mountain
#

if you don't want to store the ip, just make a hash out of it and store that

nimble kiln
#

I just slapped some <TextChannel> after the Message ¯_(ツ)_/¯

amber thistle
#

the problem isnt about storing the ip or not, its more about the user's trust

#

like if u know a small, website that grabs ur ip, u would not wanna use that

nimble kiln
#

I would use that

#

Every website grabs IPs

lyric mountain
#

errr...pretty sure almost all sites get the ip

amber thistle
#

u would?

lyric mountain
#

also, the ip is public anyway

nimble kiln
#

If I dont trust a website with my IP I use a VPN

amber thistle
#

but arent those websites like famous

lyric mountain
#

not necessarily

amber thistle
#

well i wouldnt use a unfamous website that grabs my ip

#

so i was looking for something else

#

then i stumbled upon local storage

lyric mountain
#

local storage is client-side

nimble kiln
#

If a user clears their browser data they should not be logged in at the next visit

amber thistle
#

yes @lyric mountain

lyric mountain
#

and local storage can be edited

nimble kiln
#

That's actually something I expect to happen with every site

amber thistle
#

ok so i have a website, the website uses discord's oauth2 to login and store data by the user's id, i want my website to remember if users have previously logged in or not so i store the user's object data (their discord account user object data) in the local storage. But the thing with local storage is that users can also store/clear/modify the data in it, so the user can just store a different user's object data in local storage and my website wouldn't notice that the user wasn't the same user in local storage,

basically my question is how do i prevent the user from pretending to be other users

lyric mountain
#

use the user id

amber thistle
#

yes but

nimble kiln
#

ah I see, you want to prevent the user modifying the local storage

amber thistle
#

yes

nimble kiln
#

well you want to prevent logging in as another user, by modifying storage

amber thistle
#

i was thinking of doing a encryption with their id

lyric mountain
#

in my site, I generate a unique hash for each user that login to it

quartz kindle
#

you need to keep a database and generate access tokens

#

user logs in, generate token, store token in database and then give it to the user either in cookies or in localstorage

#

thats essentially what discord does

restive furnace
#

too many cookies

amber thistle
#

but how would u know if the user logged in or not if the only thing that identifies their browser is cleared?

quartz kindle
#

they have to login again

nimble kiln
#

Use PHP and PHP-Sessions :]

lyric mountain
#

when the use login just retrieve his id's token and return to them

amber thistle
#

is there a event for when local storage gets cleaed

lyric mountain
#

no

amber thistle
#

well i would wanna remove the token in the db when they clear local storage

lyric mountain
#

no no no

amber thistle
#

this is what im also confused at

#

oh?

lyric mountain
#

tokens must be permanent

quartz kindle
#

not necessarily

amber thistle
#

eh

quartz kindle
#

they can have an expiration date

#

and every relogin refreshes it

#

so they automatically expire if you dont use them for like 30 days

amber thistle
#

well i don wanna make a timeout for each user so im planning on making it permanant

quartz kindle
#

you can also make a unique token per session

#

so each browser has a unique session

#

thats what things like gmail and yahoo does

amber thistle
#

like a id?

quartz kindle
#

you can list active sessions, and deauthorize specific sessions

lyric mountain
#

what I do is:

user login -> does token exist? -> yes -> return token to client
                    |                       /\     
                    L no -> generate new token
amber thistle
#

hm this is more confusing than i thought it would be

lyric mountain
#

well, that because I use the token for more stuff other than the site

#

so I need to be able to deactivate a token to prevent access/usage

quartz kindle
#

all of these session methods work on the basis that the user's device is not gonna be stolen and/or tampered with, because there is virtually no way to prevent a stolen token and/or cookie from impersonating someone, so most companies dont bother

amber thistle
#

ok so im gonna explain what i understand so far
user goes onto my site -> retrieve token from local storage:

  1. token exists in local storage -> user can go onto my site

  2. token does not exist -> tells user to login -> store token -> user can go onto my site

lyric mountain
#

that's what I do

lyric mountain
#

except the token shouldn't be stored in the local storage for too long

#

I use session storage instead

amber thistle
#

but would that basically mean they have to relogin

quartz kindle
#
  1. token exists -> use token to connect -> check in database if token is valid -> accept session
lyric mountain
#

that way user gets logged out when he closes the browser

amber thistle
#

everytime they close the tab

lyric mountain
#

not the tab, the browser

amber thistle
#

oh

lyric mountain
#

session storage persist as long as there's at least one tab open

#

like google login

amber thistle
#

well the user still can modifiy

lyric mountain
#

well, yes

quartz kindle
#

most companies dont use session storage tho

lyric mountain
#

but hashes/tokens are unguessable

amber thistle
lyric mountain
#

the moment he refreshes the page you'd check if the token exists

amber thistle
#

yes but how would i know which token was the user's previous token in the db

lyric mountain
#

id

quartz kindle
#

if the token is permanent, it will stay in the database until the user removes it

#

i have a yahoo account for example, if i go into my account security sessions, i can see a list of active sessions, their browser/device info, and the time they were last used. some of those are from browsers that are long gone, last used 6+ months ago

#

i can then remove them from there

amber thistle
quartz kindle
#

you give them access to a list of active sessions

amber thistle
#

wait im gonna google what exactly is a session lol

#

ah i see

quartz kindle
#

im just explaining an example as seen in a real company, in this case yahoo

#

you have a page in your account settings that shows you all your sessions

amber thistle
#

im just trying to know if my user logged in or not

#

that thing is too fancy for me

quartz kindle
#

then either make a single universal token

#

or temporary tokens per session

amber thistle
#

a universal token

#

hm

quartz kindle
#

when you use sessions in php for example

#

they generate a session token and store it in cookies

solemn latch
#

There's also companies that handles login account creation stuff for you.
If your looking for an unfancy quick way to do it.

quartz kindle
#

that token expires once the session ends, and you have to login again

amber thistle
solemn latch
#

Plenty of companies allow that

quartz kindle
#

so basically

#
  1. user goes to website
  2. user logs in
  3. store user id in database and generate a token
  4. give the token to the user, store in cookies or local storage
amber thistle
#

hm

#

can user modify cookies

#

like in console or dev tools

quartz kindle
#

when the user returns:

  1. check if token exists, if it does try check if its valid
  2. if it is, do nothing
  3. if its not, login again
lyric mountain
#

everything you can do with js you can do in devtools, so pretty much nothing client-side is safe

quartz kindle
#

everything can be modified, you dont need to care about that

amber thistle
#

figures

quartz kindle
#

but now you have a token, not a user id

#

so you cant simply put another user id there and login as them

amber thistle
#

lmao the current method im using is storing the user id in local storage and thats basically it

quartz kindle
#

yeah

#

so do the exact same thing, but with a token instead of an id

#

or even a hash

amber thistle
#

hm but i would like to clear the invalid tokens in my db

lyric mountain
#

a tokenized hash KEKW

quartz kindle
#

most hashes today are secure enough to prevent reversing

lyric mountain
amber thistle
#

oh yea and i need something to check my userinput

#

well theres a lot to worry about but ill just work on front end for now lol

quartz kindle
#

you can do this for example

#

user logs in, get their id, for example "232768273927385"

#

store the id in the database

#

hash the id with some constant, like a fixed number or string

#

and store the hash in localstorage

amber thistle
#

so i unhash it when i need to use the id?

quartz kindle
#

you cant unhash something

amber thistle
#

oh

quartz kindle
#

thats why hashes are used for passwords

amber thistle
#

but how would u know if the id is correct?

quartz kindle
#

you hash the id in the database the same way you hashed it before, and check if the result is equal

amber thistle
#

oh

#

wouldnt encrypting and decrypting be the same?

quartz kindle
#

you will need to store something extra for indexing tho

#

no

#

hashing is one way encryption

#

there is no turning back

#

thats why its secure

amber thistle
#

oh so u wouldnt know the original text

quartz kindle
#

exactly

amber thistle
#

oo

quartz kindle
#

thats how servers store passwords

#

for example user logs in with password 12345678

#

server hashes that

#

and checks if that hash exists in the database

#

so the database never has the actual password

#

even if the database is stolen, the thief cant see peoples passwords

amber thistle
#

oo

quartz kindle
#

the same password hashed the same way will always result in the same hash

#

but the hash cannot be reversed to obtain the password

amber thistle
#

i see

#

but do u know how does top.gg know wheter u logged in or not

lyric mountain
#

store login timestamp on the local storage

#

when you enter the site again, check if it has expired already

quartz kindle
#

do they even store something? they always ask me to login again, so i think they are not even storing anything other than the oauth2 access token that expires in a couple hours

lyric mountain
#

they do

amber thistle
#

apparently they do

lyric mountain
#

they probably store 2 things

#

the user id and the login date

solemn latch
#

I don't actually know, but you can go 7 days without logging in again

amber thistle
#

but the thing is when i clear the local storage top.gg does not tell me to login again

solemn latch
#

I think that's the max?

lyric mountain
amber thistle
lyric mountain
quartz kindle
#

im looking at the stored stuff after logging in and see nothing relevant

#

just session ids in cookies

#

nothing in local storage, nothing in session storage

amber thistle
#

web dev is confusing

lyric mountain
#

like, if top.gg has your ip you can use that to validate session

quartz kindle
#

they just use a session cookie

lyric mountain
#

anti-multivote

#

they gotta store the ip somewhere too

quartz kindle
#

dont you need to be logged in to vote?

lyric mountain
#

you do

quartz kindle
#

then you dont need ip, just do one vote per account

lyric mountain
#

you just can't vote more than twice from the same network

#

like, on the same bot

quartz kindle
#

if you change network you can vote again? in the same account?

lyric mountain
#

probably no

quartz kindle
#

then they dont need ip

lyric mountain
#

multi accounts

#

you cant vote with multiple accounts on the same bot using the same network

quartz kindle
#

do they have protection against that?

lyric mountain
#

yep

#

that's one of the stuff that used to pop a lot on support earlier this year

quartz kindle
#

ah

#

then yes, likely ip and/or user agent

solemn latch
#

^_^

lyric mountain
#

damn wtf is that font color

quartz kindle
#

lmao

#

all the shit you can easily get from a user simply by them accessing your website

solemn latch
#

Honestly, was super confused when it said I have 4 webcams, but my phone has 4 cameras.

lyric mountain
#

your phone has 4 cameras?

solemn latch
#

Wtf compass directions

quartz kindle
#

most phones these days have multiple cameras

solemn latch
#

Yeah s10

#

1 front 3 back ultrawide, normal and zoom

lyric mountain
#

ah, that, I thought it was 4 back cameras

#

tbf I don't even know what a 4th back camera would be

#

ultra zoom?

quartz kindle
#

2 normals for 3d filming

solemn latch
#

Some have extra for secondary processing of the other cameras

lyric mountain
#

ah true

quartz kindle
#

also high speed camera

#

macro

#

thermal sensor xd

#

infrared

lyric mountain
#

at that point you have a handheld kinect

solemn latch
#

It's really spooky to me that motion sensing and compass is available to every site I visit.
Not something I was aware of

quartz kindle
#

imagine a phone with 10 back cameras

lyric mountain
quartz kindle
#

next level pr0n VR

solemn latch
#

👀

timber fractal
lyric mountain
#

do you receive the messages?

timber fractal
#

and it adds their level but doesnt reset their xp to 0

lyric mountain
#

looks like your json is faulty

#

out of scope

timber fractal
#

oh, thx

timber fractal
lyric mountain
#

that's not how json works

#

idk how mongo works, but json structure is ALWAYS key-value pairs

#

you cant have keyless values

timber fractal
#

oh

#

how should i fix it then?

lyric mountain
#

idk how mongo works

#

my guess is that you need to remove those brackets

pulsar spade
#

Anyone know how to calculate Avarage words per paragraphs in python?

timber fractal
#

okayy let me try

timber fractal
#

doesnt reset xp

lyric mountain
#

then you need to find out how value definition works on mongo

#

just like you did with $inc

#

there's probably a $set or something