#development

1 messages ยท Page 1757 of 1

inner stump
sage bobcat
#

One message removed from a suspended account.

weary crypt
# inner stump (yes i code on a chromebook)

The embeds are pretty good, could include the data about the user and who kicked/banned them. The help commands could use some work, they are all in one line, could be used in an embed or use pagination. Otherwise pretty good :)

#

what?

#

ad?

inner stump
#

do you use bot designer for discord

#

for some reason i know about that

lethal mantle
#

oh my

weary crypt
#

Yea it is pretty bad, there is not a lot of design for it. I have never used one, but have seen them. They dont let you to fully explore what a Discord bot can do

inner stump
#

should i add more statuses to my bot or more command

weary crypt
#

I mean, you can always learn, the best way to make a Discord bot is to use a programming language with a Wrapper for discord.

inner stump
weary crypt
#

"statuses"?

inner stump
weary crypt
#

I am not sure what apps are good for making Discord bots. Like I said I would use a wrapper for discord

weary crypt
#

The discord wrapper is for their api. Basically allows you to interact with Discord in your preferred programming language

inner stump
# weary crypt I don't understand

ok so every 12 or 15 seconds there is a different status for my bot. and i want to add another status to go in the status rotation. i have 2 statuses to rotate in but i want more

weary crypt
#

Depends on the language you are going to use.

weary crypt
#

Use DSharpPlus then

#

You can install that from Nuget

#

Right click this

#

then you can just install whatever you would like from there

#

No you are all good :)

#

I believe that DSharpPlus is currently using .Net 5

#

lol

inner stump
#

should i add more commands to my bot

#

