#development

1 messages · Page 1918 of 1

quartz kindle
#

open it once and pass the handle

boreal iron
#

That can’t work since you need to go back 2 folders

#

Nah that wasn’t I was speaking about

#

Meant the path ../

#

../../

#

Oh I see your DM

#

Well got push notifications disabled

#

You better ping me here, won’t get a notification but will most likely take a look into this chat more often

#

I’m still driving oldEyes

lyric mountain
#

Fake is always driving

boreal iron
#

Nah actually I’m not

#

It’s just the same time every day

#

When most people in here are online

#

Terrible idea as I usually don’t remember any virtual shit due lot of stress in the real world

#

Just throw your question in

#

There are more trolls in here not just me

lyric mountain
boreal iron
#

But be careful…
There are weird people in this channel.
Watch out for a dude called something like, Kuhakuwakabubku

#

He’s using … Java, yes Java!1!
Absolutely disturbing but it is how it is

#

And I heard he eats children

quartz kindle
#

also be careful of brazilians, they come from huehuehueland

#

and you'll never know you're talking to one

boreal iron
#

Soon my new cores and NVME drives will be shipped if I don’t get scammed on eBay

#

One just ends up as database drive lol

errant perch
#

is there any better than than doing .catch for all promies?

pale vessel
errant perch
#

is it a good idea to do that to interaction.channel.send() functions to prevent permission errors?

pale vessel
#

You should, but the main thing you should be doing is to check for permission (with overwrites in mind)

#

If you check that, then it'll less likely to error (but not impossible)

pale vessel
#

Unless you don't cache channels/permission overwrites then I guess you can only try to send the message

#

If so catching it would be enough

errant perch
#

ok

distant cobalt
#
client.on('voiceStateUpdate', (oldMember, newMember) => {
    let newUserChannel = newMember.voiceChannel
    let oldUserChannel = oldMember.voiceChannel

    newMember.send("welcome to vc")
})``` no error. it doesn't send anything either. I want it to send a message to a user when thye join a vc
lyric mountain
#

Do u have guild_presences intent?

high crown
#

He is trying to send in DM

#

Its ok

high crown
cobalt junco
green kestrel
#

burn the heathen! lol

modest maple
#

🍞

glacial vapor
#

yea thanks just got done cleaning it up smile_frog

modest maple
#

pithink what was wrong with q map?

green kestrel
#

oh god my eyes

glacial vapor
vivid fulcrum
#

also

#

here's a tip for performance

#

data that's static like that should be created outside of the function

#

that way you're not re-creating it on every call

green kestrel
#

glad you tidied it up, looks much nicer!

earnest phoenix
#

some unity questions:

  1. what does using do in C#
  2. visual studio community or visual studio code?
  3. what extensions are great for working with unity
#
  1. is it a great idea to make a game when you don't even know how to do hello world
#

what are those funny words magic weeb

#

oh

#

well it imports everything to global

with (require("smth")) {
  // entire rest of code
}
glacial vapor
vivid fulcrum
#

also

#

one thing to note is that unity c# is much different than .net c#

earnest phoenix
#

is that a good thing or a bad thing that everything is top level

earnest phoenix
glacial vapor
#

i use unity

green kestrel
#

its oogly

#

unity is a bit of a meme tbh

earnest phoenix
#

you have a .net lib for discord right

glacial vapor
#

now im thinking between school work or game development?

green kestrel
#

thats not a bad thing

#

and rust? never seen a rust game engine

glacial vapor
green kestrel
#

if you ask real game devs they dont want a language that holds your hands 😄

earnest phoenix
#

forgor to save my code before turning off my pc

green kestrel
#

unreal engine is where its at

earnest phoenix
earnest phoenix
#

script error

green kestrel
#

https://community.amethyst.rs/t/games-made-with-amethyst/134
only some crappy 2d games made with it?

earnest phoenix
#

and I thought smth's corrupt

#

respond to it

green kestrel
#

respond to interaction

#

btw you can respond with 'thinking' then delete the response

earnest phoenix
#

does editing your followup count as responding

hybrid cargo
#

You still have to acknowledge the interaction and then remove the button

#

Acknowledging the interaction is not sending a message

earnest phoenix
#

delete your old response and create a new one ig

boreal iron
#

We had that discussion a few days ago.

#

You should probably edit the message with the exact same content.

#

Take a look above and below the message I linked

pale vessel
#

It's a ButtonInteraction

boreal iron
#

Yes, yes we did talk about a button interaction, too

tepid crane
#

Can someone help me with skip vote button (music bot) .
Language :- Js
Framework :- Node 16.3

jolly notch
glacial vapor
#

well i already had my own code but they wrote code how i can clean my code

jolly notch
#

you did a stackoverflow

hybrid cargo
glacial vapor
jolly notch
glacial vapor
#

now i have this

#

instead of the if else spam

pale vessel
#

if you don't need elo or level, you can make it cooler const [, rankings, embedColor] = ...

#

I told you :|

tepid crane
tepid crane
woeful pike
glacial vapor
woeful pike
#

I know I'm talking about the data structure

glacial vapor
#

yeah

#

i think its good for now xd

pale vessel
#

put the data outside the function too, like cry mentioned

glacial vapor
#

it needs to get data from api when the command is run

#

and make the embed using the data it takes from api

#

it reads ELO from the Api to get the right image and color for the embed and rest of the stats also come from the api

#

how am i gonna put it in different file

pale vessel
#

not literally that data

#

rankTuples and levelTuples

rose warren
#

Thoughts about storing bot prefixes in cache as well as in the db? Basically instead of hitting the db to check for prefixes on every command call, when the bot starts it would add all the set prefixes that are stored in the db to a collection (js) attached to the client. That way the bot will query the collection instead of the db. I'm just trying to make my code as efficient as possible and trying to keep db queries at a minimum. Obviously when a user sets or changes the bot prefix it would update in the collection and the db.

#

(slash commands are not a solution here)

jolly notch
#

Do everything in cache unless it needs the db(then update the db if it needs it)

#

You could use DAO and have it reference the cache from there so you don't have to do it within each function

wheat mesa
#

Pretty easy to implement

rose warren
#

Yep yep 100%. I'm just re-writing everything to make it more efficient and cleaner

#

I'll probably implement it. I was just wondering if anyone saw any downsides.

spark flint
#

i store prefixes with json KEKW

wheat mesa
#

Using json as a db is not what it was intended for

hybrid cargo
spark flint
#

i only use the json for the prefixes

#

i feel like screaming after using json for a levelling bot

wheat mesa
#

Especially considering writing to a json is not thread safe if done improperly iirc

spark flint
#

the amount of times the json didn't save properly and levels were achieved multiple times

rose warren
#

I've moved from Mysql to Postgres and I'm liking it a lot.

spark flint
#

i moved from json to mysql and i'm so glad i did

wheat mesa
#

Postgres is a life saver compared to sql

#

I was told early on by some C# folks to stay away for MySQL

#

Very glad they told me that

rose warren
#

I was just used to mysql because of web dev

hybrid cargo
spark flint
#

storing 2.1k lines in a json file is shit for finding information

hybrid cargo
spark flint
#

oh in computer science they are teaching us how to use csv for storing and i want to shoot myself

wheat mesa
#

Yeah because that’s not the intended use case of json

#

Json isn’t meant to be used as a db

rose warren
#

discord-db ftw

wheat mesa
#

Lmao

spark flint
#

replitdb is the best ofcourse

#

repldb is practically the same as json

hybrid cargo
# rose warren discord-db ftw

Tbh when i was like a beginner and did not implement mongo, I used a message sent by the bot as the db to store prefix and log channel IDs in my custom server bot. I made a channel and made sure no one else would see it and made the bot send a message which is a json message inside a code block. And i used that as the db 💀

#

So yeah discord-db exists

#

Atleast for me

spark flint
#

as long as you didn't do what i planned to do then ur fine

#

i was fully prepared to use Text files for blacklister

hybrid cargo
#

When prefix is updated, i get the message and then slice the code block back ticks, and then yeah JSON.parse() kekGasm

spark flint
#

and looking back now i'm so glad i was talked out of it

solemn latch
hybrid cargo
#

Hey woob

spark flint
#

imagine a 2.1k line long text file stored in the format
471409054594498561,stinky

rose warren
hybrid cargo
rose warren
solemn latch
#

Pretty confident that's against discord tos

hybrid cargo
rose warren
#

Mhmm

spark flint
hybrid cargo
#

wait wait wait wait

#

What thee

#

DUDE

#

WHO IS MAINTAINING IT

#

WHERE TF ARE THE DATA STORED?

#

WHICH GUILD?

rose warren
#

Nobody

spark flint
#

a bot prebuild

hybrid cargo
hybrid cargo
#

Imma create a npm package which is a whole bot too, and the user just needs to create a .js file

const bot = require('bot')
bot(token)
```Ez, how to create a bot in under 10 seconds
spark flint
#

