#development

1 messages · Page 1967 of 1

lyric mountain
#

Too many fckin colors

lament rock
#

Yes

lyric mountain
#

I can hear the gif crying

lament rock
#

256 is a stupid arbitrary limit

lyric mountain
#

Not arbitrary actually, 8 bits

earnest phoenix
#

oh no weeb stuff

lyric mountain
#

If only discord supported the superior apng

lament rock
#

They do

#

animated stickers are apng

lyric mountain
#

Smaller size, full argb colors, crisp quality

lyric mountain
#

😔

#

It end as a file

#

Also apng is a lot easier to encode

lament rock
#

oh. You right

#

no preview. That fucking sucks

#

There was a preview in the upload

#

I wonder if webp can be animated and if Discord supports it

boreal iron
#

So much anime stuff in development zoomeyes

lament rock
#

Welcome to Discord

#

all programmers wear pink striped thigh highs

boreal iron
#

thought this is a save place

boreal iron
#

Ok I officially don’t belong to this sort of people then

#

Thank god

earnest phoenix
lament rock
#

you guys act like its the end of the world

#

relax

boreal iron
#

It is… guys like you will soften our society even more pepowot

lament rock
#

is it so necessary to be so cut throat though

earnest phoenix
#

weebify.js KEKW

#

Would be funny if that npm lib exist

boreal iron
#

Not anime

queen needle
#

What are you using for encoding?

sudden geyser
boreal iron
#

I do

#

That’s the one thing I’m lucky except 99,9% of my day when I’m not

earnest phoenix
boreal iron
#

role model?

#

Wtf does that mean

#

We’re old, very old, yes but there’s always somebody older… cough Brain

earnest phoenix
#

A role model is someone others look to as a good example. ... Just as a model is something that represents an inspirational ideal, a role model is someone who inspires others to imitate his or her good behavior. Parents try to be role models for their children by being good people.

boreal iron
#

Yes I inspire you to use PHP

#

Be good boys, follow me!

earnest phoenix
#

no problem,already used it for some applications

lament rock
earnest phoenix
#

I have made php app where you can modify sql tables.Just the sql injection part was tricky

boreal iron
lament rock
#

It was related to encoding gifs

#

it took upwards of 5min to encode those gifs on my setup

boreal iron
#

Ah ok missed that context then

lament rock
#

no, I can't switch to something else

wheat mesa
#

If you’re doing something with image/gif manipulation, you can make the processing end in c++ and make bindings to node

#

Much faster, it’s the way esmBot does it

spark flint
#

how can i check if a user has a pfp using discord.js?

sudden geyser
#

user.avatarURL?

#

Will be null if no avatar is present.

tribal crow
#

ah, ty

warm swan
#

how do i check if a member is the bot?

spark flint
warm swan
#

i fixed already

sharp saddle
#

have a problem if i make a shardingmanager even my bot is on less servers

#

?

solemn latch
#

you can start sharding at any point realistically.

sharp saddle
#

oke

#

ty woo for the info

hidden gorge
#

I figured out how to Log my commands so when My bot has a command used it sends a message to my console saying and then sends a message using a webhook to one of my channels

sudden geyser
#

good job

#

though you may want to reset that webhook token

dry imp
#

yea lmao

sudden geyser
#

also, if your bot reaches a considerable size, it may be wise to aggregate the command usage so you can have general statistics on command usage (e.g. how many times was the roll command used)

wheat mesa
#

It also might not be a good idea to be creating and destroying a webhook client every time a command is run

#

seems inefficient

lyric mountain
#

It's probably worse if u keep it open all the time

wheat mesa
#

why's that

lyric mountain
#

Open connection

wheat mesa
#

it's probably relatively expensive to keep open but I feel like constantly opening and closing it would be worse

#

for every command

lyric mountain
#

Idk abt other langs, but at least in java some clients or managers are disposable (and should be disposed of asap)

#

Like Graphics2d or EntityManager

#

Also most streams

#

Idk abt disc webhooks tho, but leftover clients usually clog the memory because they can't be collected until disposed

wheat mesa
#

from looking at the source code it seems like nothing is actually freed, and it just stops a scanning interval

#

but I could be wrong

#
  destroy() {
    if (this.rest.sweepInterval) clearInterval(this.rest.sweepInterval);
  }
this.sweepInterval = setInterval(() => {
        this.handlers.sweep(handler => handler._inactive);
      }, client.options.restSweepInterval * 1_000).unref();
lyric mountain
#

This being used in js

#

Miracle

wheat mesa
#

could be worse!

#

seen people do ```js
client.on('messageCreate' async message => {
if(message == '!ping') {
message.channel.send('pong!');
}

client.on('messageCreate' async message => {
if(message == '!foo') {
message.channel.send('memory leak!');
}
}
}

// etc

lyric mountain
#

Saw that here enough times to not be surprised

cinder stratus
#
[2022-01-25 08:01:57.223 +0000] ERROR (Cluster #0): getaddrinfo ENOTFOUND accounts.spotify.com
service-bot3-1  |     err: {
service-bot3-1  |       "type": "Error",
service-bot3-1  |       "message": "getaddrinfo ENOTFOUND accounts.spotify.com",
service-bot3-1  |       "stack":
service-bot3-1  |           Error: getaddrinfo ENOTFOUND accounts.spotify.com
service-bot3-1  |               at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:71:26)
service-bot3-1  |       "errno": -3008,
service-bot3-1  |       "code": "ENOTFOUND",
service-bot3-1  |       "syscall": "getaddrinfo",
service-bot3-1  |       "hostname": "accounts.spotify.com"
service-bot3-1  |     }
``` ```js
 [2022-01-26 02:56:50.307 +0000] ERROR (Cluster #0): Client network socket disconnected before secure TLS connection was established
service-bot3-1  |     err: {
service-bot3-1  |       "type": "Error",
service-bot3-1  |       "message": "Client network socket disconnected before secure TLS connection was established",
service-bot3-1  |       "stack":
service-bot3-1  |           Error: Client network socket disconnected before secure TLS connection was established
service-bot3-1  |               at connResetException (node:internal/errors:691:14)
service-bot3-1  |               at TLSSocket.onConnectEnd (node:_tls_wrap:1585:19)
service-bot3-1  |               at TLSSocket.emit (node:events:402:35)
service-bot3-1  |               at endReadableNT (node:internal/streams/readable:1343:12)
service-bot3-1  |               at processTicksAndRejections (node:internal/process/task_queues:83:21)
service-bot3-1  |       "code": "ECONNRESET",
service-bot3-1  |       "host": "accounts.spotify.com",
service-bot3-1  |       "port": 443
service-bot3-1  |     }
```has someone got errors like this from spotify?
woeful pike
#

looks like a DNS error

cinder stratus
#

Ik it's dns issue but I am not sure why it's happening

#

Only spotify is broken on my vds everything else works fine like making requests to discord, youtube, patreon, etc works

#

and it doesn't happen all the times

#

for 1-2 hour it would be good

#

but after that it starts doing that

earnest phoenix
#

That way I dont really need to make a rest api for querying data

lament rock
#

Can someone help me?
Trying to figure out slash commands. The options are raw API data structures and this is what it looks like:

[
    {
        name: "play",
        type: Discord.Constants.ApplicationCommandOptionTypes.SUB_COMMAND,
        description: "Play music from multiple sources",
        options: [
            {
                name: "content",
                type: Discord.Constants.ApplicationCommandOptionTypes.STRING,
                description: "The content to play"
            },
            {
                name: "source",
                type: Discord.Constants.ApplicationCommandOptionTypes.STRING,
                description: "The source the content should be played from if searching",
                choices: [
                    {
                                name: "YouTube",
                        value: "yt"
                    },
                    {
                        name: "SoundCloud",
                        value: "sc"
                    }
                ],
                required: false
            },
            {
                name: "insert",
                type: Discord.Constants.ApplicationCommandOptionTypes.BOOLEAN,
                description: "If the song should be inserted as the next song in the queue",
                required: false
            }
        ],
        required: false
    },
    {
        name: "stop",
        type: Discord.Constants.ApplicationCommandOptionTypes.BOOLEAN,
        description: "If the queue should stop. True to reveal you initiated the stop",
        required: false
    }
]