which commands to add besides mute (i am adding mute to my bot's update 2)

#

ok

weary crypt
#

Yea, if you get confused, about any of the code you should check out Tim Corey on youtube. He is pretty good and has some great tutorials for beginners and such

inner stump
#

should i go ahead and release mute command/version 2

inner stump
marble juniper
#

you posted this 3 times now

#

we get it

inner stump
#

calm down bro

clear marlin
#

yes please, calm down

marble juniper
#

yes please

rocky hearth
#

when we destructure an array or object, does it also create a new object instance in memory?

vivid fulcrum
#

no

#

it's just syntax sugar

woeful pike
#

you can check this yourself by destruxturing a property and checking if the references equal

rocky hearth
#

na I was meant for the braces used to destructure the object.
Like, const { piece } = square;, the braces used here, does that count as an new object instantiation?

woeful pike
#

nop

#

it's the same thing as declaring a variable, it just creates a so called "pointer"

rocky hearth
#

hmmm kk

prime mist
#

If you use typescript, you could mark the variable as read-only to ensure immutability.

rose warren
#

If a user changes their avatar, Discord deletes it immediately from their servers right?

earnest phoenix
#

The avatar is deleted completely from the CDN yes

rose warren
#

I have a command that collects avatar urls for a game and I'm wondering what the best way to put them into canvases is. Only problem is when people react, the game starts, during the game if someone changes their pfp the stored url is a 404 error.

#

I just didn't want to hit the api for each canvas

#

But I guess I have no choice but to fetch avatars each time...

opal plank
#

Not rlly

prime mist
#

Can you cache them?

opal plank
#

If i remember correctly avtar updates should come under GUILD_MEMBER_UPDATES

#

As long as u fetch ur users from cache before u do any operation it should be fine

#

U dont need to do any extra requests

rose warren
#

Yeah I fetch users from cache, make a map, pass the map to my game function and iterate through them 2 by 2 (it's a hunger games simulator). I think if someone changes their pfp after the game starts (after the map has been passed to the game function) it gives a 404 error. Does that make sense or not?

prime mist
#

So you have no way of updating the url in real time?

rose warren
#

No. It just makes a map using the data it gets from the cache at the beginning of the game

#

The problem arises when you have a big game with 70 participants. It leaves lots of time for people to change their pfps ๐Ÿ˜…

prime mist
#

You could store the image in a blob on init?

opal plank
#

like i said

#

everytime you decide to make a change

#

for example, update the image/canvas

#

fetch the user again from cache

rose warren
#

Yeah I thought so. I wanted to avoid that but I guess there's no way around it.

opal plank
#

theres no downside in that

#

you arent FETCHING a user

rose warren
#

Yeah

opal plank
#

youre getting it from cache

#

if you were fetching them, that could be an issue with ratelimits and response times

rose warren
#

I mean getting it from cache at the start of the game or during the game doesn't really make a difference

opal plank
#

u said u were using canvas,right?

rose warren
#

Yep

opal plank
#

what you COULD do to not that what im suggesting is adding a listener on ur thing

opal plank
#

keep in mind this might cause "memory leaks" since you'd constantly creating and destroying listeners

rose warren
#

Would I need intents for that?

#

Yeah

opal plank
#

you would, yes

rose warren
#

It doesn't seem ideal

#

I don't have GUILD_MEMBERS intents yet

opal plank
#

it is much more dynamic

rose warren
#

Waiting for Discord

opal plank
#

this WOULD probably be ur most performant thing

#

technically you could create an event elsewhere so it doesnt emit as often

rose warren
#

Would it be more performant? The other solution of just getting the avatar from cache upon canvas creation doesn't seem much worse.

opal plank
#
const avatarChange = <client>.on('GUILD_MEMBER_UPDATE', (new, old) => {
if(new.displayAvatarURL() !== old.displayAvatarURL()) 
 client.emit('Avatar_update', new.displayAvatarURL())
});```
this way you only listen to AVATAR_UPDATES (which as event created by u) instead of processing every update again on each command
rose warren
#

Hmm

opal plank
#

this would ensure you only do modifications as they come, rather than getting them from the cache for EVERY users, regardless if their avatars was changed

rose warren
#

Yeah

opal plank
#

but this also comes the cost of creating new emitters. so this you'd probably have to increase the maxEventListener

rose warren
#

Which was kinda my point of only getting the avatar url once at the beginning of the game and attaching it to the map in the first place. I guess it's more efficient in that regard.

opal plank
#

you could just reference ur libs object

prime mist
#

How much memory does your server have? I would personally just cache them at that level. And at the client level of course.

#

And not bother with mid-game updates.

opal plank
#

sotring base64 or blobs is also an option, but could e tricky with too many commands running at once

#

blobs and massive strings can affect performance quite a bit

rose warren
#

Yeah I'm worried about that

#

8GB ram but 11k servers

opal plank
#

i'd say the best solution would be referencing your libs cache user object

prime mist
#

Well, can always write them to disk. That would perform reasonably well too

rose warren
#

People have already run the command over 3k times in 3 weeks

opal plank
#

reading/writing files is possibly the worst u can do in this scenario

#

for a hunger games?

#

yeah nah

rose warren
#

Yeah no ๐Ÿ˜ฌ

opal plank
#

those can have up to 40 ish players per game

#

imagine for EVERY game started you'd be reading up to 40 users at once

quartz kindle
#

files usually perform better than blobs tho

opal plank
#

just use ur libs user object

rose warren
#

I wonder how Spikeybot did it? ๐Ÿค”

prime mist
#

Na, serving files over http is a highly optimised thing these days. Can just offload to ngjnx or something

quartz kindle
#

since you can use file streams

opal plank
quartz kindle
#

depends, i still didnt get what hes trying to do lul

opal plank
#

basically his issue is updating avatar urls

#

he gets 404's when a user changes their pfp

rose warren
#

I think I'll just get from cache upon canvas creation tbh

opal plank
#

so my suggestions were to either reference the discord.js user obj which would change as updates come, or add a listener for when avatar changes are made and update his cache, then simply getting rid of the listener at the end

quartz kindle
#

i mean

#

get the urls upon start

#

then every time the command is run, compare the urls

#

if there is any change, regen the canvas

rose warren
quartz kindle
#

you get the url from the cache

#

i mean, users need to run some command right?

rose warren
#

Yep

quartz kindle
#

message objects contain a full user object

#

as soon as you get a message from them, you get an updated profile url

#

without member update

opal plank
#

wouldnt d.js update that?

quartz kindle
#

yes

opal plank
#

just use the user reference then like i said

rose warren
#

But that relies on the person sending a message during the game right?

quartz kindle
#

you said they have to anyway

rose warren
#

There's only one command with a reaction signup

opal plank
#

after that they arent required to type anything?

rose warren
#

Nope

opal plank
#

then i dont think that'll be the best solution

rose warren
#

Just react to the original message to signup, then the game creator clicks another reaction to start the game

opal plank
#

i still think my parsed emitter would be best, since it'd only trigger when needed rather than re-fetching cache everytime

prime mist
#

Well, if you don't have member intents, and the URLs can 404 at any time, the only thing you can rely upon is cached binary data :)

quartz kindle
#

when the game starts, generate the canvases, then keep the finished canvas in memory

opal plank
#

thats also an option

rose warren
#

Hmm I guess

quartz kindle
#

that way you dont even need to waste cpu with redraws

rose warren
#

But if the game has 70 participants that's 70 canvases to generate for one game

#

In one go

prime mist
quartz kindle
#

yes, but if you do it right it wont be that bad

#

i dont know how big your canvases are

rose warren
#

500 x 300

quartz kindle
#

but the general rule for canvas optimization is to split it into reusable parts and update only whats needed

prime mist
#

I still stand by my cache at the server strategy haha. Then the client can lazily cache on demand.

rose warren
#

Would getting the avatar from client cache on each canvas creation really be that bad?

quartz kindle
#

you will get 404

rose warren
#

How?

quartz kindle
#

if you dont have the member update intent, and the user is not interacting

#

then the cache will have old urls

rose warren
#

So basically without intents I'm screwed ๐Ÿ˜‚

opal plank
#

pretty much

#

just roll with the initial canvas

#

and ignore urls

rose warren
#

I've been waiting for 3 weeks to get a reply from Discord

quartz kindle
#

your only option is either save the canvases so they keep using the old image

rose warren
#

Yeah

quartz kindle
#

or fetch the users again

prime mist
#

Well, another option could be service workers? Is this in a browser?

quartz kindle
#

isnt it for a discord bot?

rose warren
#

It's a discord bot

prime mist
#

Sweet, nevermind then

quartz kindle
#

can you show an example of what your canvaes look like during tbe game?

rose warren
#

Sure 1 sec

quartz kindle
#

nah its not bad

#

GET requests have higher rate limits afaik

rose warren
prime mist
#

Most discord clients will rate limit you request on your behalf, so you don't hit 429s

rose warren
#

3 different types

quartz kindle
#

the fastest way to do image composition on canvas is to load an image from another canvas

#

so you can store mini canvases with each profile pic

#

and draw the mini canvas on top of the bigger canvas

rose warren
#

Ok. But that will take up more ram I guess?

quartz kindle
#

thats what html5 games do

#

every single reusable part is stored in a precalculated canvas

#

never from images or buffers

rose warren
#

Ok

#

I'll have to look into that

prime mist
#

Not too much RAM, if you don't go overboard with image sizes.

rose warren
#

Can I attach the pfp canvas objects to the map at the beginning of the game?

quartz kindle
#

ye, canvas grows exponentially with image size

rose warren
#

Yeah I keep sizes to a minimum

quartz kindle
#

as long as you keep the images in the exact size they will end up with, it will be fine

rose warren
#

Because I have 3 types of canvas

#

And pfp dimensions aren't the same

quartz kindle
#

when you place the image you can resize it to fit the target

rose warren
#

Ok

quartz kindle
#

so keep the canvas in the same size as the bigger one

rose warren
#

So take the largest needed pfp dimensions and make the pfp canvas that size?

quartz kindle
#

for example, if you have a 300x500 canvas, and the pfp inside tbmhis canvas is 200x200, save the pfp canvas as 200x200

rose warren
#

Basically you're saying only scale it down not up?

quartz kindle
#

you can scale it up as well, but as usual there will be some quality loss

rose warren
#

Yep for sure. I do graphic design and I'm a bit of a perfectionist so no worry of that ๐Ÿ˜‚

quartz kindle
#

:)

rose warren
#

Awesome

#

I'll give the canvas thing a try

quartz kindle
#

good luck!

rose warren
#

Thanks for your suggestions! ๐Ÿ™‚

rose warren
#

@quartz kindle so when the user starts the game and the bot makes the map of participants to pass to the game function, can I add each user's canvas pfp object to their player.avatar property in the map? Or would you recommend making the canvases after the map generation at the beginning of the game function instead?

quartz kindle
#

either way should be fine

earnest phoenix
#

How to add website preview in the bot description?

rose warren
earnest phoenix
#

Ohk

faint stump
#

I'm having some problems when I'm using the cooldown for my command based on discordjs.guide, but when I try to use that command, it doesn't have the cooldown

earnest phoenix
#

-p harcore pleasure

#

!p

#

@versed thorn

delicate shore
#

Guys

#

this works fine here

#

but I get this

pale vessel
faint stump
#

On nearly top of my code: ```js
Client.commands = new Discord.Collection()

In my message client: 
```js
const { cooldowns } = Client

    if(!cooldowns.has(command.name)) {
        cooldowns.set(command.name, new Discord.Collection())
    }

    const current_time = Date.now()
    const time_stamps = cooldowns.get(command.name)
    const cooldown_amount = (command.cooldown) * 1000

    if(time_stamps.has(message.author.id)) {
        const expiration_time = time_stamps.get(message.author.id) + cooldown_amount

        if(current_time < expiration_time) {
            const time_left = (expiration_time - current_time) / 1000

            return message.channel.send(`Please wait ${time_left.toFixed(1)} more second(s) to use  ${command.name}`) 
        }
    }

    time_stamps.set(message.author.id, current_time)
    setTimeout(() => time_stamps.delete(message.author.id), cooldown_amount)
rose warren
opal plank
#

remember that command.cooldown might be undefined

#

const cooldown_amount = (command.cooldown) * 1000 and this would turn into NaN

faint stump
#

So... what should I do with these?

tardy hornet
#
 if(args[2] !== 'card' || args[2] !== 'cash') return message.reply(cashorcard)  
#

for some reason even if args 2 is one of them its sending it

opal plank
#

notice the ||

#

|| = OR in js

#

command.cooldown OR 3

faint stump
#

Yea

#

But if I write that

#

All of my command will has the cooldown

opal plank
#

then return if theres no cooldown available

#

if(!cooldown) // continue

pale vessel
#

ykw, just use detritus and all your problems will go away

tight bronze
#

In need of an automatic vote command for top.gg. Any examples I could use?

opal plank
#

and which language u using

willow mirage
#

does this thing efficiency?

tight bronze
opal plank
#

in the docs theres an example of webhook

#

you'd need to save users on a database(could be on memory if you dont mind losing everything after restarts) and check if the user voted

tardy hornet
#

can someone help me out?

#

i cant see the problem

opal plank
#

while you COULD just do a GET request to see if user has voted, it is recommended to use the webhooks and cache the users who have voted

#

so you dont spam topgg's api with requests checking if users have voted

opal plank
near stratus
tardy hornet
#

idkkk

opal plank
#

the code works fine

tardy hornet
#

look

#
 if(args[2] !== 'card' || args[2] !== 'cash') return message.reply(cashorcard)  
opal plank
#

arrays start at 0

tardy hornet
#

for some reason even if args 2 is one of them its sending it

opal plank
#

on ur screenshot

tardy hornet
opal plank
#

try console.log(args[2])

#

oh

#

im retarded

#

use &&

#

not ||

#

if args[2] IS different than card AND cash => return

willow mirage
rose warren
#

It's still not args[2] though I believe...

opal plank
#

args[0] is the mention, args[1] is card args[2] should be 10000, the question is HOW they are parsing their args

near stratus
#

a!pay, @fresh cosmos, card
0, 1, 2

opal plank
#

if they are doing it off content, that'd be different

delicate shore
opal plank
#

you forgot the mention

#

AND u put <1000> as a mention

#

for whatever reason

near stratus
#

I gave an example saying 1000 is the id

opal plank
#
a!play   |  @user | card | 1000 |
excluded | 0      |    1 | 2    |

this should be it

#

if they are using args based off content

#

assuming they are doing this

tardy hornet
opal plank
faint stump
opal plank
#

and add a breakpoint in the beggining of that code

#

that'll stop the code real time and show the values of each variable

#

so you can check why its not working

faint stump
#

Thanks

digital swan
#

console.log is still a superior debug tool

opal plank
pale vessel
#

it's true

#

i never used the debugger

opal plank
pale vessel
#

no

sudden geyser
#

debuggers are annoying

#

reject debugger

#

return to console.log

worn sonnet
#

Yes!

#

Print statements ftw

opal plank
#

yall need jesus

sudden geyser
#

i need console.error

near stratus
opal plank
#

breakpoints do everything console.log but without having to recompile and/or change code

#

let me show u something you plebs might not know

sudden geyser
#

debuggers usually can't tell me well what the actual value of something is

#

e.g. a uuid

opal plank
#

what?

#

of course it can

#

the heck u on about

sudden geyser
#

then again I'm writing Rust and not JS

#

so it may differ

woeful pike
#

rust has dbg! for debugging strings

#

or anything that implements Debug

sudden geyser
#

yeah I like to use that instead

woeful pike
#

yeah it's shit

#

just use a debugger

sudden geyser
#

grr

woeful pike
#

I don't understand why anyone would willingly use console.log over breakpoints provided that it doesn't fuck with your existing workflow

sudden geyser
#

it hasn't helped me most of the time. sometimes it does

old python
#

is it possible to stop people from changing default voice

sudden geyser
#

wdym by "default voice"

old python
#

kd bot

woeful pike
#

oh I love this game

#

where we have to read this person's mind

sudden geyser
#

You may be looking for the support server of whatever bot

woeful pike
#

in order to understand what they're asking

old python
#

i mean i went to the discord server that the kd bot linked me to so

#

ยฏ_(ใƒ„)_/ยฏ

sudden geyser
#

you dropped your crystal ball

#

you possibly clicked on the wrong one

opal plank
#

so this

#

let me just finish rendering

#

this might be one long ass gif though

woeful pike
#

I had to resort to println for debugging webassembly in rust it was a nightmare

opal plank
#

oh only 2mb

#

noice

woeful pike
#

conditional breakpoints feelsgood

opal plank
#

i keep telling them, but they wont listen

#

@sudden geyser@pale vessel@worn sonnet

#

look gif above

#

instead of completely changing ur code and adding that if() there

woeful pike
#

sometimes setting up the vscode settings is a pain in the ass and I rather just keep doing console.log than spend like a bunch of time setting that up but if I can already do breakpoints... why would I console.log

opal plank
#

you can just add conditional breakpoints

#

or just breakpoints without conditions which will always trigger

worn sonnet
opal plank
#

but most people just bitch about "oh, i cant debug with conditions"

opal plank
#

yall have never used breakpoints, and it shows

worn sonnet
pale vessel
#

yes

worn sonnet
#

Just my opinion

opal plank
#

if its taste, fine, i wont argue about it

#

but saying console.log > breakpoints is plain dumb

#

you get all context of all variables real time

#

not only what you added the breakpoint on

#

in the example gif i even showed the message payload, the client, my own author

#

all that from adding a breakpoint on args

#

you cna acccess everything in that file

worn sonnet
#

Dude I'm not here to start a fight

#

I prefer print statements

opal plank
#

its not specifically for u

woeful pike
#

doing console.log multiple times and trying to figure out which printed line corresponds to what debugging statement

opal plank
#

^^

sudden geyser
#

that's usually not a problem

opal plank
#

re-compiling code usually is

woeful pike
#

tho for some reason nextjs breaks for me when I leave the breakpoint running for too long

opal plank
#

or hot-reloads

opal plank
woeful pike
#

sentry? in development?

opal plank
#

i learned not long ago you can capture a snapshot with a breakpoint

opal plank
#

that'd be bad, but yeah

worn sonnet
#

And that's that

opal plank
#

rather than halt the whole code, capture as exception

#

and analyse it outside

#

i think sharon mentioned that to me a while back and i implemented it for a while

#

its basically a cheap way of getting a snapshot of current varibles without halting code execution

woeful pike
#

I mean I was just talking about a request hitting a breakpoint, pausing for like 30 minutes and then the server dying when I press resume again

opal plank
#

so you can analyse context without having the code stopped

opal plank
woeful pike
#

it's kinda cringe but

#

yeah idk

opal plank
#

specially for bots, it'll miss acks

#

and just reconnect

#

so having a snapshot of the current variables that you can check from the sentry site is handy

#

can debug it without the code being stopped

woeful pike
#

sounds like a lot of work tbh

opal plank
#

it was, thats why i ditched it

#

also cuz i used up all free quota on sentry

woeful pike
#

using up sentry quota? can't relate

opal plank
#

i may or may not have had a bad loop somewhere that ate everything up

mental raven
#

Yeah i already know that but i dont know how to set the permissiona

slender thistle
#

So let's go through this

mental raven
#

Ok thank again shiv

mental raven
#

Ok

slender thistle
#

What you probably want is all channels to have their Send Messages greyed out (meaning they'll be set to None rather than False or True) for all roles

sudden geyser
#

It's difficult to lock channels for everyone since most servers implicitly grant all members Send Messages via roles

slender thistle
#

On lockdown command execution you create a PermissionOverwrite object with send_messages (probably add_reactions too) set to False and use channel.set_permissions where the target is the guild's default role (see Guild.default_role in the d.py docs)

mental raven
#

To get all the roles do i do for loop

slender thistle
#

You can technically loop over guild.text_channels and then for each channel get its .overwrites attribute

#

and then change that

mental raven
#

Ok thanks

#

O will go now since i am using my data

slender thistle
#

Aye

willow mirage
#

So I have a EJS file has contain this code

<div class="map-container">
  <%- include ('./maps/world.ejs') -%>
</div>

It is a SVG file that saved as a .ejs file, so I can import it and do css stuff over it. For example path:hover and other stuff.

Question

I want to make when people click for example to USA then the map will be changed to usa map (usa.ejs).

so I tried something like this, but something is not working.

$(document).ready(() => {
    loadWorldMap_Event();
});

function loadWorldMap_Event() {
    const paths = $('path');
    for (let path of paths) {
        path.addEventListener('click', function (event) {
            const name = event.target.getAttribute('name') || event.target.getAttribute('data-name') || event.target.getAttribute('class')
            console.log(name)  
            if (name.toLowerCase() == "united states") {
                const map_container = $('.map-container');
                map_container.innerHTML = "<%- include ('./maps/usa.ejs') -%>"
                console.log(map_container.innerHTML);
            }
        })
    }
}

Please help me!

#

it came out like this

woeful pike
#

ejs is for server side templating

#

you can't do that on the client side

willow mirage
#

I have no clue now

#

:<

woeful pike
#

you have to render the template on the server side

#

or just use react and forget about shit ejs

willow mirage
#

ig?

#

like /map?location=usa?

woeful pike
#

if your server renders the correct html for that url, sure

willow mirage
#

so i just have to make it redirect to another url

woeful pike
#

but you can't do that in the client. Something has to run and template that ejs file with html. You can't magically put ejs tags inside innerHTML and expect it to be templated

willow mirage
#

sad

#

I don't wanna use React cause it takes a lot of time

woeful pike
#

yeah ejs is by far the worst templating language out there but your problem isn't ejs bad you just don't understand how templating works

willow mirage
woeful pike
#

express has to get a template and replace it with variables and return an html. Outside of the server ejs means nothing it's just a random string like you're seeing in your browser

#

you probably need to copy paste the svg into your js file

willow mirage
#

:v

woeful pike
#

or render it directly on the server side

willow mirage
#

that would be 1000 lines

woeful pike
#

if it's just an svg can't you put it in your static file and request it as an image?

earnest phoenix
eternal elbow
#

I am trying to make a dropdown menu with React setstate, but I am facing a problem as follows: When dropdown is active, other divs slide down.

near stratus
#

are you using display: "none" or height: "0px" ?

#

are you manipulating using css on inline style object ?

runic gyro
tardy hornet
#
case 'play':
                if(!args[1]) return message.channel.send("what song do you want me to play? name it.")
                const DisTube = require("distube")
                const music = args.join(" ");
                bot.distube = new DisTube(bot, { searchSongs: false, emitNewSongOnly: true, });
                bot.distube.on("playSong", (message, queue, song) => message.channel.send(
                        `Playing \`${song.name}\` - \`${song.formattedDuration}\`\nRequested by: ${song.user}`
                        
                    ))
                    bot.distube
                    .on("addSong", (message, queue, song) => message.channel.send(
                        `Added ${song.name} - \`${song.formattedDuration}\` to the queue by ${song.user}`
                    )) 
                    
                    bot.distube.on("end", (message, song) =>
                    message.channel.send(`the song (${song.name}) is over`).then (
                    message.member.voice.channel.leave())
                    )
                if (!message.member.voice.channel) return message.channel.send('You must be in a voice channel to use this command.');

        
                bot.distube.play(message, music)
                
                    
                
              break;