Lmao

solemn latch
#

More clones 😠

hybrid cargo
hollow tundra
#

How can I restrict this 👇 command only for user who didn't vote and also this command should response only for user who is voted. In discord.py?

async def meme(ctx):
    embed = discord.Embed(title="Memey Meme", description="")

    async with aiohttp.ClientSession() as cs:
        async with cs.get('https://www.reddit.com/r/memes/.json?sort=hot') as r:
            res = await r.json()
            embed.set_image(url=res['data']['children'] [random.randint(0, 25)]['data']['url'])
            await ctx.send(embed=embed)
wheat mesa
#

Shit host/bugged shard

#

I had a problem with my bot where it had like 3-4k ping for no reason and it was fixed by restarting

lyric mountain
#

I'm more worried about that 356ms DB ping

#

how?

native walrus
#

mongodb atlas probably

lyric mountain
#

it's worse than I imagined

hushed estuary
#

hey guys

#

for first time i made a bot my self

#

to basic commands but

cinder patio
#

Is github down 😳

hushed estuary
#

i am happy

#

made a bot for first time

earnest phoenix
earnest phoenix
hushed estuary
#

eh

lyric mountain
#

library

hushed estuary
#

i am new to discord bot coding

#

i am using

#

node.js

#

replit

lyric mountain
#

discord.js then I guess

hushed estuary
#

this

lyric mountain
#

did u write it by yourself?

hushed estuary
#

you can eave after joining

#

eh

lyric mountain
#

u cant sent invites

hushed estuary
#

oh

hushed estuary
#

i am learning to make

#

i made one but it is basic

#

like auto reply only

#

for now

#

i am learning to add commands

lyric mountain
#

if u didn't copy from some tutorial then kudos for u

#

that's already a great thing to practice

hushed estuary
#

i am learning from

#

learning from this currently

lyric mountain
#

great

#

ah just a note btw

#

don't start on v12

#

it's already deprecated since v13 release

woeful terrace
#

True

lyric mountain
#

btw dan, u can use markdown to shorten urls on bio

woeful terrace
#

Ik

#

But

#

No need

#

Maybe later

#

Ty

flat copper
hybrid cargo
#

It's gonna appear just the same as how it would appear on a normal text

tiny jacinth
#

ayy

urban moon
#

anyone here using brave and connected it to gemini?
kindly respond
I have a quick Question

hybrid cargo
#

Just ask your question and anyone who is using brave would respond

urban moon
earnest phoenix
#

use uphold

urban moon
earnest phoenix
#

whats the problem here

lyric mountain
#

problem is you barely showed anything nor give any info

earnest phoenix
#

but the command wont work

#

i guess its the author part where it still scans it but dosent reply

lyric mountain
#

again, I can't help u without a better context or more than 3 lines to work with