However, this doesn't work and only shows music play as the only command under the music command instead of also showing stop.

Can someone point out why that is

earnest phoenix
#

or is stop its own command

lament rock
#

play is a sub command, but stop is not

The idea is
/music play content:despacito
or
/music stop:true

earnest phoenix
#

Mmm I see

#

I don't know then that looks to be correct from the looks of it

lament rock
#

Welp. Only /music play shows up. All of the other options do not exist

earnest phoenix
#

Mmmm

lament rock
#

Oh well. I've just changed play to a string for now

earnest phoenix
#

It could be an issue with subcommands right now?

#

I haven't played with slash commands enough to get to sub commands but that looks correct to me from what i've read on the docs

lament rock
#

same for me

#

the docs dont give sub command examples

#

and Discord.js sure as hell doesn't

#

I have to dig into source code to figure it out which is why I asked here

snow sundial
#

U have the correct intents?

rocky hearth
#

how can I use ytdl-core, get the stream, convert it to buffer, send it to discord api, to play the music file

lament rock
#

If ytdl-core passes you a stream, you have to push all of the Buffer chunks into an array and then Buffer.concat that array together which is the full Buffer you can convert to a file

#

but you should only be using ytdl-core for legal stuff like videos you own :)

rocky hearth
#

im trying to make a music bot. that plays music from youtube link

lament rock
#

I highly advise against making a music bot

#
  1. too much pain for what it's worth
  2. can become really expensive
  3. risk lawsuit
rocky hearth
#

but still, I want to. and its for my personal use

novel jetty
#

Can someone help me with this please?

rocky hearth
#

@lament rock u hv a guide using Valcano?

lament rock
#

Volcano is the same as LavaLink, so look for LavaLink guides

novel jetty
rocky hearth
#

show code