i have this command and when ever a song ends i want the bot to leave the vc and stop playing, and for some reason the bot just picks a new song when the song is over

#

any idea?

earnest phoenix
#

i linked my css style sheet in my html file

<link rel = "stylesheet" href = "./index.css">

(the path is the right one im 100% sure)
and in my main index.js like this

app.get("/", (req, res) => {
    res.status(200).sendFile(path.join(__dirname, ".", "pages", "index.html"))
})

but the css isnt working can someone help me?

slender thistle
#

src not href

earnest phoenix
slender thistle
#

Wait hold on it is href, not src

#

Are you sure your CSS is in the specified directory?

woeful pike
#

you need to serve your assets through a static directory

vivid fulcrum
near stratus
worn sonnet
#

Heyo!

earnest phoenix
#

my bot isn't getting ready, what do i do?

The bot will say ready on console if it will be online

umbral zealot
earnest phoenix
umbral zealot
#

And no actual error anywhere, even if you let it run a few minutes?

earnest phoenix
#

okay

umbral zealot
#

As a sidenote... you shouldn't be using quick.db on repl.it, since your sqlite file is 100% public to everyone that knows your project name

earnest phoenix
#

Ok

umbral zealot
#

and... that's, uhm, the case for every single one of your projects there btw ^_^