#

what command did u try?

#

what's the rest of the code?

earnest phoenix
lyric mountain
#

oh my, those if chains

earnest phoenix
#

yeah

lyric mountain
#

but well, show the command u tried

earnest phoenix
#

on discord

lyric mountain
#

yes

earnest phoenix
#

my other bots works fine

lyric mountain
#

put console.log("This works") right above that if chain

#

tell me if it appears on the console

earnest phoenix
#

should i delete the previous one

#

shows me this

lyric mountain
#

put it above this line

earnest phoenix
earnest phoenix
lyric mountain
#

yes

#

now run the bot and use any command

#

and for future reference, either extract command name + switch or make a proper command handler

earnest phoenix
lyric mountain
#

did u use a command?

lyric mountain
#

btw: invalid command message = bad, like really bad, so bad cthulhu would fear you

#

don't do it, it causes massive spam

tribal crow
#

Hey! In djs v13, how would i send an interaction to a specific channel? I have tried to cache the channel etc. and then channel.send({ embeds: [embed] });, but it doesnt seem to work.

lyric mountain
earnest phoenix
#

like my bot

#

wait ill try a activity code if it works

lyric mountain
#

use messageCreate

#

the docs say message is deprecated

earnest phoenix
#

oh

lyric mountain
feral aspen
#

What are those, I don't seem to understand them?

lyric mountain
#

you mean "send message"?

tribal crow
#

yes

earnest phoenix
#

activity stats works

lyric mountain
#

if so, fetch the channel then send it

tribal crow
#

fetch?

lyric mountain
lyric mountain
feral aspen
tribal crow
#

and how do i use it?

#

wai

#

t

earnest phoenix
tribal crow
#

HOLY

#

i know what i did wrong

lyric mountain
#

before prefix check

lyric mountain
#

no

earnest phoenix
lyric mountain
#