novel jetty
# rocky hearth show code
client.on('messageCreate', async (message) => {

    const data = await prefix.findOne({
        GuildID: message.guild.id
    });

    const messageArray = message.content.split(' ');
    const cmd = messageArray[0];
    const args = messageArray.slice(1);

    if (cmd.length === 0) return;
        let command = client.commands.get(cmd);
        if (!command) command = client.commands.get(client.aliases.get(cmd));

    if (data) {
        const prefix = data.Prefix;

        if (!message.content.startsWith(prefix)) return;
        const commandfile = client.commands.get(cmd.slice(prefix.length)) || client.commands.get(client.aliases.get(cmd.slice(prefix.length)));
        if (!commandfile) return;
        commandfile.run(client, message, args);
    } else if (!data) {
        const prefix = '!'

        if (!message.content.startsWith(prefix)) return;
        const commandfile = client.commands.get(cmd.slice(prefix.length)) || client.commands.get(client.aliases.get(cmd.slice(prefix.length)));
        if (!commandfile) return;
        commandfile.run(client, message, args);
    }
    await chatschema.findOne({ Guild: message.guild.id }, async (err, data) => {

        if (!data) return;
    
        if (message.channel.id !== data.Channel) return;
        message.channel.sendTyping();
    
        fetch(
          `https://api.affiliateplus.xyz/api/chatbot?message=${encodeURIComponent(
            message.content
          )}&botname=${client.user.username}&ownername=Angel`
        )
          .then((res) => res.json())
          .then((data) => {
            message.reply(`${data.message}`);
          });
      });
#

@rocky hearth You there?

rocky hearth
#

this is not the code the error is originating from

#

but from here

novel jetty
#

1 sec

novel jetty
novel jetty
rocky hearth
novel jetty
#

How... There is no line that matches that

snow sentinel
boreal iron
#

The error message tells you the file and the line of the occurrence of this code.

#

You just need to read it.

civic scroll
#

chatbot.findOne try catch

#

or find where it was previously executed

#

and prevent from calling twice

#

i'd recommend a database cache util for this

fiery stream
#

why does this work inside h1 tag but no in img

quartz kindle
#

hint: look at the colors

modest maple
#

regex

pale vessel
#

plus if you want to make sure it's a valid token you could try making a simple http request to Discord's REST API with it as header

#

Or put them in a public gist if you want to invalidate it

cinder patio
#

Doesn't discord automatically invalidate a token if it's in a discord message?

#

oh it just warns you

fiery stream
lyric mountain
#

but u said u don't want rest

#

didn't make a graphql api yet, so I don't have much suggestion

boreal iron
#

Has somebody yet dealt with slash command permissions?

split hazel
#

yea

#

h

boreal iron
#

Regarding to the docs you have to register the commands and need to assign permissions (user/role) to it after it's active.

split hazel
#

that's true

boreal iron
#

It still says the command which has an user/role permission is visible for anyone but cant be executed (is greyed out)?

#

How does that look?

#

I somehow don't really get the usecase of global commands being available for a specifc user only, since role IDs globally even makes less sense

#

Can I set a permission as placeholder to "lock" a command for anybody?

split hazel
#

no

boreal iron
#

How fast it an permission update? Is it instantly available in any guilds (regarding global commands)?

split hazel
#

2 hours I think same as any other change

#

/ 1 hour idk

boreal iron
#

oof wtf

#

Ok it's trash then

#

My own permission handler is more useful then even if some can execute commands they have no permissions for.

split hazel
#

a bit unsafe

boreal iron
#

But I mean the emphermal response doesn't bother anybody

split hazel
#

(the permission delay)

boreal iron
#

wut?

#

I'm awaiting the user permissions before executing the command

#

Or do you mean something else?!

spark flint
boreal iron
#

Tell me the truth! You're confused all day long...

spark flint
#

lol

earnest phoenix
earnest phoenix
fiery stream
opaque acorn
#

I have found what happened to me with the color library

feral aspen
#
const members = sServer.members.cache;

.addField(`${person} Members`, [
    `Total Members: **${sServer.memberCount.toString()}**`,
    `${online} **${members.filter(member => member.presence?.status === 'online').size}** ${idle} **${members.filter(member => member.presence?.status === 'idle').size}** ${dnd} **${members.filter(member => member.presence?.status === 'dnd').size}** **${offline} ${members.filter(member => member.presence?.status === 'offline').size}**`
].join("\n"), true)

It's giving me the incorrect amount for each?

quartz kindle
boreal iron
quartz kindle
cinder patio
#

I'm curious if V8 optimizes functions created with the Function constructor

feral aspen
boreal iron
#

Also members presence need the intent for it.

quartz kindle
#

you need both the members and the presences intent

feral aspen
#

I have both.

quartz kindle
#

you can only request 1000 members per second per guild

#

so if you have 100k members, it will take a long time

boreal iron
#

Well the member count is more or less accurate since the guild obj includes the correct number in the ready event

quartz kindle
#

and your memory usage will be very large as well

feral aspen
#

Big yikes, although, with I having sharding, it yet works, right?

quartz kindle
#

it doesnt matter, it will still use a lot of memory

#

i mean, try it

#

all you need to do is await guild.members.fetch({ withPresences: true })

boreal iron
#

Showing the total amount of members is okay, but think about if it's worth to waste that amount of ressources to show the presence nobody cares about

feral aspen
#

Yeah, true.

#

Does this apply to guild channels, as well?

#

I mean, they are short numbers, and I am not fetching each type, althogh, what if I did?

boreal iron
#

Guild channels should be cached in djs by default iirc

earnest phoenix
feral aspen
#

Ohh..

boreal iron
#

is more or less accurate since the guild obj includes the correct number in the ready event

#

should be a few seconds ago

#

Last command usage: in the near future

spark flint
#

whats the subcommand option for roles?

#

discord.js

boreal iron
#

lemme check

#

Type 2

#

Or simply using the string

#

SUB_COMMAND_GROUP

#

woops

#

Type 1

#

or SUB_COMMAND

#

my bad

spark flint
#

i mean like .addUserOption

boreal iron
#

Example:

{
    name: "config",
    description: "Customize features of the bot on this server.",
    permissions: ["ADMINISTRATOR", "MANAGE_GUILD", "MANAGE_CHANNELS", "MANAGE_MESSAGES"],
    options:
    [
        {
            name: "channel",
            description: "Customize the channel(s) the bot should listen to. Entering no value will reset this config.",
            type: "SUB_COMMAND",
            options:
            [
                {
                    name: "channel",
                    description: "Select a channel the bot should listen to exclusively.",
                    type: "CHANNEL"
                }
            ]
        },
        {
            name: "nickname",
            description: "Customize the nickname of the bot on this server. Entering no value will reset this config.",
            type: "SUB_COMMAND",
            options:
            [
                {
                    name: "nickname",
                    description: "Enter the new nickname the bot should have.",
                    type: "STRING"
                }
            ]
        }
    ]
}
#

oh

#

nvm

spark flint
#

the docs aren't clear about subcommand options

spark flint
#

ah i'm on another site thats why

feral aspen
deft forge
#

i use discord.py and made a leaderboard command that worked just fine the oter day but now doesnt want to work anymore

async def leaderboard(ctx,x = 10):
    users = await get_bank_data()
    leader_board = {}
    total = []
    for user in users:
        name = int(user)
        total_amount = users[user]["wallet"] + users[user]["bank"]
        leader_board[total_amount] = name
        total.append(total_amount)


    total = sorted(total,reverse=True)    

    eml = discord.Embed(title = f"Top {x} Richest People" , description = "The classement is determined on the actual money poeple have and not on the objects they have bought.",color = discord.Color.blue())
    index = 1
    for amt in total:
        id_ = leader_board[amt]
        member = client.get_user(id_)
        name = member.name
        eml.add_field(name = f"{index}. {name}" , value = f"{amt}:coin:",  inline = False)
        if index == x:
            break
        else:
            index += 1

    await ctx.send(embed = eml)```
#

the error: File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped raise CommandInvokeError(exc) from exc discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'name'

spark flint
#

its not getting the member i don;t think

deft forge
#

i dont undersatnd why though

#

because it worked and i didnt change the code

spark flint
#

try await client.fetch_user(id_)

deft forge
#

k

#

yup that worked thanks

feral aspen
#
const members = await sServer.members.fetch({ withPresences: true });

.addField(`${person} Members`, [
    `Total Members: **${sServer.memberCount.toString()}**`,
    `${online} **${members.filter(member => member.presence?.status === 'online').size}** ${idle} **${members.filter(member => member.presence?.status === 'idle').size}** ${dnd} **${members.filter(member => member.presence?.status === 'dnd').size}** **${offline} ${members.filter(member => member.presence?.status === 'offline').size}**`
].join("\n"), true)
spark flint
#

deffo got member intents?

feral aspen
#

It's a local bot? It has all intents.

#

.. and yes, the bot has member intents.

spark flint
lyric mountain
#

see my handlers/api package

frigid robin
#

Hey guys. My bot joined 20 guilds by now the python process is already at 100% CPU somehow bee_sad . Any tips on how to utilize multiprocessing with discord.py?

solemn latch
#

That doesn't seem right

lyric mountain
#

nonetheless, you should never reach 100%, something is clearly wrong

solemn latch
#

Python is known for not reaching above 80% isn't it?

frigid robin
lyric mountain
#

probably, iirc python has some max cap for most resources

lyric mountain
#

so all is processed in a single thread

#

but that aint ur issue, multithreading wouldnt reduce cpu usage

#

if anything it'd increase

frigid robin
#

but multiprocessing != multithreading

lyric mountain
#

how do u do multiprocessing without multithreading?

frigid robin
#

Multiple processes would use 1 thread

ember gust
#

help

lyric mountain
#

...that'd technically not be a single execution, that'd be the same as running the file multiple times

frigid robin
solemn latch
#

You'd still be at 100% with multiple processes on the same thread

ember gust
#

oh is this wrong

#

bottom right and left side

#

swear its ../

frigid robin
lyric mountain
#

show ur message listening event

ember gust
#

i dont listen to messages

lyric mountain
#

not u, prince

ember gust
#

oh ok

#

any solution for my skill issue above

lyric mountain
#

no idea, but if this helps, fs considers the root of the project instead of the current file

#

maybe that sqlite lib uses fs to get the file

ember gust
#

sqlite3?

#

ill look it up

frigid robin
lyric mountain
#

oh my

pale vessel
#

A loop on every message inside a guild

lyric mountain
#

is that a json db?

ember gust
#

weird that actually worked ty kuu

lyric mountain
frigid robin
# lyric mountain is that a json db?

no there's only a tiny bit of config stored on RAM in a json but I'm moving it to sqlite as well now.
The db searched for each message is SQLITE

feral aspen
#

Hey, so I've been confused during my entire development to slash commands.
When it comes to bots like Dank Memer and using their slash commands, as you can see from the below screenshot, it's grey and it immediately replies.

While for bots like mine, it has to be white then reply?
How is this possible and what did they do to immediately return without doing the white text thing?

#

It has made my bot so so so slow.

pale vessel
#

They don't defer their responses

feral aspen
#

That makes sense.

pale vessel
#

You should only defer your responses if your bot needs more than three seconds to respond

lyric mountain
feral aspen
# pale vessel You should only defer your responses if your bot needs more than three seconds t...

This is my current handler?

module.exports = async (bot, interaction) => {
    if (interaction.user.bot) return;

    if (interaction.isCommand()) {
        await interaction.channel.sendTyping()
        await interaction.deferReply({ ephemeral: false }).catch(() => {});

        const slashcommand = bot.slashcommands.get(interaction.commandName);
        if (!slashcommand) return interaction.followUp({ content: "An error has occured, whereas this command is no longer available." });

        const args = [];

        for (let option of interaction.options.data) {
            if (option.type === "SUB_COMMAND") {
                if (option.name) args.push(option.name);
                option.options?.forEach((x) => {
                    if (x.value) args.push(x.value);
                });
            } else if (option.value) args.push(option.value);
        };

        interaction.member = interaction.guild.members.cache.get(interaction.user.id);
        if (slashcommand) await slashcommand.run(bot, interaction).catch(error => console.log(error));
    };
};
frigid robin
feral aspen
#

What can I do instead of .deferReply()?

lyric mountain
#

that's probably the culprit, leftover open database streams

ember gust
#

weird the interaction is replied to if row is not defined. apparently row is never defined

#

somethings wrong

#

the db isnt being reached for some reason

pale vessel
frigid robin
lyric mountain
#

you shouldn't have one db for each guild

#

that's the whole thing with tables

feral aspen
# pale vessel Just use interaction.reply()

This raised an error?

C:\Users\HamoodiHajjiri\Desktop\Rewrite\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:165
    if (!this.deferred && !this.replied) return Promise.reject(new Error('INTERACTION_NOT_REPLIED'));
                                                               ^

Error [INTERACTION_NOT_REPLIED]: The reply to this interaction has not been sent or deferred.
    at CommandInteraction.followUp (C:\Users\HamoodiHajjiri\Desktop\Rewrite\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:165:64)
    at C:\Users\HamoodiHajjiri\Desktop\Rewrite\src\slashcommands\utility\help.js:117:49
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  [Symbol(code)]: 'INTERACTION_NOT_REPLIED'
}
ember gust
#

same tbh

lyric mountain
#

for both of you, you didn't answer within 3 seconds

ember gust
#

wdym answer within 3 seconds

lyric mountain
#

on interactions, you have 3 seconds to either reply or defer

ember gust
#

it replies immediately

pale vessel
#

Check what method you used

frigid robin
feral aspen
ember gust
#

i use interaction.reply and it replies immediately after the cmd is sent

pale vessel
#

Follow up only works if there's an original response

#

deferReply() creates a response even if it says thinking

ember gust
pale vessel
#

You have to just reply instead of doing follow up

ember gust
#

it always replies with added to db

lyric mountain
pale vessel
#

or check if it replied before following up otherwise reply

feral aspen
lyric mountain
#

HOWEVER, since you have many databases, constantly opening and closing the connections will lead to a HUGE processing time

#

that on each message leads to 100% cpu usage

#

you use offline database connections on desktop softwares where connections will only happen so often

feral aspen
lyric mountain
#

not on constantly-ticking services like bots

frigid robin
pale vessel
#

You shouldn't defer unless you need to

frigid robin
#

well if I make that change SQLITE should suffice though shouldn't it? I could store theoretically store hundreds of terabytes of data. Or would it work extremely slow if lets say I have 1000 servers and each table got about 1000-3000 entries?

pale vessel
#

It's not slow

#

SQL is made to handle even more than that

#

Looping through files and looking for a correct one is slower

lyric mountain
#

there

#

have a guild table which has whatever data about a guild you wanna store

feral aspen
lyric mountain
#

create a 1-N message table to store whatever messages u wanna store

#

relation it with guild table using guild_id

#

when u wanna fetch all messages, SELECT * FROM message WHERE guild_id = :id

#

although I'd not store messages in the db, it just looks like a waste and probable privacy breach

#

instead, process the messages in memory, but limit how many you store

#

like last 50 messages or so per guild

frigid robin
#

so in my case it's not a mod bot but it can be taught to remember stuff, so it scans messages for containing certain keywords

lyric mountain
#

process that without storing all messages

frigid robin
#

yep ofc

lyric mountain
#

actually, you have no reason to store any message in this case

frigid robin
#

I only store the ones that I find that need to be remembered

lyric mountain
#

except command logging, which is good to have

#

to prevent, yk, people saying your bot was racist or some shit

#

that way you have logs to back you up

frigid robin
#

got logging too yes

split hazel
frigid robin
lyric mountain
#

that's one of the reasons I have mine

frigid robin
#

so just to make sure I understood correctly - gonna make one DB with table for each guild, and those tables are gonna have guild ID as their name?

lyric mountain
#

people love to throw shit whenever possible

pale vessel
#

s!say I do not like Speedy

lyric mountain
#

one table for guilds

#

one row for each guild

#

then put messages in another table and link both together through a foreign key

pale vessel
clear marlin
#

dmed u with

pale vessel
#

Insufficient permissions

clear marlin
#

oh

#

yeah

#

it doesnt have permissions here

lyric mountain
#

ah, shiro the dog

clear marlin
#

yes

round cove
#

Man those were the days

clear marlin
#

what days

lyric mountain
#

dog days™️

round cove
#

Shiro being a thing

ember gust
#

s!say I do not like Speedy

#

ez

clear marlin
#

isnt shiro still a thing

round cove
#

in name sure lmao

clear marlin
#

if you're talking about community, it's regrowing

pale vessel
#

shiro bigsnipe

frigid robin
#

so all messages in 1 table and they'll have one column saying which guild they belong to

lyric mountain
#

yes

frigid robin
#

ok, infrastructural overhaul pleading thanks a lot for the help

lyric mountain
#

yw

lament rock
#

use pkeys!

#

otherwise, filtering becomes really taxing

lyric mountain
#

indexes are sussy bakas

frigid robin
#

guildID would be the primary?

lyric mountain
#

ye

lament rock
#

pkeys have to be unique

round cove
#

Anyway.

lyric mountain
#

as papi said, pkeys are unique

frigid robin
#

yup

lyric mountain
#

on messages table they'd be foreign keys

#

message id would be the pk

frigid robin
#

in the messages table I need the combination of guild ID + message to be unique. How can that be achieved?

lament rock
#

depending on how you access it, it could also be a join of channel_id and message_id

lyric mountain
#

oh yeah, also putting channel id would be sick

lament rock
#

1 message per guild? Fair

frigid robin
#

lots of messages per guild, but guild X can only have message Y once

lyric mountain
#

content u mean?

frigid robin
#

yeah yeah

lyric mountain
#

set content as unique

#

although it'd not make sense

lament rock
#

If you're storing a bunch of messages from the same guild and/or channel, then set pkey as message id

lyric mountain
#

ohh wait

lyric mountain
#

no message id ever repeats

#

and no guild id ever repeats

#

so, no combination of guild + message will ever repeat

lament rock
#

Unless you try to insert a new row with the same pkey

lyric mountain
#

unless u insert twice

frigid robin
#

guild 82358325 can have message "lol" only once
guild 21742375 can also have message "lol" but only once

lyric mountain
#

set content as unique then

lament rock
#

gid & content

#

sanitize your input

lyric mountain
#

just remember it'll allow lol, Lol. lOl, loL, LOl, LoL and lOL

#

leetspeak exists

lyric mountain
#

l0l

frigid robin
lyric mountain
#

not if u use composed constraint

lament rock
frigid robin
lament rock
#

pkeys can be a mix of multiple keys

#

at least in postgres

#

mysql and maria use pkeys and skeys

lyric mountain
#

m*sql

split hazel
#

pov you dont like mysql because its maintained by oracle

boreal iron
#

Well that’s why you choose MariaDB

compact pier
#

how to get server user avatar?

unique tiger
#

What's the ratelimit for editing a message several times to not get rejected by top.gg (such as dank memer's hack command)?

pine crag
#

What did Mac use to create this?

#

Thank you p02heart

spark flint
jovial nexus
#

How can i shuffle 2 arrays in the same way?

#

Like make the order random, but the same order in both arrays

pine crag
#

How would you apply that to your account?

#

Mk

#

OHHHH I see

jovial nexus
#

?

lyric mountain
#

alternatively, u can just copy the array

lyric mountain
# jovial nexus ?

all rng allows setting a seed, which defines the "pattern" of the randomness

jovial nexus
#

they are completely different arrays, but need to have the same order

lyric mountain
#

in that case, you can't shuffle the second

#

cuz even with the same seed it'll result in different order

#

you can, however, use a lookup array to check new placements

civic scroll
#

you can apparently check index

#

extending the durtensfield or whoever that is algorithm

#

but you will have to shuffle those two simutaniously

#

or just yk

#

deep clone the shuffled array

civic scroll
lyric mountain
#
let origList = [...]; // the original list/array
let secondList = [...]; // the secondary list of whatever

let shflList = origList // the new, shuffled list
  .map((value) => ({ value, sort: Math.random() }))
  .sort((a, b) => a.sort - b.sort)
  .map(({ value }) => value);

let secShflList = []; // the container for the second shuffled list
for (i in secondList) {
  secShflList.splice(origList.indexOf(shflList[i]), 0, secondList[i])
}
civic scroll
#

so the output arrays have the same order but are different from original

pine crag
#

wont install any ideas?

jovial nexus
pine crag
#

LMFAO

civic scroll
#

both array looks the same or what

#

can you give me an example?

#

ah wait

#

i think i figured it out

jovial nexus
#

ok, imagine i have this arrays

#
[a, b, c, d]

[1, 2, 3, 4]```
civic scroll
#

so the same shuffler order applied to both arrays

jovial nexus
#

yeah

jovial nexus
#

like this

civic scroll
#

you need a sequence generator

jovial nexus
#
[b, a, d, c]

[2, 1, 4, 3]```
pine crag
#

Error: Could not find any Visual Studio installation to use hmmmm seems legit

civic scroll
#

with a sequence generator you can synchronise the sequence on n number of arrays

pine crag
#

Sounds about right

civic scroll
#

first off you generate an index array with

const indexSeqGenerator = length => new Array(length).fill(null).map((_, i) => i);
#

then use whatever you have, shuffle the output array

#

then apply it via

const outputArray = inputArray.map(shuffledIndex => inputArray[shuffledIndex]);
#

you can apply to itself too

neat ingot
#

please, someone say something code related. im in my trashy ass teams meeting for college and the lecturer is boring me to sleep teaching nubs what a web browser is.

civic scroll
#

same idk man

eternal osprey
#

Hey how do i check if a user has already reacted before?

#

Like, he adds an reaction and then removes it

civic scroll
#

hold a Map temporarily with type <string, boolean>

jovial nexus
#

Like this @civic scroll ??ts const indexSeqGenerator = (length:number) => new Array(length).fill(null).map((_, i) => i); const outputArray = oneArray.map((shuffledIndex:number) => oneArray[shuffledIndex]); const outputArray_2 = twoArray.map((shuffledIndex:number) => twoArray[shuffledIndex]);

civic scroll
civic scroll
jovial nexus
civic scroll
#

but you can assign to the array itself

civic scroll
#

alright wait

eternal osprey
#

Aha, thank you!

#

And after 5 minutes for example, i could use map.set(user.id, false).

#

Awsome!

civic scroll
# jovial nexus but that doesnt use the `indexSeqGenerator`
// seq generator
const indexSeqGenerator = (length:number) => new Array(length).fill(null).map((_, i) => i);
function shuffler<T>(array: T)
{
    // some algorithm to shuffle the array
}
const randomSeq = shuffler(indexSeqGenerator(4));
let array_1 = [1, 2, 3, 6];
let array_2 = [1, 2, 5, 3];
const shuffleToSeq<T> = (value: T, _, array: T[]) => array[value];

array_1 = array_1.map(shuffleToSeq);
array_2 = array_2.map(shuffleToSeq);
jovial nexus
#

thanks!!!!^^

#

btw whats that "typescript jail" role you have? very cool

spark flint
#

someone from the topgg team gave them it

#

its for typescript

#

illegalness

neat ingot
#

typescript looks so ugly compared to vanilla js imo

sudden geyser
#

that's because it is

cinder patio
#

the code above is ugly in general, if that's what you're talking about

#

nah

eternal osprey
#

Is it me or am i logged out of my alt account?

tawny lava
#

once you go typescript you'll find it hard to go back to javascript

eternal osprey
#

I tried to test a project, but it logged me out and is throwing bad connection errors

cinder patio
#
const indexSeqGenerator = (length: number) => new Array(length).fill(null).map((_, i) => i);

function shuffler<T>(array: T) {
    // some algorithm to shuffle the array
}

const randomSeq = shuffler(indexSeqGenerator(4));
let array1 = [1, 2, 3, 6];
let array2 = [1, 2, 5, 3];
const shuffleToSeq<T> = (value: T, _: unknown, array: T[]) => array[value];

array1 = array1.map(shuffleToSeq);
array2 = array2.map(shuffleToSeq);

There. Prettier.

earnest phoenix
eternal osprey
#

That's tuff

frigid robin
#

@lyric mountain following our previous conv, I was reading a bit more on sqlite, found this, seems weird - why use a create_connection function that won't close the connection? So should I be opening a connection for every message sent in the guild or should I have 1 open connection all the time?

earnest phoenix
# lyric mountain springboot is pretty much express but java

Yea, my thinking is graphql will be useful for querying the data from the database but I will still have post requests to handle creating the data (unless I don't really need to and graphql can handle that I haven't used graphql before so I gotta read up on it)

#

Or I could just go completely rest api and just not even use graphql

cinder patio
#

I've been using graphql recently

#

I don't like it

#

I think it's overkill

#

I guess if you are creating an API which will be used by other developers, then yeah, graphql is okay, but if you're making a backend for a website and the api is used to communicate with the frontend, then no I wouldn't go for graphql

cinder patio
earnest phoenix
quartz kindle
#

what even is graphql? i never understood it

earnest phoenix
#

But i've never used graphql so im not sure how it all works

cinder patio
quartz kindle
#

so its just some sort of standard?

#

i thought it was like a framework or something

cinder patio
#

By "efficient" I mean more space / network efficient

#

yeah it's sort of a standard

#

and each language has different frameworks for it

earnest phoenix
#

I just don't know if my project is right for graphql

earnest phoenix
#

Cause you seem to say its useful when you are making a public api but I don't understand how so

cinder patio
#

People who are querying your API may not want all the data it provides, so they can easily get what they need using graphql

#

also graphql APIs are easier to document

earnest phoenix
#

Mmm

#

My assumption was that I would use the graphql in my api endpoints.

#

Unless im being dumb I don't think graphql is useful for me

#

I don't see how I can use it and make it work with this project

cinder patio
#

You can use graphql for your endpoints too

earnest phoenix
#

hmm

cinder patio
#

Are you using ApolloClient and ApolloServer?

split hazel
#

i mean graphql is basically a "use it or dont use it" framework

earnest phoenix
#

I plan on using springboot

#

I am not entirely sure as of yet how graphql can integrate with it

split hazel
#

i rarely see apis use it

cinder patio
#

oh you're using java

#

Yeah I don't know either

split hazel
#

i doubt a couple of excess data bytes transferred over a network is a big deal

#

unless you've of course got an api which can return tons of data

cinder patio
#

graphql also provides nice data validation

#

Sorta unrelated, but I just switched from graphql to regular REST for one of my personal projects, and now I'm looking for good data validation libs... Ajv is the fastest out there, but it's errors are TERRIBLE! Like why

split hazel
#

dont know personally i always went the ugly if statement validation but i'd love to know a library too

cinder patio
#

So I decided to make my own and it's faster than Ajv... which claims it's the fastest json validation lib smirk

split hazel
#

why would it be so slow

#

what is it doing in the background lmao

earnest phoenix
#

I am thinking of not even using graphql at this point

#

At least not yet

#

It doesn't seem like with how small this api will be starting out that graphql will be needed

sudden geyser
split hazel
#

if your api doesnt return lots of data graphql isnt really your target market

sudden geyser
#

I've been using a schema library called Malli and having it return errors structured after the request.

cinder patio
#

for my lib? You make your own

const resultObjvl = Objvl.compile({
    properties: {
        name: { type: "string", maxLen: 15, errors: {
            maxLen: () => "String length exceeded."
        }},
        value: { type: "string", maxLen: 33, minLen: 15, errors: {
            maxLen: () => "String length exceeded.",
            minLen: () => "String length must be at least 15 chars."
        }}
    }
});

just an example

#

You can return objects or other data

split hazel
#

i also bet request has one which also plays nicely with the request and response objects

sudden geyser
#

No, from Ajv

#

Does the client not receive an error message?

cinder patio
#

Ajv just gives the errors to you and you decide what to do with them, but the errors are super strangely structured

lyric mountain
#

interns, pft

sudden geyser
#

that's meta as shit

cinder patio
# split hazel why would it be so slow

Ajv is super fast actually, I think their error system is the reason for this. It's creating these big error objects, and you don't use most of the data they give you. My lib even inlines the functions you give to the error, so in the example I gave above it just turns to a string literal

#

My lib is also lacking some features, so that could be why it's sooo much faster. But also, I'm giving the exact same schema to both libs... so I dunno

#

Also, I do not plan to 100% support "JSON Schema" with the lib cause it's just... whatever

#

it's stupid because you're not supposed to use untrusted schemas... so why do you need a specification for this? I don't get it

ember gust
#

tim is afk and hes the last person who helped me with sqlite stuff kek

spark flint
#
    data: new SlashCommandBuilder()
        .setName('add')
        .setDescription('Add a user to the blacklist! OWNER ONLY')
        .addSubcommand(user =>
            user.setName('user')
                .setDescription('Add a user to the blacklist! OWNER ONLY')
                .addUserOption(option => option.setName('user')
                    .setDescription('The user')
                    .setRequired(true)))
    
        .addStringOption(option1 =>
                    option1.setName('reason')
                        .setDescription('The reason')
                        .setRequired(true))

        .addStringOption(option3 =>
            option3.setName('evidence')
                .setDescription('The evidence')
                .setRequired(true)),```
sudden geyser
#

damn a mini dsl

#

Though that's interesting

#

It looks correct, unless subcommands can be marked as required, which wouldn't make sense.

pulsar bone
#
    if "trigger" in message.content: 
      if message.author.id == 294882584201003009:     
        confirm = discord.Embed(created embed)
        button = [
            Button(
              style=ButtonStyle.red,label=":cute: BroadCast"
            )
        ] 
        await message.channel.send(embed=confirm, components= button)
        res = await client.wait_for("button_click") 
        if res.channel == message.channel:
          if message.guild.name in db.keys():                                 
            link= str(db[message.guild.name])                                     
          else:               
            db[message.guild.name] = str(await message.channel.create_invite(max_age=0))               
            link = str(db[message.guild.name])                                
  
          msglink = "https://discord.com/channels/" + str(message.guild.id) +  "/" + str(message.channel.id) + "/" + str(message.id)                       
          GaTimeone = message.embeds[0].description.split("Ends:")          
          GaTime = GaTimeone[1].split("Hosted")    

        
          if message.guild.id in premium:
              GA_msg = discord.Embed(created embed)
        #non premium
          else:
              GA_msg = discord.Embed(created embed)
          for guild in client.guilds:                                       
                channel = discord.utils.get(guild.text_channels, name='giveaway-index')              
                if channel:                                                      
                    await asyncio.sleep(0.5)
                    await interaction.send_message(embed=GA_msg) 
``` 🥺help
sudden geyser
#

with

#

what

dry imp
#

🛌

sudden geyser
#

we don't own crystal balls, so no amount of pleading emoji faces will help us interpret that

dry imp
#

cmon klay you cant indentify an error from just the code smh

sudden geyser
#

I don't wanna

#

even though I can see many

dry imp
#

we programmers are god and can understand anything

pulsar bone
sudden geyser
#

but why

pulsar bone
dry imp
#

is there any error?

sudden geyser
#

no that's for you to discover 🔍

dry imp
#

if not then probably skill issue

sudden geyser
#

for example, an error message

#

or your ide screaming at you with red squiggly lines pointing to errors

#

or just looking at it and seeing

GA_msg = discord.Embed(created embed)
#

and wondering why there's a space between created and embed

dry imp
#

i think he is just simplifying

sudden geyser
#

maybe

pulsar bone
dry imp
#

ok is there any error message on your console?

pulsar bone
dry imp
#

skill issue

pulsar bone
#

just interaction failed

sudden geyser
#

you can upload large files and we can still see it, but alright.

pulsar bone
#

please I need knowledge

pulsar bone
dry imp
#

and i dont understand why you put that in your on_message

#

and i dont frickin understand why you dont use pycord or nextcord

#

🛌

pulsar bone
dry imp
#

thats not pycord code

pulsar bone
dry imp
#

read pycord docs

pulsar bone
dry imp
#

and you wont understand pycord just by watching video

sharp saddle
#

someone help me?

sudden geyser
#

You need to handle promises with .catch or try {...} catch (...) {...}

#

As for where that happened, the stacktrace may help you.

sharp saddle
#

I checked ALL codes

#

and I didn't see anything with async function

#

I mean... The commands are, however with try and catch

#

hmmmmmm

#

can i send github?

#

??

#

@sudden geyser this error appeared to me after discord came back

spark flint
sharp saddle
sudden geyser
#

or just send the file in here

#

since discord will display it pretty

spark flint
#

True

sharp saddle
#

why i can't send github link?

sudden geyser
#

you can

#

there are just other ways to share code

sharp saddle
spark flint
#

Personally I don’t see any reason for Sharding now

sharp saddle
#

I do it straight, nothing like this has ever happened to me

spark flint
#

It’s only in 99 servers

#

Just seems like a waste of resources to me

sharp saddle
#

oh

#

oke

spark flint
#

If you were dealing with say, 900+ servers then fair enough

wheat mesa
#

it's better to shard sooner rather than later imo

spark flint
#

True, but 99 severs seems a bit soon

wheat mesa
#

my bot is sharded with like 24 servers lol

spark flint
#

My bot in 290 servers isn’t

#

I’m gonna recode it for the 2839202th time

#

But in JS this time

wheat mesa
#

use ts 🔪

boreal iron
#

Recommendations by somebody who’s using Java…

#

smh

round cove
delicate zephyr
#

Why not

#

its good to future proof

wheat mesa
#

future proof because I don't work on it anymore

delicate zephyr
#

why struggle when it comes time to

delicate zephyr
#

because future proofing is 100% a good way to learn

#

idk why people get triggered when people shard at a low amount of servers like its a problem

boreal iron
#

True but it also depends on your expectations

#

Mine will never reach more than a few hundreds guilds

delicate zephyr
#

How do you know that

boreal iron
#

As it offers a very specific service for a few existing gaming communities only

#

Nobody else actually can use it

delicate zephyr
#

Thats an edge case tho

boreal iron
#

Yeah

delicate zephyr
#

if you know your target audience isnt that big

#

then yea

#

but like, if you want to build something that you hope will grow, build it to scale, even better when its at a low number

round cove
#

But yeah I agree.

delicate zephyr
round cove
#

Should've future proofed it

delicate zephyr
#

im rewriting it to tailwind rofl

round cove
#

xd??

delicate zephyr
#

All that css was manually written rofl

boreal iron
delicate zephyr
#

I was crying in my sleep getting that done

delicate zephyr
round cove
#

I still manually write CSS. I hate most of these shitty bundled CSS libs

delicate zephyr
#

its alright

#

not perfect

#

but alright

#

its good to get the job done quick

round cove
#

I should clarify I mostly just hate material-ui

delicate zephyr
#

I dont have the time to write css anymore

#

got a kid on the way and multiple other projects that need time

round cove
#

You'd have time if you got good at it 🧐

boreal iron
#

But you can’t always spend the time to develop anything perfectly being able to scale in the future.

Sometimes you gonna throw something out, see how the interest is and if it blows up your expectations you gonna redo it

delicate zephyr
#

true

round cove
#

What other projects you got going on

vivid fulcrum
round cove
delicate zephyr
#

havent had time to fix

boreal iron
delicate zephyr
#

PyroCDN - the one you looked at
Shiro - Currently rewriting, should release in around 3 weeks~ ish
Shiro's new featureset - will be working on after shiro's base rewrite release
Shiro's Web Dashboard - Will be releasing after rewrite also
DBL Stats - update soon™️

Not to mention I work full time and have a kid on the way and will be moving flat soon KEKW

#

Shiro is my main project atm

round cove
delicate zephyr
#

not bad tbf

#

for 2 days of work

boreal iron
#

Sounds familiar…
Time management nowadays is pain

vivid fulcrum
#

minimal

delicate zephyr
#

honestly

#

everything has just happened at once atm

boreal iron
#

That’s always the case!

delicate zephyr
#

Im basically unable to get anywhere right now cause my Bike failed its MOT, meaning i have no mode of transport

#

and taking public transport is a massive risk cause my fiancée is high risk if she gets covid

#

so like, unless I walk 6 miles to get to work... not happening

#

luckily i can work from home

boreal iron
#

Err that’s an unfortunate situation

vivid fulcrum
#

remote work is a blessing

delicate zephyr
#

indeed

#

its also a pain tho, cause I was supposed to go in tomorrow for a meeting...

#

now I cant

#

@round cove also, not to mention ive had a team shift with shiro

#

which you probably saw

round cove
#

Possibly.

delicate zephyr
#

so thats been interesting

round cove
#

What are you trying to make shiro into even?

delicate zephyr
#

Im atm just renewing its current features

#

then more to come™️

#

making them work via slash commands and such

#

then im gonna add a lot more

#

I have some big ideas for it

round cove
#

Slash commands are a mistake

delicate zephyr
#

they are, but im also keeping legacy commands

#

so both will work

#

¯_(ツ)_/¯

round cove
#

If you're doing slash commands you better put them all onto a stateless server or lambda

delicate zephyr
#

shiro itself

#

is stateless now

#

its consumer based

#

with a centralized gateway and cache

round cove
#

It still has a gateway queue no?

delicate zephyr
#

You mean like, restarting?

#

that doesnt happen unless I need to reshard now

round cove
#

No when receiving and parsing all the events.

delicate zephyr
#

Oh not really

#

more consumers less response time

#

1 consumer can take up to 10k requests per second + im using a rest proxy to handle ratelimits now

#

discord went down

#

old infra just completely shit itself and something in eris caused a mem leak

#

and new infra didnt even ask what happened, just handled it

round cove
#

Lmao.

delicate zephyr
#

I wanna get rid of the old shiros code base

#

its a fucking mess

#

ive been thinking "do I open source the old"

#

but quite frankly I just wanna delete the repo lol

round cove
#

I mean the code is probably about 5 years old at this point. Bound to happen to those learning.

delicate zephyr
#

no its not

#

thats the funny thing

round cove
#

Oh?

delicate zephyr
#

the old infra was rewritten when I joined

#

a lot of my code is fine

#

but theres a ton of obviously copy pasted stuff

#

since I looked across all the projects

#

and theres inefficient code everywhere

#

just wanna delete it

#

new infra is like 90% done

#

just waiting on a protocol in the gateway cache to be added for past data on user/member updates and then its done

#

and i can release

#

I managed to code most of it ahead of schedule

#

so now im just doing metric stuff

round cove
#

Do you use K8?

delicate zephyr
#

new infra

delicate zephyr
round cove
#

I mean you can combine them

delicate zephyr
#

Yea I can

round cove
#

I would personally.

delicate zephyr
#

but im going to be building auto-scaling checks so it'll upscale and downscale automatically

#

still surprised new infra only uses 1.3GB ram

round cove
#

Brains C++ lib does like ~200k servers at like 5GB which is nice.

delicate zephyr
#

thats dope lol

round cove
#

He do be smart.

delicate zephyr
#

I honestly just wanna see how the new infra handles it

round cove
#

But also most of the lib only tracks snowflakes and uses good typings for it so it makes sense.

delicate zephyr
#

@round cove also, shiro's not changing much, keeping current features plus adding more after ive gotten new prod out

round cove
#

Certainly an interesting way to do command listing.

delicate zephyr
#

this also fixes a lot of the issues with logging

delicate zephyr
round cove
#

Since I'm stuck using d.js and don't wanna move off it 😛

What would be a reason for a raw packet to claim that a message is unknown if a reaction event was caught, message id parsed and then fetched.

#

It shouldn't be hitting cache. I guess it's possible it was an automodded message that was deleted before I could fetch it?

bronze socket
#

how can i fix this?

round cove
#

Do you understand what it's saying?

bronze socket
#

nah

#

in new to buttons

#

@round cove

round cove
#

Well.

#

Can you at least write out the ERROR you see, here for me.

bronze socket
#
    at Object.execute (/home/runner/NEXTRO-xD/src/commands/misc/invite.js:17:22)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Object.execute (/home/runner/NEXTRO-xD/src/events/message.js![57](https://cdn.discordapp.com/emojis/780777613488553984.webp?size=128 "57")13)```
round cove
#

Now that you put it here, read it with me okay.

#

What do you think it's saying

#

The first line

bronze socket
#

disbut is not defined

round cove
#

Okay cool. Do you know what disbut is?

bronze socket
#

nah

vital void
#

pandasad did u copy pasted code..

round cove
#

Are you saying you didn't create some variable called disbut in the file invite.js?

bronze socket
#

i did

#

and it worked now

round cove
#

(:

bronze socket
#

ty

lament rock
#

thats a lot of invite buttons

vivid fulcrum
#

that are very aggressive

dry imp
#

lmao truueeeeee

bronze socket
#

help me wid this

round cove
#

Okay stay with me here okay?

bronze socket
#

okay

round cove
#

What if you read the error out loud.

bronze socket
#

await is only valid in async function

round cove
#

Is the function async

bronze socket
round cove
bronze socket
#

run: async (bot, message, args, ops) => {}

#

i have to write code in this?

round cove
#

It doesn't look like your code is in a function based off the SS.

bronze socket
#

oh

#

async function button(){}

bronze socket
#

hey

#

i want this command to be accessed by members with manage server permission

#

how can i do that?

#

help...

earnest phoenix
#

Check if the (hint) member has the permission before doing anything else

novel jetty
#

What does this mean?

pale vessel
#

use import instead of require or do npm i node-fetch@cjs

#

if you're not using ESM and still want to use the same version, then it's (await import("node-fetch")).default

earnest phoenix
#

also is cjs even a valid npm version

pale vessel
#

it's a tag

valid sierra
#

Hii, i am trying to make a music bot for my server so here is the code for the play command

@commands.command()
    async def play(self, ctx, *, url: str=None):
        try:
            ctx.voice_client.stop()
        except:
            return
        if url is None:
            embed0 = Embed(description=f"Please write a link to a song!",
                           color=random_color())
            await ctx.send(embed=embed0)
            return
        FFMPEG_OPTIONS = {"before_options": "-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5",
                          "options": "-vn"}
        YDL_OPTIONS = {"format": "bestaudio"}
        vc = ctx.voice_client

        with youtube_dl.YoutubeDL(YDL_OPTIONS) as ydl:
            info = ydl.extract_info(url, download=False)
            #info = ydl.extract_info(url)
            url2 = info["formats"][0]["url"]
            source = await FFmpegOpusAudio.from_probe(url2, **FFMPEG_OPTIONS)
            vc.play(source)```
and here is the error
```Ignoring exception in command play:
Traceback (most recent call last):
  File "J:\PycharmProjects\MyWorkProjects\work\.venv\lib\site-packages\discord\ext\commands\core.py", line 179, in wrapped
    ret = await coro(*args, **kwargs)
  File "J:\PycharmProjects\MyWorkProjects\work\SadisticFairyFolder\SadisticFairyCogs\music.py", line 53, in play
    source = await FFmpegOpusAudio.from_probe(url2, **FFMPEG_OPTIONS)
  File "J:\PycharmProjects\MyWorkProjects\work\.venv\lib\site-packages\discord\player.py", line 452, in from_probe
    return cls(source, bitrate=bitrate, codec=codec, **kwargs)  # type: ignore
  File "J:\PycharmProjects\MyWorkProjects\work\.venv\lib\site-packages\discord\player.py", line 384, in __init__
    super().__init__(source, executable=executable, args=args, **subprocess_kwargs)
  File "J:\PycharmProjects\MyWorkProjects\work\.venv\lib\site-packages\discord\player.py", line 153, in __init__
    self._process: subprocess.Popen = self._spawn_process(args, **kwargs)
  File "J:\PycharmProjects\MyWorkProjects\work\.venv\lib\site-packages\discord\player.py", line 170, in _spawn_process
    raise ClientException(executable + ' was not found.') from None
discord.errors.ClientException: ffmpeg was not found.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "J:\PycharmProjects\MyWorkProjects\work\.venv\lib\site-packages\discord\ext\commands\bot.py", line 335, in invoke
    await ctx.command.invoke(ctx)
  File "J:\PycharmProjects\MyWorkProjects\work\.venv\lib\site-packages\discord\ext\commands\core.py", line 916, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "J:\PycharmProjects\MyWorkProjects\work\.venv\lib\site-packages\discord\ext\commands\core.py", line 188, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ClientException: ffmpeg was not found.
Exception ignored in: <function AudioSource.__del__ at 0x000002331E782670>
Traceback (most recent call last):
  File "J:\PycharmProjects\MyWorkProjects\work\.venv\lib\site-packages\discord\player.py", line 116, in __del__
    self.cleanup()
  File "J:\PycharmProjects\MyWorkProjects\work\.venv\lib\site-packages\discord\player.py", line 212, in cleanup
    self._kill_process()
  File "J:\PycharmProjects\MyWorkProjects\work\.venv\lib\site-packages\discord\player.py", line 177, in _kill_process
    proc = self._process
AttributeError: 'FFmpegOpusAudio' object has no attribute '_process'
valid sierra
#

i found this code in a tutorial and followed the steps, did some changes like embeds and etc

dry imp
#

okay fair

novel jetty
#

Can someone help me with this please?

dry imp
dry imp
#

you should try printing info

#

and find the value from the json

valid sierra
#

I mean it says ffmpeg is not found so i was wondering what is ffmpeg

dry imp
#

huh so you dont understand the tutorial you've followed

valid sierra
#

well i do as you say and print info then

dry imp
#

you know how to fetch value from a json right?

valid sierra
#

nope

#

didn't work with json before

dry imp
#

i dont want to spoonfed so you should figure it out by yourself

valid sierra
#

ik lol

#

i didn't ask you for that, i just want to know how to fix that

#

well it spammed a load of dicts

dry imp
#

the problem is you fetched the wrong value, if you can fetch the right value its fixed

dry imp
valid sierra
#

okay so what am i supposed to look for?

dry imp
#

find a value that is a url

valid sierra
#

there are a lot

dry imp
#

if you are confused you could use online json formatter

valid sierra
#

oh wait

dry imp
#

so you could see the format better

valid sierra
#

i found it

valid sierra
dry imp
#

try sending the dicts for me

dry imp
valid sierra
#

that's the info["formats"][0]

earnest phoenix
#

stop using youtube for music

#

yo is that a leaked ip

dry imp
valid sierra
#

hmm

valid sierra
earnest phoenix
#

nvm it's googlevideo's ip

valid sierra
valid sierra
# dry imp and what if you print info["formats"][0]["url"]
https://rr1---sn-uxaxjvhxbt2u-amgl.googlevideo.com/videoplayback?expire=1643296049&ei=0GDyYZqJPM2B7gP-1qbgAQ&ip=156.202.108.23&id=o-AKNqiZs5urYrpqXhZ50_O-iROlNtzCjIdgJKDBfLkD1X&itag=249&source=youtube&requiressl=yes&mh=ve&mm=31%2C29&mn=sn-uxaxjvhxbt2u-amgl%2Csn-hgn7yn7l&ms=au%2Crdu&mv=m&mvi=1&pl=19&initcwndbps=323750&vprv=1&mime=audio%2Fwebm&ns=hh6vgByCDDxtt4ag_qwNT8oG&gir=yes&clen=1301212&dur=207.341&lmt=1640988056089035&mt=1643274080&fvip=1&keepalive=yes&fexp=24001373%2C24007246&c=WEB&txp=5432434&n=x6DILiRauuVN3x&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRgIhAKJYFCSI-pfMFkjWaSce0GbvOYe_NybUqTJiWjhdWoJOAiEArIEsBrLgfHqHe9Abuf9fpcsRPjZhFs_4cBx9M4QZlp4%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRgIhAP-te8H9YqLdbqXlQyTSDqRKnTjjLFXX9ZFL6kMe65XaAiEAxWqzi0QGYlqi5gpzu2PYCh5dAKPKN0JILTMm5dLj0_Q%3D
earnest phoenix
valid sierra
#

oh?

earnest phoenix
#

fetch the link, pass it to ffmpeg to convert it to audio, play it in a vc

dry imp
#

wait a sed

#

c

earnest phoenix
#

sedc

valid sierra
valid sierra
earnest phoenix
dry imp
#

why is it None in the error

earnest phoenix
#

look for ffmpeg on pip

valid sierra
timber fractal
#

anyone knows how i can fix this error?

class sendAPICallback extends dAPIMessage {
                              ^

TypeError: Class extends value undefined is not a constructor or null```
earnest phoenix
#

side note: if you're using replit there are some extra steps you need to do to use ffmpeg

valid sierra
timber fractal
valid sierra
earnest phoenix
#

what even is that error

earnest phoenix
valid sierra
#

oh

timber fractal
earnest phoenix
#

looks like it's a problem with the lib itself

valid sierra
dry imp
#

i dont think thats the case

valid sierra
#

hmm

dry imp
#

lemme see

valid sierra
#

i am not sure what's the case lmao

valid sierra
dry imp
valid sierra
#

oh sure

valid sierra
dry imp
#

send as file then

valid sierra
#

can i do it in DMs ?

dry imp
#

sure

valid sierra
#

alr

earnest phoenix
#
const x = "123"
const z = "z"

const y = {
 x: z
}

console.log(y)

Ouput :
x: z

I want 
123: z 
pulsar bone
#

can someone send link to opensource pycord projects

tardy hornet
#
const member = interaction.options.getUser('user')
            const kickedMember = member

kickedMember.kick()

kickedMember.kick is not a function
#

lol

gentle condor
#

I have this code,but why does it return False even though the bot has these permissions in that channel

if not Channel.permissions_for(interaction.guild.me).attach_files or Channel.permissions_for(interaction.guild.me).embed_links or Channel.permissions_for(interaction.guild.me).send_messages or Channel.permissions_for(interaction.guild.me).view_channel:
pale vessel
#

does it work like that?

#

isn't it if not x or not x or not x?

#

Or use parentheses

dry imp
slender thistle
#

What's Channel

pale vessel
#

Channel = discord.Channel

quartz kindle
slender wagon
#

what's the easiest way from json to mongodb atlas

cinder patio
#

what do you mean by "do json"

fiery stream
lyric mountain
#

migrate from jsondb to mongo maybe?

dry imp
#

jsondb

signal estuary
#

How can I embed a link in the bot description? (md)

boreal iron
#

If markdown links don’t work, then you can’t

severe perch
slender wagon
#

it contains the _id and everything else

#

i don't wanna do it manually as there is a bunch of those files

#

like 15

neat ingot
#

if the json is formatted to be converted to mongodb without issue, why do you have an issue?

earnest phoenix
slender wagon
#

that's the issue

earnest phoenix
slender wagon
#

seems just abt right

#

ty lmao

neat ingot
slender wagon
#

can compass connect me to the atlas

#

cuz atlas is what i use atm

earnest phoenix
#

yep

neat ingot
#

i think so. never used atlas myself as i always run my db in a container but it should be fine as atlas is official mongo too

lyric mountain
boreal iron
cinder patio
#

erotica

lyric mountain
#

code913 is horni

wheat mesa
#

The only code that makes me horni is C++ that doesn’t cause memory leaks and doesn’t crash with SEGFAULT

boreal iron
#

that’s why you use Java pandasad

lyric mountain
#

wait what? fake recommending java?

#

never thought this day would come

boreal iron
#

Wtf

wheat mesa
#

There exists a reality where fake is a Java developer working for oracle

lyric mountain
#

they grow so quickly 〒▽〒

boreal iron
#

How did that sound like I would recommend it?

#

There’s no sentence I ever sent without sarcasm included

lyric mountain
#

The only code that makes me horni is C++ that doesn’t cause memory leaks and doesn’t crash with SEGFAULT

that’s why you use Java pandasad