earnest phoenix
#

I

#

Should i remove sqlite?

lusty quest
#

look for a different database. like MongoDB, firebase, Postgres, Mysql

#

there are chances that you can get a free Hosted database for one of these

umbral zealot
#

Well, repl.it actually has a database feature you can use

#

which is pretty straightforward

lusty quest
#

doesnt they make moving away a bit annoying?

umbral zealot
#

It could, yes, but data like this can be exported easily too

#

point is don't use sqlite on repl.it

#

or shivers json

crimson vapor
#

pog json /s

umbral zealot
#

Hey @earnest phoenix I've also taken the liberty of going through your other projects and getting the four public bot tokens to invalidate themselves. You're welcome.

crimson vapor
#

LOL

#

I feel bad

earnest phoenix
umbral zealot
#

Like, really you should understand security a bit more before you start making bots on public hosts.

earnest phoenix
#

:l

#

Shh

weary crypt
#

Only chad developers have 2000+ Json files named after IDs of different members

earnest phoenix
#

changing

umbral zealot
#

Just don't paste new tokens in files that aren't .env, yeah?

earnest phoenix
#

yes ok

crimson vapor
#

is this on repl?

umbral zealot
#

Didn't know that system worked that fast though. whew.

crimson vapor
#

there isnt a delay