inside client.on("message" event

#

not inside ready event

earnest phoenix
lyric mountain
#

yes, above prefix check

earnest phoenix
spark flint
#

you just leaked it

lyric mountain
#

ye, there's that now

#

start the bot and say anything, see if "This works" appears on the console

#

that after you reset ur token

earnest phoenix
lyric mountain
#

change message to messageCreate

earnest phoenix
#

ight

#

duplicated Kek

#

welp ill just trash it and re code

lyric mountain
#

so, it didn't work?

earnest phoenix
#

yeah

lyric mountain
#

...yeah "it worked" or yeah "it didn't"?

earnest phoenix
#

it became online but commands just dont work

lyric mountain
#

what abt the console? did it appear there?

earnest phoenix
#

What djs v you are using ?

earnest phoenix
lyric mountain
#

well, idk then, check your intents

earnest phoenix
#

it got stuck

feral aspen
#

I have never seen this regex before.

earnest phoenix
lyric mountain
willow mirage
#

regex is like spain without the "s" :<

spark flint
#

pls help

willow mirage
#

the "tasks"doesnt exist?

spark flint
#

it does

#

i use it on my other bot

lament rock
#

might be a difference in versions used

spark flint
#

ah alr

marble juniper
#

cute gif ngl

pale vessel
#

MANAGE_CHANNELS

slender wagon
#

guys is there a quick way to handle errors with modals on express?

wheat mesa
#

Yeah

#

if(goingToCrash) {
dont();
}

slender wagon
#

funi

lament rock
#

The solution is to make your code in such a way that you don't produce any errors in the first place

#

or just enjoy the peace and quiet of

process.on("unhandledRejection", () => void 0);
process.on("uncaughtException", () => void 0);
sterile lantern
#

i think its the awaitMessages part most likelyyy

#

nvm imjust dumb

inland kayak
#

helllooo

#

can anyone help me w smn in java

wheat mesa
boreal iron
#

Java oldEyes

inland kayak
#

if no ones gives a f why do all that 🤠

wheat mesa
#

If someone said yes they would indirectly be saying “I am willing to spend any amount of time helping you with your problem that I may or may not know the solution to”

inland kayak
#

hmm

#

good point

wheat mesa
#

It’s better to explain the problem rather than be lazy and let the rest of us suffer :p

inland kayak
#

but would take about 30-45 mins id hope, its supposed to be basic java coding (i just dont know what im doing) have to use an
if/else statement
switch statement
default constructor
and has to run successfuly

assignment is to prompt users to enter year, make, model, mileage, condition

then depending on that info it would lower or raise the price of said "car"

inland kayak
wheat mesa
#

That’s a good start yes

inland kayak
#

yeet

wheat mesa
#

What have you tried so far

#

Since I don’t want to spoonfeed code to you if you’re not sure what it does

sterile lantern
#

await interaction.channel.send({ content: ({ embeds: [q2] }), ephemeral: true });

is it not possible to have an embed as ephemeral, bc this isnt working?

wheat mesa
#

Cus that’s the point of the assignment

wheat mesa
sterile lantern
#

Oh yeahh true mb

#

Ty

inland kayak
#

so far

wheat mesa
#

Online classes are difficult to learn from I admit

inland kayak
#

yes and my dumbass cant pay attention for shit its so hard

wheat mesa
#

So I assume it wants you to create a Car class of some sort?

sterile lantern
#
                                        ^

RangeError [MESSAGE_CONTENT_TYPE]: Message content must be a non-empty string.```

doesnt work, assuming i messed up something syntax wise
wheat mesa
#

(Code)

slender wagon
#
DiscordUser.findOneAndUpdate({ discordId: receiver }, { $inc: { credits: credits } }, { new: true }, (err, doc) => {

how can i check if the receiver exists before increasing it's credits L

sterile lantern
#
runInteraction: async (client, interaction, args) => {
   const code = args[0].toUpperCase()
const loareq = await tickets.findOne({ "LOACode": code })
     if(loareq === null) { 
  return interaction.reply("Code does not exist in database. This is probably because you tried to end your LOA request that was already ended.")
}
if(loareq.UserID !== interaction.user.id) {
return interaction.reply("Nice try, you can't end someone else's LOA request. Provide your **own** LOA request code.")
}
else {
 

const q2 = new Discord.MessageEmbed()
.setTitle("Prompt: Confirmation")
.setDescription(`:warning: Are you **sure** you wish to end this LOA request? This action is **irreversible** and will cause the LOA request to be removed from the database. To continue, respond with **yes**, otherwise respond with **no**.`)
.setColor("RED")
.setFooter("To cancel this prompt, respond with cancel.")
let DM = await interaction.reply({ content: ({ embeds: [q2] }), ephemeral: true });
let sure = await DM.channel.awaitMessages(m => m.author.id === interaction.user.id, {
            max: 1,
            time: 120000
        })```
inland kayak
#

`import java.util.Scanner;

public class car_shop {
public static void main(String[] args) {
Scanner inputData = new Scanner(System.in);

    System.out.println("Enter mileage: ");
    Integer mileage = inputData.nextInt();

    System.out.println("Enter car condition: " + "\n" + "Excellent" + "\n" + "Fair" + "\n" + "Poor" + "\n");
    String carCondition = inputData.nextLine();
}

}`

#

all i have so far

#

and

#

like i think im making it more complicated than it has to be

#

so im hurtin my own brain

wheat mesa
#

Okay that’s pretty good so far, you should be using the int primitive type instead of the Integer class however

inland kayak
#

whats the diff

#

whats the dif in use and dif visually

sterile lantern
#

I'm trying to make it so the bot does replies with awaitMessages w/ slash cmds, would that work Thonk

wheat mesa
#

Integer is a class (as a wrapper for methods for ints), whereas int is a primitive type

inland kayak
#

hmm okay

#

so what would i change

wheat mesa
#

As per Java name standards, anything you see starting with capital letter is usually a class (with a few exceptions)

#

Let me get on my pc and I’ll help some more rq

inland kayak
#

cuz the stuff u enter here is supposed to affect the price of the car (starting at 10k) so like if i put a year oler than five years it would make the price of the car go down

#

and then at the end its supposed to give you an estimated price of ur car based on the info of ur inputted info

inland kayak
inland kayak
#

only have an hour left i be stressin and basically cryin atm

wheat mesa
#

I’ve got some homework to do of my own for a bit, if you need help quick then someone at https://discord.gg/java could probably help

inland kayak
#

wafffleeee i thought u were gonna save me

#

okay il try that ty

wheat mesa
#

Sorry 😞

slender wagon
#

imagine hoping waffle is gon help u

wheat mesa
#

Got lots of homework due soon too lol

inland kayak
wheat mesa
#

Sorry man topggPensive

#

I just got home from school and I’ve got like 5+ hours of homework due at midnight

#

Those people in the Java server are really helpful though, just ask in one of the unreserved channels and they’ll help you pretty quick

inland kayak
#

is okayy

#

ur good bro

#

ty for ur help

hybrid cargo
#

And I think if that's the case, u should remove new

slender wagon
#

If it doesnt exist

woeful pike
#

that's just a regular update with a try/catch

hybrid cargo
# slender wagon If it doesnt exist

Ohh, then u can .findOne() and if returns the db of a user do nothing, if it returns undefined then create a new collection

Idk any better or if there is another mongoose function which does this better tho

slender wagon
#

Yeah can't i put a function so if the query doesnt exist it throws a warning

woeful pike
#

don't do findOne + save

hybrid cargo
#

Ayo Xetera!!

#

Yeah he is better at mongoose everything

woeful pike
#

I don't use mongodb for anything so I don't really know

hybrid cargo
#

Oh welp .. f

slender wagon
woeful pike
#

normally you'd do a sql query and attach a returning * at the end of it to see what you updated or found shrug

#

life is always harder when ur using a bad database pensivecowboy

slender wagon
#

Hhh ima do more research tomorrow

hybrid cargo
#

Well his requirement is, if the user's db already exists he doesn't want to create or update. He wants to do nothing

Only if the user doesn't have a db collection, he wants to create

slender wagon
#

No

#

The opposite

#

I want to add credits only to users who have an account

#

So basically this is a donation system

hybrid cargo
#

Ohh

slender wagon
#

It removes from ur account and it sends it to the other

woeful pike
#

wait what

slender wagon
#

But if it doesnt find the user it still proceeds to remove the credits from the donator

woeful pike
#

are you creating documents or collections

slender wagon
#

Its a collection called users with each user

#

Listed

#

I just wanna check if discord.Id exists on the users collection and if not then i want it to throw a warning and quit or whatever

#

Get it?

woeful pike
#

you're trying to transfer credits from one user to another no?

#

or whatever your currency is

slender wagon
#

Not really transferr i just remove from the donator the amount he is donating

woeful pike
#

and give it to the other person?

slender wagon
#

Yup

woeful pike
#

so...... a transfer

slender wagon
#

Yeah but is like manual

#

Its not like only 1 function

#

But yeah basically a transfer

woeful pike
#

I mean you're using mongodb so making this process atomic is going to be impossible

#

you're going to have to do multiple calls

slender wagon
#

Yuh

#

Thats what i did

#

2 calls in this case

woeful pike
#

find target user, if not exists fail
find caller, remove x
find target, add x

slender wagon
#

So what goes wrong is that even if it doesnt find the user it still removes my flippong credits

woeful pike
#

what's the problem?

#

so just add an early return

slender wagon
#

Pretty sure tried that one

#

Will try again tomorrow got off my laptop CatSad

#

Thx

sterile lantern
#
 let DM = await message.author.send({ embeds:[q1] })
        let plannedtime = await DM.channel.awaitMessages(m => m.author.id === message.author.id, {
            max: 1,
            time: 10000,
            errors: ['time']
        })```

Why isn't awaitMessages working?
#

d.js v13 ^^

#

Ah wait nvmI think it was renamed lemme try

#

Twas not renamed

cobalt junco
sterile lantern
#

Got it ty

sterile lantern
#
 let DM = await message.author.send({ embeds: [q1] })
        let plannedtime = await DM.channel.awaitMessages({ filter, max: 1, time: 180000
        })
        console.log(plannedtime.first())
        if (!plannedtime.size) {
            return message.author.send({ embeds: [timeout] });
        }
        if (plannedtime.first().content.toLowerCase() == "cancel") {
            return message.author.send("Prompt cancelled!")
        }
        let DM1 = await message.author.send({ embeds: [timeout] })
        let reason = await DM1.channel.awaitMessages({
            filter: m => m.author.id === message.author.id, 
            max: 1,
            time: 180000
        })
        if (!reason.size) {
            return message.author.send({ embeds: [timeout] });
        }

        if (reason.first().content.toLowerCase() == "cancel") {
            return message.author.send("Prompt cancelled!")
        }```
#

After it collects first msg, it goes to next embed

#

But for some reason it's not picking up the message

#

Cuz console.logging the first() of the response is undefined

#

Like it just sends the error embed after the 180 seconds

viral plover
#

Hello.
I updated my discord.js to v13 and haven't been able to get my bot to successfully change channel perms. When running the line of code below, it says that it is not a function despite copying the documentation so I'm out of ideas.

      message.channel.permissionOverwrites.edit(message.author, {SEND_MESSAGES: false});
cobalt junco
hybrid cargo
#

Get the message, it should have a property called embeds

sterile lantern
#

Wait actually maybe not one sec

hybrid cargo
#

.content is the normal message, it would be inside .embeds

sterile lantern
#

Ah yeah it was for my other bot, ty

hybrid cargo
#

yes is already .content

sterile lantern
#

That makes a lot more sense

hybrid cargo
#

Remove .content after u fetch, or replace it with .embeds

#

Also I'm not sure what .fetch() returns, cuz I ain't used with djs. If it returns a promise, u gotta await it

boreal iron
#

fetch returns a promise

#

Means you have to await it before accessing the content property

#

Or wrap whatever you wanna do in a then() clause

woeful pike
#

would've caught it if you were using typescript

boreal iron
#

Eww okeh

woeful pike
boreal iron
#

they are everywhere

#

Well yeah you aren’t wrong but still… TS

woeful pike
#

don't understand what anyone has against ts

#

aside from it not being strict enough

boreal iron
#

Well it’s all about preferences tbh

woeful pike
#

i prefer to get runtime errors and bugs

viral plover
#

Does it need to be "yes" instead of yes?

solemn latch
#

nope

viral plover
#

Oh wait.

#

Nevermind. >.>

solemn latch
#

its because fetch is a promise

#

and its not being awaited

#

you are awaitng embeds

#

you need to () the promise to await it like that

boreal iron
#

You again didn’t await it or wrap the response in a then() clause

pale vessel
#

you can't access embeds from an instance of Promise

boreal iron
#

fetch(…).embeds will never exist

#

msg = await whatever.fetch(…)
msg.embeds

hybrid cargo
#

To get a property from a promise, u can use 3 diff ways to await the promise

const yes = (await message.channel.messages.fetch("901248000947544065")).embeds
const yes = await message.channel.messages.fetch("901248000947544065")
yes.embeds
let yes;
await message.channel.messages.fetch("901248000947544065").then(msg => {
  yes = msg.embeds;
})

Read the js docs on promises and you will understand what's happening

#

and yeah i literally spood fed dead

boreal iron
#

pepowot 🔫

hybrid cargo
solemn latch
#

Mods are otw 6764_angry_ducky

hybrid cargo
#

me appollogaise

boreal iron
#

Ok it’s okay this time!
You’ll just get a fine of $500.

#

Gonna send you my PayPal address to verify the payment of your fine

hybrid cargo
quartz kindle
#

that third option is an atrocity

hybrid cargo
quartz kindle
#

how about this one

hybrid cargo
quartz kindle
#
let yes;
await message.channel.messages.fetch("901248000947544065").then(msg => {
  throw msg;
}).catch(msg => {
  yes = msg;
})
#

:^)

hybrid cargo
#

My hopes were drowned

quartz kindle
#

cmon you know me better than that

hybrid cargo
#

lol

quartz kindle
#

i never miss the chance to troll

boreal iron
#

I smell another fine

#

$.$

hybrid cargo
#

😂

boreal iron
#

@quartz kindle after assembling my hardware for the server I think I should be ready to change stuff at the weekend which will lead to a few new cloud servers

#

Means I’m gonna play around with load balancer a little and will report back

quartz kindle
#

nice

hybrid cargo
boreal iron
#

My eyes

lament rock
#

I hate this so fucking much

hybrid cargo
#

Yander Dev FTW

lament rock
#

I actually consider blocking

boreal iron
#

lmao

hybrid cargo
lament rock
#

📉

hybrid cargo
#

💀

lament rock
#

give me back my #testing-1

quartz kindle
#

i raise you ```js
let yes;
try {
await promise.then(msg => { throw msg; }).catch(msg => { throw msg; })
} catch(msg) {
yes = msg;
}

lament rock
#

I mean

#

it works

hybrid cargo
#

There

quartz kindle
#

xD

boreal iron
#

I better don’t ask why

hybrid cargo
#

I love the await promise.then()

boreal iron
#

Was there something specific you wanna know about the LBs, Tim?

quartz kindle
#
const events = require("events");
const emitter = new events.EventEmitter();

try {
  await promise.then(msg => { throw msg; }).catch(msg => { throw msg; })
} catch(msg) {
  emitter.emit("error", msg);
}

process.on("uncaughtException", msg => {
  const yes = msg;
})
hybrid cargo
lament rock
#

its better to await a chain than to have 1 await per Promise

hybrid cargo
#

Time to improve my code more

#

Thanks to Tim

quartz kindle
#

:^)

hybrid cargo
#

Lemme actually pull up vsc

#

This is some next level shit

boreal iron
quartz kindle
#

but like

boreal iron
#

If one is down?

quartz kindle
#

what i had in mind was DNS level reduncancy

#

in case an entire provider is down

#

for example like it happen in the DO fire thing

#

or whatever it was

boreal iron
quartz kindle
#

ye

lament rock
#

just use 1.

quartz kindle
#

how does a load balancer provide reduncancy if the load balancer itself is down?

#

at least DNS is distributed

#

pitty that A records dont support the same stuff as SRV records

copper jetty
#

Yo I started making a bot named Alice. So her prefix is set as ''Alice, ''. However since commands can only be one word I had to do a ''if message.content.startswith(Alice, can you do x?)'' thingie for longer commands.
BUT when I run the command I get an error saying ''Ignoring exception in command None:
discord.ext.commands.errors.CommandNotFound: Command "say," is not found''.
So I understand it mixes up the ''Alice, '' from the command and the Alice prefix but like;;;; is there a way to fix this?
Or do I have to go through another method than the ''if message.content.startswith()'' one? Is there a way to bypass the one word command rule? TT

boreal iron
lament rock
boreal iron
#

Thats probably the best way to get high redundancy

lament rock
#

commands are usually just 1 continuous string because arguments are a thing

quartz kindle
#

but that still doesnt help if the ip address that the A record points to goes down

boreal iron
#

I haven’t, the NS records of each zone are my 3 DNS servers.
If one server is down, round robin automatically redirects you to another DNS server for the 2nd request.
If a hostname can’t be resolved due an outage, both other NS records being contacted to answer the request.

#

No matter multiple hostnames can’t be resolved or 2/3 DNS servers are down, the system still answers your request

#

Probably with a few 100ms delay due the request timeouts

copper jetty
lament rock
#

100ms probably is enough for most cases, but under heavy load 📉

#

You should have a basic understanding of data structures and language features and problem solving

boreal iron
quartz kindle
#

my NS servers are the default ones from my domain provider (porkbun), not too concerned about outages there, more concerned about outages in the IP the A records point to

lament rock
#

Yeah. That too

hybrid cargo
#

@quartz kindle this is the most efficient code that I could make4 with all the improvements you suggested. Anymore changes?

lament rock
#

delete nodejs

hybrid cargo
#

💀

quartz kindle
#

lmao

#

did you test it?

hybrid cargo
#

no

#

But im sure it should work,

quartz kindle
#

lmao

hybrid cargo
#

Cuz we made it bug free

quartz kindle
#

well promise is undefined

copper jetty
#

All the command handlers tutorials I find are in JS TT

#

gah

quartz kindle
#

oh it isnt

#

im blind

hybrid cargo
#

AH SHIT

#

YES

#

I missed it

#

Oof a bug

#

Oh wait

#

no

lament rock
#

it really be like that

hybrid cargo
#

Actually

#

there

quartz kindle
copper jetty
#

ooohh so it is possible in Python?

#

Alright thanks!! I'll look better into it

quartz kindle
#

everything is possible

#

just most people who use discord.py use its built in command handler, so there is less community discussions around making custom command handlers

lament rock
#

manually memory management in JS when?

quartz kindle
#

done

lament rock
#

True

lament rock
#

DisBuf.js coming right up

quartz kindle
#

lmao

boreal iron
quartz kindle
#

i have a half finished half abandoned buffer project

#

js buffers cant be resized like c++ buffers can, so its a major pain

lament rock
#

time to fuck with the built in net lib

quartz kindle
quartz kindle
#

so what if the vps that hosts that ip address goes down

boreal iron
#

Oops

quartz kindle
#

thats what im talking about

#

the DNS still works

#

it still sends people to that IP

boreal iron
#

If the target is down?

quartz kindle
#

yes

boreal iron
#

Oh that’s actually tricky since there’s no real solution for redundancy with A records

quartz kindle
boreal iron
#

SRV records aren’t supported for what you do?

quartz kindle
#

no idea

#

do they support https?

boreal iron
#

Orrr that’s not what I mean but they support weight and priorities for DNS records

#

Which means you can set up multiple target for the same hostname

quartz kindle
#

the ideal solution would be that A records support priorities like SRV records do

#

which is unfortunately not the case

boreal iron
#

But if you’re concerned about the target being down… is there actually a redundancy there? I mean your target

#

2 targets are running with different IPs but the same content?

quartz kindle
#

yes

#

i mean

#

hypothetically

#

none of this is real

boreal iron
#

I mean if your target has no redundancy then trying to create one for the DNS is nonsense

quartz kindle
#

yes but whatever redundancy the target can provide is useless if the entire provider goes down like in a datacenter fire

boreal iron
#

But what you would need to do to get rid of DNS timeouts if one target is down is using a failover IP in your case

#

Consistent monitoring and a failover IP getting in place if one target is down

quartz kindle
#

that would require an API to live patch the DNS records right?

boreal iron
#

Yes and no.

1 way is to change the DNS record, yes with a very small TTL, making it live if a target fails

No if a providers provides a way to activate the failover IP in any way like Hetzners robot API

quartz kindle
#

so you would transfer that IP to a different machine?

boreal iron
#

Yes it’s simply said the same DNS record change on the provider level

#

Active within seconds

quartz kindle
#

but that wouldnt work if the entire provider goes down in a fire

#

anyhow, this is getting too much into trying to fix by myself something the providers are designed to fix instead

boreal iron
#

Well you don’t have to setup your own DNS infrastructure like I do

#

You can use a DNS service for this

quartz kindle
#

tbh i dont actually need any of this

boreal iron
#

Which lets you specify the TTL of the records (and zone record)

quartz kindle
#

just exploring the possibilities due to being paranoid of my service possibly going down

boreal iron
#

You can also pay 99,99€ to me to use my infrastructure and my DNS API

quartz kindle
#

xD

boreal iron
#

_Per month _

quartz kindle
#

basically the API that im building is meant to power third party apps and services, so its gonna be a business to business mostly, and i really dont wanna screw it up

#

if the api goes down, a lot of services go down with it, and things get ugly

#

even tho i have 0 clients right now, i have to be prepared the best i can

boreal iron
#

brb 2 min

quartz kindle
#

i g2g too

#

time for bed

boreal iron
#

Cya

#

I had two 2 major outages so far.
One caused by Hetzner network being down in 2018 and one when they changed their DNS and servers.

Learned from both by deploying multiple DNS servers to multiple providers and 3 domains to 3 providers.

Just costs 3 DNS servers (small cloud servers) and 3 domains per year.
And the cloud servers are scalable seamlessly ofc.

boreal iron
#

When cloudfare was down a while ago and with it 50% of the internet, my services were up

#

Even if 1/3 domains were technically down

boreal iron
#

Oops ping okeh

quartz kindle
#

im starting with a single hetzner cpx11, the one i got recently

#

i was going with a single core before, at least now i have 2 cores, so better concurrency at least

boreal iron
#

Yeah

quartz kindle
#

when the time comes, if i get in trouble, i'll hire someone to do some network engineering for me then

boreal iron
#

Scaling up shouldn’t be too difficult if you’re already prepared in the backend

#

Or that one, yeah

simple stump
#

How does the Discord cache work? I have two commands I set up for testing (cget and cremove which removes and gets the user from the cache) since I've had issues with retrieving users via the cache if they aren't cached, but when removing the user and then immediately getting them, cget works perfectly fine. The methods I used were message.client.users.cache.delete(mention.id); and message.client.users.cache.get(mention.id);.

quartz kindle
#

mentions are automatically cached

#

discord sends the mentioned user data with the message

simple stump
#

ah. alright thx

quartz kindle
#

try using only an ID

#

it will work correctly then

boreal iron
#

Generally said if you got trouble getting users which aren’t cached, then fetch them

simple stump
boreal iron
#

Using fetch in general is the way to go if you need the user object

quartz kindle
#

or just implement all collection and manager methods as commands :^)

boreal iron
#

Since it checks the cache first

simple stump
quartz kindle
#

cget cfetch cremove chas

#

xD

boreal iron
boreal iron
quartz kindle
#

cclear

#

ccleaner

boreal iron
#

:P

#

gn

quartz kindle
#

cdestroy

#

gn

simple stump
#

Is an user automatically cached if they join a VC?

earnest phoenix
#

can we use on_guild_join event just once in python ?

slender thistle
#

a?

#

What do you mean?

still sky
#

Mb analog .once() from js

slender thistle
#

There's no such thing in d.py

pale vessel
#

Just slap a boolean and set it to true after it triggers once and return next time

earnest phoenix
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: can only concatenate str (not "NoneType") to str

onyx torrent
#

Where is it raised?

earnest phoenix
#

ban command

onyx torrent
#

provide the snippet

#

If you know exactly which lines cause this

earnest phoenix
#

def check(reaction, user):
return user == ctx.author and str(reaction.emoji) in [":tick:"] and reaction.message == msg
confirmation = await client.wait_for("reaction_add", check=check)

#

maybe this

#

@onyx torrent

onyx torrent
#

I can't help

earnest phoenix
#

hm ok

#

: (

earnest phoenix
#

idk why not working now

onyx torrent
earnest phoenix
#

how do i costumiz my website so i make a look for mobile?

pale vessel
#

Use CSS media queries

earnest phoenix
#

how?

pale vessel
#

How did you make your website?

earnest phoenix
#

i coded it

#

but idk how to code much

#

@pale vessel can u give a code example

earnest phoenix
radiant kraken
#

no

earnest phoenix
#

why?

earnest phoenix
pale vessel
#

He has the skill issue

earnest phoenix
earnest phoenix
earnest phoenix
#

can u give me a code example

earnest phoenix
radiant kraken
#

idk frontend

radiant kraken
#

do you have the proper intents?

earnest phoenix
#

guyssss

#

how do i costumiz my website so i make a look for mobile?

earnest phoenix
#

it is raising when member have dm closed

earnest phoenix
#

its not processing other part as member have dms closed

#

@radiant kraken

radiant kraken
#

oh okay

earnest phoenix
#

and process other part

#

@radiant kraken

#

: (

radiant kraken
#

add a check if the reaction.emoji is not None before the str(reaction.emoji) check in the function

earnest phoenix
#

ok

earnest phoenix
#

and i want to ignore that and process other part

radiant kraken
#

i doubt there is a flag if a member's dm is closed, you can check if discord.Member.dm_channel is None and calling discord.Member.create_dm() fails

long lagoon
#

Ummm! Can someone tell me How to Design Bot Page on top.gg also help with the vote command

hybrid cargo
#

Just add a try catch

pale vessel
#

try except

earnest phoenix
#

how do i costumiz my website so i make a look for mobile?

small tangle
#

how often do you plan to send the exact same sentence? 👀

hybrid cargo
#

There are lots of resources on the internet

earnest phoenix
#

ok ty lol

spark flint
#

and put that snippit at the top

earnest phoenix
#

yea ty

spark flint
#

np

earnest phoenix
spark flint
#

yep

earnest phoenix
#

how to move files on mobile

earnest phoenix
#

@spark flint

spark flint
#

not on mobile

#

try dragging out tho

#

literally drag out of the folder

#

??

#

stop ghost pinging me

earnest phoenix
#

sorry

#

my bad

spark flint
#

and no need to ping after replies - i get pinged anyways

earnest phoenix
#

that ezz????????

spark flint
#

yeah

#

should be

earnest phoenix
#

leme try

spark flint
#

if not then just don't use replit on mobile??

#

its not really designed for mobile

earnest phoenix
#

yeah lol

#

anyidea

spark flint
#

why would you want to not have it on the root domain?

#

instead of redirecting

earnest phoenix
#

cuz i mad folders and i dont want to main (aka root) i want to the folder

earnest phoenix
spark flint
#

What are you using for the site

earnest phoenix
spark flint
#

Just HTML, or express.js/flask etc

earnest phoenix
#

ah just html

spark flint
#

<meta http-equiv="Refresh" content="0; url='https://mywebsite.com/Home'" />

earnest phoenix
#

ok thanks

#

how do i add a image

#

they dont have

#

tf

#

in the meta or embed or what ever u call it

#

like in there

#

show u dumy link

spark flint
#

Look up meta tags

earnest phoenix
royal herald
earnest phoenix
#

ty

earnest phoenix
#

what dise the keyword do?

#

@royal herald

#

imagine asking someone what smth does when they slapped you with the docs

earnest phoenix
boreal iron
#

My gosh…

#
<meta property="og:type" content="website">
<meta property="og:site_name" content="Website Name">
<meta property="og:title" content="Title">
<meta property="og:description" content="This is an example">
<meta property="og:image" content="https://www.example.com/example.png">```
#