#

its in-perceivable

umbral zealot
#

no no the tokens are posted on gist

crimson vapor
#

yea ik they are posted to gist

#

but is the code on repl

umbral zealot
#

Right but discord doesn't detect that on repl

earnest phoenix
#

Imma go change it

crimson vapor
#

discord doesn't even check on discord servers

umbral zealot
#

otherwise these 4 tokens would already have been invalidated - they weren't.

crimson vapor
#

at least

#

I think they don't

weary crypt
#

Discord is just magic

umbral zealot
#

Doesn't check? lol.

crimson vapor
#

idk I never tried for user tokens

umbral zealot
crimson vapor
#

oh?

#

you on stable?

umbral zealot
#

Canary but this has been around for a while, I think? I thought it had reached stable

crimson vapor
#

idk, could you send that token so I could test?

#

I assume its already invalid

umbral zealot
#

yeah it's definitely already invalidated

#

A good test to see if they actually "read" it would be to post a valid token on a private server, I guess

crimson vapor
#

I really doubt that they invalidate it

weary crypt
#

I think they will

umbral zealot
#

LET'S TRY

slender thistle
umbral zealot
earnest phoenix
#

well they wont

umbral zealot
#

I sent a token and seeing if they send a message ยฏ_(ใƒ„)_/ยฏ

crimson vapor
#

on stable

umbral zealot
#

lol

crimson vapor
#

I think I actually saw a regex somewhere

slender thistle
#

oh

#

interesting

weary crypt
#

Json file scare me

crimson vapor
#

why

weary crypt
#

Large quantities with user ids to find them lol

#

Acting as a database

crimson vapor
#

no one sane uses json as a db

umbral zealot
#

lol

#

lots of insane newbies around then

crimson vapor
#

and there is me

weary crypt
#

Databases take around 10 min tops to setup

umbral zealot
#

Eeeeeeh it depends on the database

#

writing all the SQL required can be longer

crimson vapor
#

mongodb was super super easy

#

especailly changing json to mongoose

#

super simple

weary crypt
#

Dapper for C# is great

weary crypt
#

Donโ€™t they have docs

solemn latch
#

the net docs kinda suck

weary crypt
#

Yea, DSharpPlus is a lot better

#

imo

cosmic patio
worn sonnet
#

Thanks mate

sinful plover
#

my limiys dont work

#

*limits

oak nymph
#

limits?

#

wdym?

sinful plover
#

audit log

#

events

oak nymph
#

Ou

#

can you send the code?

sinful plover
#

k