This channel doesn’t replace google, dude

earnest phoenix
#

pwease help me 🥺

boreal iron
earnest phoenix
boreal iron
earnest phoenix
onyx torrent
#

do we need intents to fetch audit logs?

#

in djs

earnest phoenix
#

you need role permissions

onyx torrent
#

Ok

pulsar roost
onyx torrent
earnest phoenix
pulsar roost
#

nope

#

you got it buddy

#

check the open graph link

#

it gives you everything

earnest phoenix
#

the what?

pulsar roost
#

and someone also sent it before me

earnest phoenix
#

the ogp did not work

nova axle
#

Hello I need Project Gif

lyric mountain
#

that's not how it works

small tangle
#

"one fully implemented bot to go please" peepoHappy

viscid plume
woeful pike
#

lol that description

viscid plume
earnest phoenix
#

yet another music bot

#

yet another cringe emoji

#

Pls help

#

I cant find the thing on my keyboard

#

fastColoredTextBox1.Text thething;

#

what the fuck is that

lyric mountain
#

needs more jpeg

earnest phoenix
#

HMMM

#

WIFI DEAD

wheat mesa
#

I don’t think we can help you seeing as this looks like a WPF cheat program

novel sapphire
#

How do i fix this?

boreal iron
#

Did you read the article?