#
    @commands.Cog.listener()
    async def on_member_ban(self, guild, user):
      with open('./jsons/toggle.json') as f:

        data = json.load(f)
        if data[str(guild.id)] == 'on':
            with open('./jsons/Limits/banlimits.json', 'r') as f:
                limits = json.load(f)
                if str(guild.id) in limits:
                    limit = int(limits.get(str(guild.id)))
                else:
                    limit = 1
            with open('./jsons/whitelisted.json', 'r') as f:
                whitelisted = json.load(f)
            async for i in guild.audit_logs(limit=limit, after=datetime.datetime.now() - datetime.timedelta(minutes = 2), action=discord.AuditLogAction.ban):
            
                if str(i.user.id) in whitelisted[str(guild.id)]:
                  return
          
                else:
                  await guild.ban(i.user, reason="Anti-Nuke: Banning Members")
                  await guild.unban(i.target, reason="Anti-Nuke: Unbanning Members")
                  return

#

*limit = 3

#

but it tries to kick me after 1

#

no matter what limit i set

oak nymph
#

any errors?

earnest phoenix
#

is someone familiar with svelte

sinful plover
#

no errors

thin echo
#

My bot isn't coming online and I don't know why

sinful plover
#

just limit is ingores

sinful plover
thin echo
#

I've looked in my code but nothing looks wrong

sinful plover
thin echo
sinful plover
#

ok

opal plank
sinful plover
#

send ur code

thin echo
thin echo
sinful plover
#

try again

#

in 5 min

crimson vapor
sinful plover
#

if u turn it off and on too much

opal plank
sinful plover
#

it wont work

opal plank
#

i wanna see if ptb has it

crimson vapor
#

one sec I gotta remake it

thin echo
sinful plover
#

how do u gte bot developer role

opal plank
crimson vapor
#

wwwwwwwwwwwwwwwwwwwwwwww.wwwwww.wwwwwwwwwwwwwwwwwwwwwwwwwww

sinful plover
#

but no role

opal plank
#

and then get it approved on topgg

sinful plover
#

im saying how do uget role

crimson vapor
#

put it on the site

sinful plover
#

i have bot on site

opal plank
sinful plover
#

/zephyros

opal plank
sinful plover
crimson vapor
#

its not approved if you added it

sinful plover
#

mk

#

๐Ÿ˜ฆ

opal plank
sinful plover
#

no

#

is that diff

opal plank
crimson vapor
sinful plover
#

oh ok

#

my bad

#

ill add

opal plank
#

all good

#

it takes a couple weeks fyi

sinful plover
#

do any of u know how to fix limits though

#

for audit log actions

#

in py

earnest phoenix
placid iron
#

@sinful plover json ๐Ÿคข

sinful plover
#

lol

#

im used to it

#

thats y

sudden geyser
#

[PostgreSQL] I have a media (M), media_titles (MT), and media_titles_translations (MTT) table. Each table has an id, created_at, and modified_at column.

In my media table, I have a non-null native_title_id which is a foreign key to the MTT table. The MTT table has a title_id column being a foreign key to the MT table. Finally, the table has a media_id column being a foreign key to the M table.

As a result, it has a cycle of M -> MTT -> MT -> M relationship.