earnest phoenix
#

read the article

novel sapphire
earnest phoenix
#

then you should understand it

boreal iron
#

What does the article say about the approval process?

novel sapphire
earnest phoenix
#

nw

novel sapphire
earnest phoenix
#

brs will take care of it

novel sapphire
#

Okay Thanks

earnest phoenix
#

yeah np

boreal iron
#

Topgg will invite it to it's verification center.

novel sapphire
sterile brook
#

spend 10 mins on gyp error while i had python 2.x.x

delicate zephyr
#
{
      content: `${this.category}`,
      components: [
        {
          type: 3,
          custom_id: 'test',
          options: [
            {
              label: 'test',
              value: 'test',
              description: 'test'
            }
          ],
          placeholder: 'Choose a category',
          min_values: 1,
          max_values: 1
        }
      ]
    }

can someone explain why this keeps return a 400 error

pale vessel
#

needs to be in an action row

delicate zephyr
#

huh?

pale vessel
#

the select menu needs to be inside an action row

delicate zephyr
pale vessel
#

all components should be in an action row

boreal iron
delicate zephyr
#

can you explain / give example

#

based on docs that should work?

pale vessel
#

Look for action row in components

delicate zephyr
#

Oh

#

I see

#

Im dense

#

completely skimmed over it

boreal iron
#