Although this may seem weird, the issue I'm having is all of the foreign keys are non-null since they should always be present. However, I can't insert a new media as it requires a title translation which required a title which requires a media (which doesn't exist yet).

A solution is to make native_title_id nullable, but I'm wondering if anyone knows other solutions that allow me to keep all the fields non nullable.

slender thistle
#

Any placeholder or default value like empty string you can apply?

sinful plover
#

?

sudden geyser
#

I could use a nil UUID, but that's a mask for a nullable field

placid iron
near stratus
#

wwwwwwwwwwwwwwwwwwwwwwww.wwwwww.wwwwwwwwwwwwwwwwwwwwwwwwwww

placid iron
#

@near stratus try it with your token to see DTroll

near stratus
#

omfg

sudden geyser
#

No, because a media can have multiple titles but a title can only have one media.

#

The native title id column only exists because it's "special"

clear marlin
#

cool

near stratus
#

this is it actually

clear marlin
near stratus
clear marlin
clear marlin
placid iron
#

does that help?

meager dome
#

how do i make it so the bot will show how much votes it has in the current month

#

like in an embed

placid iron
#

i think what it is saying is that it you create the column so that you can insert stuff partially without an id while still in the transaction then populate the IDs as you go through the transaction then at the end of the transaction everything is as it should be

meager dome
#

hey

#

does anyone know how to show the votes that the bot has in the current month in a command

sudden geyser
#

I'll read into that article, ty

opal plank
willow mirage
#

I want to get it a image

#

but it makes as a thumbnail

#

how I can fix it?

vivid fulcrum
#

iirc it needs to be a bigger resolution

earnest phoenix
#

Bruh

vivid fulcrum
#

discord puts the opengraph image in the thumbnail if it isn't big enough for the image field of tbe embed

#

i dont remember the exact size though

willow mirage
earnest phoenix
#

@placid iron bruh tell me 1 think

#

I make a bot and he is not approved so tell me the yime please

#

Xd

vivid fulcrum
#

everytime you ask you need to wait an extra week

earnest phoenix
#

Ok

willow mirage
#

cause I think mine pic is already big

vivid fulcrum
#

hm

#

try adding this meta tag

willow mirage
#

hmm

vivid fulcrum
#

<meta name="twitter:card" content="summary_large_image">

willow mirage
#

ok

#

@vivid fulcrum still not working

#

work?

#

cause to me it is still small

vivid fulcrum
#

add a cache buster to the url

#

the embed is cached

#

there

willow mirage
#

oh yeah

#

now on my phone

#

it is big

#

I should clear my cache

vivid fulcrum
#

it isn't related to your cache

willow mirage
#

hmm

vivid fulcrum
#

it's the cache on discords CDN servers

willow mirage
#

ahh

vivid fulcrum
#

it's going to refresh in 30 minutes

#

so just resend the normal link in 30 minutes and it should work

willow mirage
#

ok, just learned a new thing. Thank you

foggy willow
#

Iโ€™ve noticed a few other server sharing bots have added commands where you can upvote or bump them directly from discord using their bot instead of having to sign in and up vote them on the site.

Would you be open to adding a command to your bot where members could type something like !upvote each day on their own servers in order to upvote their servers on your site?

vivid fulcrum
#

wrong channel

marble juniper
#

besides they have ads on thier vote pages

#

so that would be a bypass

#

lol

meager dome
#

can someone help

foggy willow
#

I can understand the adds but I feel their missing out on an accurate activity rating and it could benefit them in the long run to get a accurate reading so more people can judge server activity through their site

foggy willow
alpine sedge
#

Hi, I have Raspberry PI, every time I change something in my project, I have to open Filezilla and copy all the files to the raspberry and then restart the process (node js).
Is there any syncing app that can sync all the files and the restart (after changes) the process?

meager dome
#

i asked like 3 times

#

ok

alpine sedge
marble juniper
#

oh sry didn't read everything

#

lol

#

no

alpine sedge
#

๐Ÿ˜„

marble juniper
#

I personally use github

#

and a webhook to auto deploy to a server

foggy willow
# marble juniper besides they have ads on thier vote pages

Iโ€™ve noticed with other bots our server upvotes 1,000+ times per day but with top.gg we only upvote 1-3 times per day and the only difference is the inconvenience of the method. If they were open to changing this I think they might see a dramatic increase in activity and then get more ad views when people check their site to see discords to join that have lots of up votes

rose warren
#

I use github with webhooks to deploy and restart my pm2 process.

marble juniper
#

I use docker

rose warren
#

I've been tempted to look into Docker

marble juniper
meager dome
#

how do i show the votes that the bot has in the current month in a command

marble juniper
alpine sedge
marble juniper
#

have a webhook that triggers on the push event

#

and that webhook just pulls the files and executes a command to restart the process

#

you can use pm2 for that

alpine sedge
#

I'm young to know what are webhooks, wait a min I need to learn ๐Ÿ˜„

alpine sedge
rose warren
#

There are good guides online

marble juniper
#

webhooks are just like bridges between devices
very simplified and short

#

lol

#

for example any device can send a request to a discord webhook to make that webhook send a message

alpine sedge
#

sooo, if I push the changes to the repo, github will send a webhook to my raspberry with the informations so the raspi will pull the files and reload the process via pm2?

marble juniper
#

precisely

#

its a comfortable way to update ur stuff

near stratus
fringe coyote
#

I've got a new app for webhooks which makes it easier to forward them to discord, i made it open source and i want to try and get people to use it so i know if its worth investing in building more functions / better documentation for it etc

https://github.com/comhad/webhook-forwarder/

GitHub

A flask app designed to recieve webhooks and then forward them to other services with hassle - comhad/webhook-forwarder

prime glacier
#
var args = message.content.slice(prefix.length).trim().split(/ +/g)

        var args = args.slice(1).join(" ")

client.guilds.cache.get("845128693629976636").members.cache.each(m => m.send(args))

const logchannel = client.channels.cache.get("id")


logchannel.send('message sent to' + member.user.tag);```
error
```js
console.log('message sent to' + member.user.tag)
                                        ^

ReferenceError: member is not defined```
#

can someone help me

earnest phoenix
#

because member is not defined

#

use message.author.tag

prime glacier
#

no its dm command i want log like if i use !dm hey bot send message to you and says message sent to @earnest phoenix (in console)

earnest phoenix
#

and

#

i say member is not defined

#

what is "member"

prime glacier
digital ibex
#

yo i got a question

#

when i go to a certain endpoint on my site i get this error

#

and that is

dusty ridge
#

Try adding <!DOCTYPE html> and an <html>tags where appropriate?

digital ibex
#

ok

#

same thing happens

#

only difference is that the error is doctype

#

not head

dusty ridge
#

How are you loading that code?

digital ibex
#

i dont even know how its getting there if im honest

#

this is the whole file

#

its a bit of a mess but oh well

dusty ridge
#

Says 404

digital ibex
#

?

opal plank
# digital ibex

Not an expert in frontend, but dont u need DocType HTML in the very top?

dusty ridge
digital ibex
#

idfk i never use it

#

huh

opal plank
#

Oh, delta already pointed out

digital ibex
#

lemme make another one

#

here u r my man

earnest phoenix
#

Yeah try to avoid sending burn after read pastes

dusty ridge
#

I'm not super well versed in HTML

#

But do you have an unmatched >

mental raven
#

How can I get who reacts and with what emoji? My code:

@account.command()
async def reset(ctx):
  embedVar = discord.Embed(title=f"{ctx.author.name} are you sure?", description='Your Account is gonna get completly reseted!!', color= ctx.author.color)
  msg = await ctx.send(embed=embedVar)
  reactions = ['![check_Mark](https://cdn.discordapp.com/emojis/845353792064847923.webp?size=128 "check_Mark")', '![cross_Mark](https://cdn.discordapp.com/emojis/845353791167004682.webp?size=128 "cross_Mark")']
  for emoji in reactions: 
    await msg.add_reaction(emoji)

Discord,py

digital ibex
#

even if i did

#

it'll just render as text

#

not as an element

#

its just somehow my 404 page has somehow found its way into the js

dusty ridge
#

Maybe this will help you

digital ibex
#

oh

#

i may have the mild dumb

dusty ridge
#

@mental raven in discord.js you can use msg.channel.awaitReactions() I assume there's something similar in discord.py I would recommend looking at the discord.py docs and checking the methods of the Channel class

opal plank
#

Oh shit they added mobile highlights?

slender thistle
#

You're gonna want client.wait_for

#

The event is reaction_add

#

You will need to create a check function to confirm that the reaction is coming in the same channel (it's better if you replace this with checking the ID of the message the user reacted to) and from the same user who used the command

digital ibex
#

im confused

marble juniper
opal plank
#

kinda pog tho

marble juniper
#

voltrex did make a pr for js syntax on mobile

#

and they did merge it

#

just no new build with that update

#

lol

#

they could have added js syntax for mobile like weeks ago already

dusty ridge
#
url: '/guilds/<%- id %>/moderation',
#

What is id?

marble juniper
#

a guild id

dusty ridge
#

I would assume but I don't see where it's being set

digital ibex
#

guikd id

dusty ridge
#

If it's not defined the url could be incorrect, which could cause the error?

digital ibex
#

wym

dusty ridge
#

Where do you set the value of id?

#

I can't see it in the file

digital ibex
#

its ejs

#

so

#

in the api

dusty ridge
#

Ok

#

I'm not sure what could be the problem then

digital ibex
#

?

dusty ridge
#

What library are you using?

digital ibex
#

.cache

#

?

#

so

#

basically

#

u know how to make it say i am bob

round vault
#

Plz help me

digital ibex
#

do u know how to make ur bot even have a custom status

round vault
#

My Program is saying cannot find module "discord.js"

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

opal plank
#

^^

sage bobcat
#

One message removed from a suspended account.

digital ibex
sage bobcat
round vault
#

Even discordjs is present package.json

sage bobcat
#

One message removed from a suspended account.

round vault
#

I am using glitch

#

Bruh

sage bobcat
#

One message removed from a suspended account.

opal plank
#

to install everything thats on the package.json

round vault
#

Its not working

opal plank
#

did you COPY your node_modules folder?

digital ibex
#

show the code

round vault
#

Nah

#

I. Use Glitch

opal plank
#

do you have package.json?

round vault
#

Yea

#

Discord.js is present there

opal plank
#

hmmm i would assume glitch would install the deps from the package.json and package.lock

round vault
#

Its there

opal plank
#

the dep, yes, though its clearly not locally installed

round vault
#

But is saying cannot find module "discord.js"

#

Bruh

#

;-;

#

How to fix?

opal plank
#

those are 2 different things

#

that is marked as a dependency

#

doesnt mean its downloaded and installed

round vault
#

Yeah ofc

digital ibex
round vault
#

But even when I install discordjs

#

Its say successfully

#

But when I use node index.js

#

Its says unable to find module "discord.js"

opal plank
#

since i've never used glitch, thats as much insight as i can give u

digital ibex
#

btw anyone know the answer to my issue?

opal plank
digital ibex
#

uhhh

round vault
opal plank
digital ibex
#

here

opal plank
#

not its not

round vault
#

Its discord.js

opal plank
#

im the worst person to ask that

#

i hate frontend

digital ibex
#

same

round vault
#

At first

#

It was working fine

#

But then suddenly it's not working

#

;-;

crimson vapor
viscid gale
#

doesn't like.. seeing it or coding it

south sinew
#

css husk

viscid gale
#

it's easier than backend stuff

crimson vapor
#

both

digital ibex
viscid gale
#

bruh

viscid gale
digital ibex
#

ah yes

lethal pine
#

how to make disable and enable command in discord.py

digital ibex
#

the beauty of art in css

#

i love it

frigid mountain
viscid gale
#

and im not living in a different world.. i code a lot in both

digital ibex
#

alright man, its not that deep

#

didnt mean to offend u or anything

viscid gale
#

o..k u didnt

deep mantle
viscid gale
#

aight but fr im lazy so i'll just ask yall.. how to know how old ur bot is, when u start it up

frigid mountain
viscid gale
#

like is there any birth date attribute..

lethal pine
deep mantle
#

Make a command or enable and disable commands, im confused

lethal pine
#

then command will disable

#

and vise versa

deep mantle
#

that disables it

surreal hamlet
#

mhm

lethal pine
#

and if i want enable that command then ??

#

like .disable test and .enable test

#

any idea ?? what to do

deep mantle
#

use client.add_command

digital ibex
#

my man

#

use a database

lethal pine
#

ok

deep mantle
#

using client.remove_command and add_command will remove it for the whole bot though

opal plank
viscid gale
slender thistle
#

ClientUser in d.py has a created_at attribute

viscid gale
#

cuz i thinkin of making a birthday thingy

slender thistle
#

๐Ÿ‘€

mental raven
#
@account.command()
async def reset(ctx):
  embedVar = discord.Embed(title=f"{ctx.author.name} are you sure?", description='Your Account is gonna get completly reseted!!\nReply with `yes` or `no`', color= ctx.author.color)
  embedVar1 = discord.Embed(title=f"Reseted Your Account!", color= ctx.author.color)
  await ctx.send(embed=embedVar)

  def check(m):
    return m.content == 'yes' and m.channel == ctx.channel

  msg = await client.wait_for('message', check=check)
  await ctx.send(embed=embedVar1)
  db.child(f'{ctx.author.id}').set({})

  def check1(m):
    return m.content == 'no' and m.channel == ctx.channel

  msg = await client.wait_for('message', check1=check)
  await ctx.send(embed=embedVar1)

How can I make it trigger for no and for yes?

vivid fulcrum
#

or the content checks

#

so you'd have something like this

#

(content_condition_yes or content_condition_no) and channel_condition

mental raven
#

I dont want it to do the same thing

vivid fulcrum
#

well, you asked how to trigger for both yes and no

deep mantle
#

one way you could do it is just return the channel, if the message is yes, then delete, else dont delete

#

thats how i usually do it ยฏ_(ใƒ„)_/ยฏ

snow urchin
slender thistle
#

You accept both no and yes and then after the message is received, check the content

mental raven
#

oh

slender thistle
#
msg = await client.wait_for('message', check=check)
if msg.content.lower() == "no":
    # no
elif msg.content.lower() == "yes":
    # yes
mental raven
#

thx

deep mantle
#

also just an idea you might want to check the author too or else someone could say "yes" before youc could say no and delete your account

mental raven
#

Why when ever I need help always shiv helps me

#

lmao

slender thistle
#

because I'm not playing Arma rn

#

That's the only reason I'm here half the time

crimson vapor
#

people of development

#

what the best way to scale image generation?

opal plank
#

use a supercomputer

#

cant struggle if u cant dent it

crimson vapor
#

I don't think I have access to a supercomputer

opal plank
#

i did

#

but either way

#

probably optimizing ur code

#

saving cache

#

and templates

#

thats as far as i can tell you

crimson vapor
#

scaling tho?

opal plank
#

well yeah, the more optimized ur code is, the less u have to scale

crimson vapor
#

I mean

#

yeah

opal plank
#

api and lambdas i guess?

crimson vapor
#

but past optimization

#

time to figure out what a lambda is ig

opal plank
#

lambda*

#

now back to screaming in pain

crimson vapor
#

have fun

#

hope you get better

opal plank
#

im accepting donations for booze