options:
[
action row:
{
options:
[…

pale vessel
#

components

delicate zephyr
#

yea

#

i see

#

so like this

#

didnt manage to see the docs

pale vessel
#

Array

delicate zephyr
#

lmfao

boreal iron
delicate zephyr
#

fixed

#

thanks @pale vessel hugguspoon

boreal iron
#

Nicely explained here:

simple stump
#

I’m trying to send a file, but I get the error that I can’t send an empty message. I’m 100% sure the file exists and checked and also tried using message.channel.send(“stuff”, { files: [“./dump-“ + id + “.txt”);, but that just sends “stuff” without the file.
Code:
https://sourceb.in/XYaDWPl00k

vivid fulcrum
#

in djs v13 there's no two parameters

sterile brook
#

is there anyone who used structures in v12?

slender thistle
#

@solemn latch

spark flint
#

@modern sable

#

you're active

modern sable
#

ty

spark flint
#

np

quartz kindle
earnest phoenix
#

how do i add a color to the embed website

#

@modern sable u are mega ultra active

#

24/7

modern sable
earnest phoenix
#

lol

modern sable
#

what do you mean with color to the embed?

earnest phoenix
#

like in here

#

the color of the side

#

and how do i add an image

modern sable
#

Website meta tags + theme colour

earnest phoenix
#

idk how

spark flint
#

i wouldn't share a message with a competitor bot list whilst talking to a community manager of a competitor bot list KEKW

#

i can find the meta tag for you

modern sable
spark flint
#

<meta name="theme-color" content="#HEXCODE">

spark flint
earnest phoenix
#

lol

modern sable
#

and for the metadata, you can check meta tags in general or https://ogp.me/ should get resolved aswell

earnest phoenix
#

this didnt work idk why

earnest phoenix
spark flint
#

<meta property="og:image" content="https://link.to/image.png" />

earnest phoenix
#

the og didnt work

earnest phoenix
spark flint
#

make the content=" " link to the image