#development

1 messages · Page 1906 of 1

onyx torrent
#

saying that we have changed ur token

#

this is true if you somehow post your token on github with config files

#

idk if thats ur case

earnest phoenix
onyx torrent
#

and yes talking about solve... got to discord dev portal --->bot and regenerate your token then use the new token in your system

low totem
#

oh ok

small tangle
#

@swift umbra https://www.npmjs.com/package/dompurify thats one i know BunnyLove peepoHappy

#

AlpakaSweet youre welcome

jolly vale
#

so basically i have this code that makes a new loop every time a command is run, so i wanna make a command that cancels just one of the loops that is running depending on the server

split hazel
#

show some of the loop creating code?

jolly vale
split hazel
#

you should insert an object into the _tasks array which contains the loop and an id so you can easily locate that loop later

jolly vale
split hazel
#

that is a memory location not a unique identifier you can easily access anyways

jolly vale
split hazel
#

do you know how to add things to an array?

jolly vale
#

Python

spark flint
#

Python I’m guessing

#

Yeah

#

Lemme take a quick look at the code

#

tasks.loop I’m guessing too

jolly vale
#

Yea

spark flint
#

Pretty sure it’s startloop()

#

Lemme look rq

#

Nah ignore that

#

Where are you getting that object from?

jolly vale
deft citrus
#

is there anyway to add voting rewards without my bot get approved

#

?

sterile brook
slender thistle
#

The only way of testing that is via manual requests

deft citrus
#

oh

slender thistle
#

or manipulating the source data

deft citrus
#

then i should wait till my bot get approved

#

how to convert big link to small

#

in python

#

i know in html only

#

like hyperlinks

#

in a embed message

onyx torrent
#

Wait for a python Dev to come

cinder patio
boreal iron
#

The error is correct.
botFile is a var you defined not a function.

deft citrus
#
@client.command()
async def invite(ctx):
  Text = 'HI'
  Vote = 'https://discord.com/api/oauth2/authorize?client_id=899172541862641724&permissions=137439267904&redirect_uri=https%3A%2F%2Freplit.com%2F%40IthihasK%2FEncourage-Bot%23main.py&scope=bot'
  embed=discord.Embed(title="Invite")
  embed.add_field(name="prefix",value = [Text](Vote), inline=True)
  await ctx.send(embed=embed)
#

@cinder patio

#

like this

earnest phoenix
#

@earnest phoenix

cinder patio
#

no, it must be in a string

earnest phoenix
#

Lmfao

#

Sab par hai

#

🤣🤣

boreal iron
#

Wrong channel dude

earnest phoenix
#

Mod role bhi nhi sed

#

@earnest phoenix koi bhi le skta

#

Issh

#

Mod role toh leleta

#

@earnest phoenix sed baccha

#

😂

boreal iron
mellow mauve
#

lmfao

#

yes

cinder patio
earnest phoenix
#

they're literally saying i don't have any roles LOL LOL LOL LOL

#

there's a reason I say unfortunately when saying I'm an indian

spark flint
#

@earnest phoenix Don't ghost ping

boreal iron
earnest phoenix
boreal iron
#

lol

exotic hull
deft citrus
#
@client.command()
async def roll(ctx):
  user = ctx.author
  await open_account(ctx.author)
  users = await get_bank_data()
  num =  random.choice(range(1,100))
  await ctx.send(f'{ctx.author.mention}     rolls   '+f'**{num}!!**')
  amount = num
  users[str(user.id)]['wallet'] += amount
  with open('mainbank.json','w') as f:
    json.dump(users,f)
#

what is the error in this code

reef stump
#

Hi Who Support A Bot

spark flint
#

`wdym

feral aspen
#

How could I check if a specific option has been clicked.

sterile brook
#

Use collector

deft citrus
#
@client.command()
@commands.is_owner()
async def give(ctx, user:discord.User,amount: int):
  
  user = ctx.author
  await open_account(ctx.author)
  users = await get_bank_data()
  users[str(user.id)]['wallet'] += amount
  with open('mainbank.json','w') as f:
    json.dump(users,f)
  print(amount)
#

i am recieving the amount

#

how to make to give to user:discord.User

spark flint
#

we can't help that much anymore

#

you keep asking

earnest phoenix
#
async def give(ctx, user:discord.User,amount: int):
  
  await open_account(user)
  users = await get_bank_data()
  users[str(user.id)]['wallet'] += amount
  with open('mainbank.json','w') as f:
    json.dump(users,f)
  print(amount)```
#

@deft citrus

#

try it

spark flint
#
@client.command()
async def give(ctx, user:discord.User=None,amount:int = None):
   if not user and not amount:
    await ctx.reply("You must provide a user and an amount!")

  await open_account(user)
  users = await get_bank_data()
  users[str(user.id)]['wallet'] += amount
  with open('mainbank.json','w') as f:
    json.dump(users,f)
  print(amount)
``` try that too (Just added a response if both user and amount aren't present)
#

nothing else changed from Diosis code

feral aspen
#

Hey, so apparently, when I created this message select menu, it can only be used once, and the second time it is used in the same message, it fails, how can I make it not fail and be able to use multiple times in a row?

slender thistle
#

Man

feral aspen
slender thistle
#

The guy literally ignored all of us who told him to learn Python

slender thistle
#

You mean

#

not user and not amount

#

cuz that's broken

spark flint
#

ah

#

fixed

slender thistle
#

I'll only help this far

#

Ignorance is bliss, have fun with it

spark flint
#

i'm only adding onto the code their sharing and not sending whole code blocks now

slender thistle
#

You don't wanna help yourself — I won't bother either

deft citrus
#
@client.command()
@commands.is_owner()
async def give(ctx, user:discord.User,amount: int):
  
  user = ctx.author
  await open_account(ctx.author)
  users = await get_bank_data()
  users[str(user.id)]['wallet'] += amount
  with open('mainbank.json','w') as f:
    json.dump(users,f)
  print(amount)
#

@spark flint its not working

onyx torrent
spark flint
#

error?

deft citrus
#
File "main.py", line 223
    await open_account(user)
                           ^
IndentationError: unindent does not match any outer indentation level
onyx torrent
#

check out tabs

deft citrus
onyx torrent
#

i think you should know first how python works

#

otherwise you will keep running through errors like this

onyx torrent
#
**Other Commands**
    ${interaction.client.commands.filter(c => c.commandName != 'poll' && c.commandName != 'ynpoll').map(c => `\`${c.commandName}\``).join(' ')}```
Returns undefined for all commands
native walrus
onyx torrent
#

check again

slender thistle
#

As you can see, no result

#

He refuses to learn Python by himself

native walrus
onyx torrent
native walrus
#

if you're getting

`undefined`

that means c doesn't have commandName on it

onyx torrent
#
**Other Commands**
    ${interaction.client.commands.filter(c => c.commandName != 'poll' && c.commandName != 'ynpoll').map(c => `\`${c.commandName}\``).join(' ')}```
native walrus
#

it passes the filter because it's undefined

#

so check what c is

onyx torrent
sterile brook
native walrus
#

because you made a mistake lol how are we supposed to know

sterile brook
#

How we can know

onyx torrent
#

ah ok

sterile brook
#

Lamo

onyx torrent
#

lemme check

native walrus
#

if you don't want to waste time on these pointless bugs you can try using a better language like typescript

sterile brook
#

Lol

native walrus
#

where the compiler will tell you if you're trying to access a key on an object that doesn't exist

onyx torrent
#
    ${message.client.commands.filter(c => c.name != 'p').map(c => `\`${c.name}\``).join(' ')}```

this works if my commands files have a field called `name: xyz`
#

but now i am working with slash commands

native walrus
#

then that means you're storing 2 incompatible types in your commands array/collection

#

you either have to normalize them so they both use name or commandName or you need to make a function that checks both

onyx torrent
#

at the moment only commandname exists

native walrus
#

so how does the code you sent above work

onyx torrent
#

i am upgrading to slash commands

#

and this is the last issue before i wrap up

native walrus
#

right, so you either need to rename the name property on your existing commands to commandName or make a function that checks to see if either commandName or name exists on the command object

onyx torrent
#
const { SlashCommandBuilder } = require('@discordjs/builders');

module.exports = {
    data: new SlashCommandBuilder()
        .setName('ping')
        .setDescription('...'),
    async execute(interaction) {
        
        return interaction.reply(`s`)
            .catch(err => console.log(err));
    },
};```
#

my commandfiles structure

native walrus
#

right, clearly you can't rename that one, so rename your existing commands

onyx torrent
#

all are of same structure

native walrus
#

then you should have commandName for everything no?

native walrus
#

ok so you don't have a problem then

#

I don't know what else to say like you still haven't console.logged c

onyx torrent
#

ok

#

but you have assumed i havent tried basic debugging

native walrus
#

like 99.9% of the people who ask questions in this channel yes

sterile brook
onyx torrent
#

and btw c cant be console.logged

sterile brook
#

It can be logged

onyx torrent
#

where ?

sterile brook
#

Right in ur constructions

onyx torrent
#

check the snippet before you speak

#

c isn't a variable

native walrus
#

what is it, a keyword?

onyx torrent
#

where can i log it after that statement its scope ends

sterile brook
#

Dude

native walrus
#

damn and this is the guy telling other people to learn python first

sterile brook
#

U simply can console log it right in filter in {}

onyx torrent
onyx torrent
native walrus
#
message.client.commands.filter(c => {
  console.log(c)
  return c.name != 'p'
})
sterile brook
#

And also do ur return

#

Lmao

native walrus
#

or better, just learn how to use a debugger

#

so you don't have to do this meme

#

put a breakpoint inside the filter without changing code and inspect the object directly

sterile brook
#

^^

onyx torrent
#

ok thanks for help

native walrus
#

hope this is a good lesson in not being judgmental towards other people not knowing certain concepts

onyx torrent
#

bro why troll me

sterile brook
#

Cuz I haven't checked snippet

#

Ezpz

onyx torrent
#

wtf i just told him to learn indentation because he was copy pasting

onyx torrent
native walrus
#

true I'm such a troll

onyx torrent
sterile brook
#

Haven't I actually typed here about him

#

Like 2 days ago

#

But u still spoonfeeding him

onyx torrent
sterile brook
#

I mean

#

I am not about u rn

onyx torrent
#

he was not upto learning

slender thistle
#

I'M FUCKING WHEEZING

sterile brook
onyx torrent
#

mhm

#

being co-operative can save a lots of time and effort

sterile brook
#

Not to 13 y.o. boy who don't want to learn anything by himself

#

No ty

#

That cringe

onyx torrent
#

on cosole.log(c)

native walrus
#

you can figure this one out on your own I believe in you

onyx torrent
#

yes

native walrus
#

damn

onyx torrent
#

no?

native walrus
#

gj

onyx torrent
#

?

sterile brook
#

Yay

#

He done this

onyx torrent
#

ok

sterile brook
#

He figured

onyx torrent
#

thanks @native walrus @sterile brook

native walrus
#

would've taken like 5 seconds to fix this with typescript

sterile brook
#

It's also 5 sec, if u experienced enough

#

In js

native walrus
#

I don't think that logic checks out

#

still, you need to do digging to figure out what's what instead of just hovering over the variable

#

and having the language tell you what you're working with

errant flax
onyx torrent
#

i have 12 months js experience

#

so yeah

#

u cant expect much from me

sterile brook
#

I won't ruin ur expectations

#

So u gud

onyx torrent
#

lmao no

#

i dont feel broken on hearing the truth

mellow flint
#

Hello, I want to create an AFK page in my bot where every minute the user is on the site, he receives 200€ in cash from the bot (in quick.db)

Discord.JS
Website in HTML

sterile brook
#

Page, bot and site in one sentence

mellow flint
sterile brook
#

So set interval function for adding cash

#

On ur page

#

What's the problem

#

Or while + timeout func

#

As u wish

mellow flint
#

How I connect quick.db?

#

I’m a website?

sterile brook
#

Usually on db docs written about connection

#

I am not user of quick.db

earnest phoenix
#

because I can use puppeteer to open your website and leave it online 24/7

woeful pike
#

i really hope that's in game currency

spark flint
#

24/7

eternal osprey
#
  let fakams1 = ["17000", "15000", "12000", "13000", "14000"]
          var itemms1 = fakams1[Math.floor(Math.random()*fakams1.length)];
          setTimeout(() => {
         
      
           const embed4 = new Discord.MessageEmbed()
           .setColor("#00FF00")
           .setFooter("Provided by Gauntlet bot!")
           .setTimestamp()
           .setDescription("GREEN LIGHT!")
           channelwise.send(embed4)
            const filter4 = m => m.author.id != client.user.id;
            const collector4 = channelwise.createMessageCollector(filter4, { time: itemms1, max: 2});
           collector4.on("collect", m => {
         console.log(m.content)
     let nmamk = [...minigame1.members]
     user1 = nmamk[0][0]
     user2 = nmamk[1][0]
   
             if(m.author.id === user1){
           g1 += m.content
             }
             if(m.author.id === user2){
               g2 += m.content
               }
     })
     console.log(itemms1)
    }, Number(itemms1));```why is my damn timeout not working?
#

itemms1 is showing a random number, i've logged it multtiple times. However this bitchass of a timeout doesn't want to work

sterile brook
#

parseInt(itemms1)

#

Or better just store not strings

#

Lol

#

And u won't need any parsing

hybrid cargo
#

Tbh that wont affect anything since everything inside the fakams1 are a string with just numbers. And the setTimeout works for me well and good

eternal osprey
#

alrighty, that actually worked.

hybrid cargo
#

I can think of one problem

sterile brook
#

Ofc it worked

eternal osprey
#

how would i stop a timeout while it's running?

sterile brook
#

Return

eternal osprey
#

isn't there a stop function for it

#

aha

sterile brook
lyric mountain
#

removeTimeout or something like that

hybrid cargo
#

Orrr nvm

pale vessel
#

it would work

#

collectors are event emitters

hybrid cargo
#

channelwise was channel not a message

#

Myb

sterile brook
lyric mountain
pine nova
mellow flint
#

I make a logoff ater 3h

vivid fulcrum
#

and i make puppeteer refresh the site after 3h

high crown
#

When ever I start my laptop, some to the applications start automatically

#

How do I stop then from doing so whenever I start my laptop

#

?

vivid fulcrum
#

which os

high crown
#

Windows

#

7

#

😐

vivid fulcrum
#

my god

#

you should seriously update

#

but anyway

#

go into task manager and startup tab

high crown
#

Ok

#

Then

split hazel
#

Windows 7 is perfecto for old laptops

#

Windows 10 is too heavy and stores too much in ram

vivid fulcrum
#

win7 is perfecto when you want to get hit by a vulnerability that's never going to get fixed

median spire
#

Eek

stiff lynx
#

Guys, I'm coding a HTML and CSS website, any guides about hosting it?

vivid fulcrum
#

if it's a static website, you can use github pages

earnest phoenix
quartz kindle
#

they're pretty good

split hazel
#

am I right

earnest phoenix
severe perch
earnest phoenix
vivid fulcrum
#

i redid my terminal setup again

severe perch
vivid fulcrum
#

i got a love hate relationship with powershell

stiff lynx
vivid fulcrum
#

i mean sure but you're going to have to buy a domain and mess around with that

eternal osprey
#

i have a string named test1.

#

How would i count the amount of words that are the same as: "klmk12k3j21opidjqwodjas09dm21em908da84*)@(n1290ind208)!(@DADDNMK)!@NID_SEMEM129MC(A(m121mik"

vivid fulcrum
#

what

eternal osprey
#

so for example test1 == klmk. It would return number 4

quartz kindle
#

what

eternal osprey
#

and 12k3j would return 6

earnest phoenix
#

can anyone help me with discord-xp

austere scaffold
#

python?

#

@eternal osprey

eternal osprey
austere scaffold
#

idk then

earnest phoenix
quartz kindle
austere scaffold
#

lol

eternal osprey
#

test1 has 6 letters that are also in that string

#

"klmk12k3j21opidjqwodjas09dm21em908da84*)@(n1290ind208)!(@DADDNMK)!@NID_SEMEM129MC(A(m121mik"

austere scaffold
#

12k3j

quartz kindle
#

12k3j is 5 letters

eternal osprey
#

oowh 5 lmao

#

sorry

quartz kindle
#

if(string.includes(test1)) length = test1.length

eternal osprey
#

wait wha

#

i don't get that

stiff lynx
vivid fulcrum
#

DO doesn't sell domains

eternal osprey
#

if(string.includes(test1)).length = test1.length this right?

quartz kindle
#

no?

stiff lynx
#

I think it does

vivid fulcrum
#

it doesn't

#

otherwise i wouldn't be saying this lol

#

DO is a hosting provider, not a domain registrar

stiff lynx
#

domains (1)

cristianstinga.xyz
native walrus
#

you can register domains you own with digitalocean but they aren't a registrar themselves

native walrus
#

just buy your domain from porkbun and set the nameserver as digitalocean. Same thing

#

probably much cheaper too

quartz kindle
#

an oddly satisfying experience

native walrus
#

heroku doesn't have its own DNS service but you can resolve a custom domain to a heroku instance yes

sterile brook
earnest phoenix
#

if someone can buy a domain they probably won't be using heroku for bots lol

eternal osprey
#

but it didn't work

sterile brook
#

ofc it didnt

eternal osprey
#
if(subcommand == 'mop'){
      let d = "fsdfk3j2"
      let m12 = "klmk12k3j21opidjqwodjas09dm21em908da84*)@(*n1290ind208)!(@*DADDNMK)!@NID_S*EM*EM129MC(A(m121mik"
  if(m12.includes(d)){
length = d.length
console.log(length)
    }
    }```
#

this should return 4

#

i hope someone actually understands my knowledge XD

sterile brook
#

this snippet gives nothing

#

for me

eternal osprey
#

yes.

cinder patio
#

no why would it return 4?

eternal osprey
#

i want to count the number of words that are in the same order as the string

vivid fulcrum
#

d isn't a part of m12

#

lol

eternal osprey
#

as you see k3j2 are in both strings, in the same order

sterile brook
#

its regex time

eternal osprey
vivid fulcrum
#

you're copypasting code without understanding what it does

sterile brook
#

ah then its not regex

#

then

eternal osprey
sterile brook
#

it just intersection of 2 sets

#

bro

vivid fulcrum
#

you don't

sterile brook
#

search for it

vivid fulcrum
sterile brook
#

in google

vivid fulcrum
#

read the description for includes

eternal osprey
#

it only run if it's exacttly the string of d

eternal osprey
eternal osprey
sterile brook
#

ofc it worked

eternal osprey
#

But would it also be possible to check their position>?

#

So order basically

sterile brook
#

sets are poorly iterable

#

u can try

eternal osprey
#

the question is how. Just a for loop?

#

wait why ddon't i justt for loop all strings and call a ++ on a variable?

sterile brook
#

nah

#

foreach works

#

with sets

#

also for of

#

u also can [...setName] and use set as array

flat copper
#
[
  {
    emojis: ["🍳", "🎂"],
    name: "Pancake",
  },
  {
    emojis: ["🍓", "🥛", "🤝"],
    name: "Straw Berry MilkShake",
  },
  {
    emojis: ["🇫🇷", "🍟"],
    name: "French Fries",
  }
]``` 
unexpected token "e" in json at line 10
sterile brook
#

where is line 10 here

cinder patio
#

property names need to be in double quotes

boreal iron
#

STOP ADD commas to the last property AAAAASAARRRAHBBHAHHR

sterile brook
sterile brook
#

lmao dude

flat copper
#

oo

#

oki

#

thnx for the help

cinder patio
#

gross

sterile brook
boreal iron
#

Omg nooo

sterile brook
cinder patio
#

not even done correctly

quartz kindle
boreal iron
#

That’s like raping your code

quartz kindle
#

also, words are not letters

#

"jrnhshzvxs" this is 1 word

sterile brook
boreal iron
#

Sorry need to eat some pills to get rid of the physical pain okeh

sterile brook
boreal iron
#

Thanks I didn’t drive

#

I would have hit a tree immediately

sterile brook
#

meh

native walrus
sterile brook
#

?

quartz kindle
#

strings for dates = bad

sterile brook
#

where u found

#

string for date

flat copper
#
[
  {
    "emojis": ["🍳", "🎂"],
    "name": "Pancake",
  },
  {
    "emojis": ["🍓", "🥛", "🤝"],
    "name": "Straw Berry MilkShake",
  },
  {
    "emojis": ["🇫🇷", "🍟"],
    "name": "French Fries",
  }
]```
 
unexpected token "}" in JSON at position 59
boreal iron
#

Says date for me

#

Not string

flat copper
native walrus
#

grab_time?

quartz kindle
#

you cant have ,}

boreal iron
flat copper
sterile brook
#

cuz that just will be result of subtraction in ms and i wont need any other operations with it

boreal iron
#

Of each property

#

You don’t write a list like that:

item1, item2, item3,

native walrus
boreal iron
#

Maybe it’s larger than the 32 bit max

#

Where did my word value go wtf

#

_i hate auto correct _

sterile brook
earnest phoenix
#

where do we use ?? in js

#

or

#

what purpose do they have

feral aspen
#

Do you mean the Nullish coalescing operator?

high crown
#

hey

#

I'm getting this error when I'm trying discord-rpc

#

Could not connect
at Socket.onerror (/home/runner/RPC/node_modules/discord-rpc/src/transports/ipc.js:32:16

#

what to do bout it?

earnest phoenix
high crown
#

I first tried the code in the guide but it was not working for me

earnest phoenix
#

and see the line 32 or 16

high crown
feral aspen
earnest phoenix
#

ok

#

then you tell him how it works

feral aspen
high crown
earnest phoenix
high crown
earnest phoenix
# high crown pls help

better go on the web and see whats wrong with the code, people in here prolly not gonna tell ya the reason (too dead af)

feral aspen
high crown
#

funny 😐

#

shut up u idiot

feral aspen
#

Huh?

high crown
#

(I'm an idiot too)

feral aspen
#

Okay?

high crown
#

cool

feral aspen
#

I guess you solved your issue? Great then.

earnest phoenix
#

i just told you to go on the web and see whats wrong

#

or send yo code with the full error to see whats wrong

#

Can Discord.js run with node@17.0+

feral aspen
earnest phoenix
mellow flint
#

How I connect quick.db to a website in html?

boreal iron
#

You can’t "connect" anything to HTML but your backend

#

It’s just a markup language not more or less oldEyes

wheat mesa
# earnest phoenix and see the line 32 or 16

That stacktrace is in a node module, which you generally don’t want to edit on your own. It’s likely caused by his fault, but editing the code of a node module will not solve his issue

#

Oh he’s gone

#

Nice 👍

earnest phoenix
#
const appCmds = await client.guilds.cache.get(client.conf.guildId).commands.fetch()
      
        for(const name of client.slashCommands) {

          const app = appCmds.find(a => a.name === name)
          if(app) {
            console.log("Found "+name)
          } else {
            console.log("Error "+name)
          }

I created them as guild commands but i get error every time

earnest phoenix
#

Yes

#

AppCmds.find returns undefined

onyx torrent
high crown
#
 
client.updatePresence({
  state: 'slithering',
  details: '🐍',
  largeImageKey: 'snek_large',
  smallImageKey: 'snek_small',
  instance: true,
}).catch(console.error);
``` can anyone help....it is showing cannot connect to socket onerror
#

pls help

earnest phoenix
high crown
#

ignore .catch()

#

help pls

earnest phoenix
#

Its module error prob

onyx torrent
high crown
earnest phoenix
#

With not using it

high crown
#

😑

earnest phoenix
onyx torrent
earnest phoenix
#

Problem is it returns undefined

wheat mesa
#

Btw if you’re trying to set a rich presence for a bot you can’t do that

onyx torrent
earnest phoenix
#

{
id: 37193838
guild: guild {
something
}
}

#

I cant reach the id

#

Its my problem's example

onyx torrent
earnest phoenix
#

No its the result when i console appCmds

onyx torrent
earnest phoenix
#

Yeah why not?

onyx torrent
#

try it then

earnest phoenix
#

I dont need it

#

console.log(client.app.commands.fetch())

onyx torrent
#

ah

earnest phoenix
#

I meant that

onyx torrent
earnest phoenix
#

Nwm i did it

onyx torrent
#

ok

onyx torrent
earnest phoenix
#

Yes so freakin weird but yes

onyx torrent
#

lmao

#

unexpected fix

boreal iron
#

Not unexpected, no

#

The collection is using keys

high crown
boreal iron
#
{
  "key" =>
  {
    "value": "something",
    "value2": "something2"
    ...
  }
}
#

(as well as a map)

hybrid cargo
woeful pike
quartz kindle
#

thats like being a reverse dev

#

doing everything backwards to irritate people :^)

high crown
rose lance
#

anyone has an idea why intellij is marking this? I recently updated my IDE and I didn't have this before is I thought this might be a bug?

earnest phoenix
#

Top.gg is under another nonsense

#

@earnest phoenix

west stag
#

DiscordJS: What's the best way to disable a single button on it after being clicked/used on a message with multiple buttons?

#

Damn

#

Its ugly and beautiul at the same time but it works

earnest phoenix
west stag
earnest phoenix
spark flint
earnest phoenix
west stag
earnest phoenix
feral aspen
#

How could I check if it hasn't been clicked for that amount of time?

west stag
cinder patio
# feral aspen

In the end event check if the amount of collected components is 0

feral aspen
#

It will only end if it has got 1 amount.

cinder patio
#

It'll also end when the time expires

feral aspen
#

Wait, really?

cinder patio
#

unless it changed in v13, then yes

#

try it out

feral aspen
#

It logged the InteractionCollector object...

#

.collected property, I guess?

cinder patio
#

mhm

livid lichen
#

DiscordAPIError[20012]: You are not authorized to perform this action on this application
Discord API Error while trying to set up slash commands. I understand what it's saying but I don't know how I would fix it.

boreal iron
#

Did you invite your bot with the right scope (application.commands)?

feral aspen
# cinder patio mhm

Hey, so it works, but it seems to just end the collector and can't use the menu multiple times in a row, as in the help command.

#

That's the code.

#

.. and it usually ends after 3 seconds.

cinder patio
#

yeah because you've set it to end after 3 seconds

feral aspen
cinder patio
#

Make the time 1 min if you don't want it to end so early? lmao

#

or more if you want

feral aspen
#

I know, but how can I use each interaction received?

cinder patio
#

you're already doing it? Set it to one minute and try it out

feral aspen
#

Interaction failed?

boreal iron
#

I will never get why you would use a collector for this.

#

You receive the event, check if the interaction author is the one using the select menu or pressing a button and if so do your action.
(edit the original interaction response, send a follow up message etc.)

boreal iron
#

No need of a collector, filter, timeout etc.

feral aspen
#

Ah.

cinder patio
#

errr the collector is just an utility

#

does the same thing

feral aspen
#

Dude, I used it anyway. 😑

boreal iron
#

Also since it seems components have no known timeout the user can still use the buttons/menus later on

#

Instead of using a collector with a predefined timeout

#

Why disabling the components of a help command after whatever 30s, for example?
Doesn’t make sense to let the user use another slash command later on if the components are disabled

#

Just let it active

feral aspen
#

I'm guessing, not guessing, but believing all bots do this?

boreal iron
#

Do what?

feral aspen
#

They disable the menu after a set amount of time.

boreal iron
#

Which doesn’t make sense for a help command since why not letting the user calling the command use the menu later on?

#

It’s so easy…

  • user uses a slash command, this creates an interaction
  • your script receives the event and responds with the help embed, incl. a menu to select a category
  • user uses the menu to select a different command category, this creates another interaction
  • your script also receives that event
  • check in the event if a component has been used, if it has your unique ID, for example help-select-menu and if the component.user is the same as the interaction.user, to prevent others from using the menu
#

If so edit your original interaction response to show the commands of the selected category

#

The user can always use that interaction

#

Doesn’t need to use the slash command again if your collector is timed out

#

To see another category

#

Less code, less work, less RAM, higher efficiency, more user friendly

#

Less command spam in a channel as well

quartz kindle
#

my help menu can be used by multiple people at once

#

and still works even if its several days old

#

lmao

boreal iron
#

Hmm yeah i mean that’s an option, too

#

But can cause trolling

#

That’s at least what I would do

#

But it still doesn’t change the fact that using a collector is just nonsense and more code than actually needed

proven lantern
quartz kindle
#

the button custom ids contain all the necessary metadata to know how to edit the message

boreal iron
#

Not to say it looks really ugly as well

boreal iron
#

Because they somehow didn’t really understand interactions and try to copy the way they collect reactions I guess

#

Which is totally unnecessary

round perch
#

So uhm, someone decided to make discord as a database solution

#

Look at it like google drive, except it's using discord.. AS THE STORAGE

pale vessel
#

That's not new

boreal iron
pale vessel
#

There was a file hosting service that used discord as a host

#

Since disocrd uses GCP

quartz kindle
#

yes

#

with amazing write speeds of 2000 bytes per second

round perch
proven lantern
#

this doesn't look too bad

boreal iron
#

But I’m not sure if discord already supports it

proven lantern
#

like this?

#

i think the only way to do it now is to update the component which changes it for everyone

#

so that doesn't work

boreal iron
#

Like so

proven lantern
#

yeah, that would be nice

#

then i could move my 4 separate dropdowns into one

boreal iron
#

Your category as non selectable option like in HTML

proven lantern
#

yeah, they should copy all the features of html dropdown

#

multi select

boreal iron
#

Hmm not sure about multi select but the rest yeah

proven lantern
#

optgroup

boreal iron
#

I think one action should always count as one (interaction)

#

Yeah options already an array if I’m not wrong

proven lantern
#

there should be a form concept copied from html

boreal iron
#

Guess it’s planned to be supported once a beautiful day

proven lantern
#

for now it's best to keep them separate

boreal iron
#

At least an option to (de)active single select options

#

And groups, yeah

proven lantern
#

writing all the logic to do sub menus now might end up being a waste if they add optgroups

boreal iron
#

I mean you can already trick that by creating options with the same unique ID in upper case for example acting as group titles
If the user selects him respond with an ephemeral message to select another option

#

Looks more organized than multiple select menus above each other

#

In my opinion

proven lantern
#

it's more functional

#

but not as beauty

#

once they add optgroups i'll just need to update a json object without any code

boreal iron
#

Yeah I somehow don’t like more than one action row

#

Looks weird

#

Groups would be nice

#

Or even somehow options you can highlight but which aren’t selectable

proven lantern
#

like multiselect?

#

when you click it just highlights

boreal iron
#

Nah that’s still something I’m not sure about

proven lantern
#

then you have a submit button

#

checkboxes might be better for that

boreal iron
#

That would somehow ruin the usability

#

Yeah

proven lantern
#

and radio buttons

#

just copy html

boreal iron
#

Yeah even if I think finalizing the current components is already more than enough for most of the users

minor terrace
#

do you guys integration test your bots? and if so, then how? qualitatively speaking, of course

proven lantern
#

i just do localhost and prod

#

integration only makes sense for teams

minor terrace
#

to be more specific, do you try to 100% test everything the bot will do in an automated way? for example, if my bot creates a post and then watches it for a MessageReactionAdd, is it even worth trying to mimic doing that?

boreal iron
#

Well being experienced enough doesn’t require to test each small portion of your code all the time

proven lantern
#

you could use something like nightwatch to automate some test of your bot

boreal iron
#

But it is generally not a bad idea tho regarding the fact to not build bugs in

#

And the fact getting feedback is hard

proven lantern
#

it's good if you are on a team

minor terrace
#

im on a team of me, myself and i

boreal iron
#

If a bot usually don’t works as supposed to people will just kick it off their guild

proven lantern
#

make sure people dont break your stuff

boreal iron
#

Without any feedback most likely

minor terrace
#

for the most part, i try and isolate as much as possible away from discord so i can unit test it, but otherwise, for fully testing commands from start to finish, i think integration testing is the only way, i would think

proven lantern
#

but if your commands require more than one discord account it can get tricky to write automation tests

lyric mountain
#

That's like, selfbotting

quartz kindle
proven lantern
earnest phoenix
#

possibly unpopular opinion, unit testing is a waste of time

proven lantern
quartz kindle
earnest phoenix
#

lmao

#

I agree

#

I've never once used it and said "oh wow this was totally worth my time"

quartz kindle
#

well i never used it like at all

#

although i can see it being useful if you have something that absolutely cant break

#

something used by millions of people

quasi echo
quartz kindle
#

neither have most people here

quasi echo
#

true

#

thats why we don't need unit tests

#

It is very language and use case specific

quartz kindle
#

just... dont write bugs in the first place :^)

quasi echo
#

so true

quartz kindle
#

funny we call them bugs, they are more like brainfarts

quasi echo
#

btw, I don't write bugs, I write unexpected features

quartz kindle
#

xD

proven lantern
#

i use unit tests to test code as i write it, but then i dont save the test once its working

quartz kindle
#

i spend a month writing code without running it a single time

proven lantern
#

scary

quartz kindle
#

then i see how much it breaks

quasi echo
#

I usually start coding from sratch, reading some manuals, then when I feel like it should work, I test it out, and start solving the issues

proven lantern
#

a prof once told me never to do that

quartz kindle
#

the worst is when it runs without issues

quasi echo
#

And when I'm working with DC, I usually test everything before I add discord, so I can debug more easily

quartz kindle
#

because you're petty sure somethign has to be wrong, but you dont know where

quasi echo
#

In python, it's not a big issue, but in JS, it is

quartz kindle
#

i run it in production and look at logs a few days later :^)

quasi echo
#

in JS, I put everything in try except and write the error then pass the except

quasi echo
quartz kindle
#

lmao

quasi echo
#

I have a dev and a release version. Dev version literally prints everything it's doing, production just prints if it started

#

Do you use python or JS for Discord bot development?

quartz kindle
#

i make it print activity like when a command is run or when an api access happens

#

js

proven lantern
#

i only use languages with goto

quasi echo
#

I started with JS, but then transitioned to python

quartz kindle
#

i cant get used to py

#

too used to c-like

quasi echo
#

I miss the () and the ;

quartz kindle
#

and the {}

quasi echo
#

oh yes

#

I miss those a lot

quartz kindle
#

xD

quasi echo
#

do you comment your code?

quartz kindle
#

nope

#

lmao

quasi echo
#

look at this code:

#

I started commenting in the beginning, then just went with the flow, and made 0 comments

proven lantern
#

python can do some cool things

#

i need to learn it more

quasi echo
#

Python's for is pretty epic tbh

quartz kindle
#

keep code for code only

#

i have a lib with a 5k line .d.ts file

#

because of jsdoc

quasi echo
#

nice

quasi echo
#

pretty cool tbh

quartz kindle
#

isnt that the same as for (item of array) ?

quasi echo
#

is that JS?

quartz kindle
#

ye

quasi echo
#

and is that valid code?

quartz kindle
quasi echo
#

i see what you did there

#

yes, basically the same

#

I didn't know JS had it

#

simpler in Python though

quartz kindle
#

i guess

quasi echo
#

but thats a beautiful one liner

#

I miss one liners form python

quartz kindle
#

well, if you prefer using built in class methods, its easier

#

array.forEach(console.log)

proven lantern
#

java has it too

#

java doesn't know what it wants to be

quasi echo
#

thats the weirdest array construction I've ever seen

quartz kindle
#

it tries its hardest to be cool

quasi echo
quasi echo
proven lantern
#

idk

quartz kindle
#

cpp is kinda weird

#
for(const string &text : texts)
    cout << "value of text: " << text << endl;
proven lantern
quasi echo
#

yummy

quartz kindle
#

wut

#

version 5?

#

isnt the current version like 16 or 17?

#

or 8 for the oracle edition?

proven lantern
#

version 5 has enhance for loops

lyric mountain
quartz kindle
#

lmao

proven lantern
#

i just used an online java compiler thingy

lyric mountain
#

I really loved how groovy is just a DLC for java

quartz kindle
#

ah lul

proven lantern
#

i wouldn't install java on my computer

quartz kindle
#

isnt kotlin also a dlc for java?

lyric mountain
proven lantern
#

not the jdk

#

jre

#

i use intellij

lyric mountain
lyric mountain
proven lantern
#

kotlin is trying to make the language better

#

show java people the light

lyric mountain
#

i like java syntax tbh

proven lantern
#

same with scala

lyric mountain
#

feels easier to find stuff

#

but I also like groovy's QoL features

#

like times method

quartz kindle
#

i've never coded a single line of java, not even for minecraft plugins

native walrus
#

I tried minecraft plugins in scala once. Not a great experience

lyric mountain
#

minecraft doesn't actually support mods, it's all just a big hack

native walrus
#

when the api you're using isn't functional it just feels like you're writing java but with fewer parentheses and semicolons

quartz kindle
#

minecraft is an old car in a tuner's shop

lyric mountain
#

like, mojang could actually make an official modding api or at least have the source code open

#

mods are the only reason minecraft is still alive

native walrus
#

what would an official api get you that the current mods don't?

quartz kindle
#

mods are the only reason many games are still alive

#

ie skyrim

#

gta sa

lyric mountain
#

fabric -> lightweight, easy but considerably limited
forge -> complete, powerful but somewhat heavy and confusing

quartz kindle
#

official stuff will never be as good as community stuff when the community decides to make it happen

lyric mountain
#

ye, that's why I also said to at least make the source code open

#

everything is currently based on decompiled binaries

native walrus
#

I thought microsoft would want to push bedrock edition + an official lua API but it never happened from what I know

quartz kindle
#

the community has the advantage of being able to break and crash the game as much as they want while they experiment with it

#

the official devs cant ever do that, they cant risk releasing broken stuff

quartz kindle
#

weird

wheat mesa
#

tbh I don't understand the use of the ampersand before the variable in foreach loops in c++, but I'm guessing it has something to do with performance

#

since pretty sure using by reference and using by the direct variable achieve the same behavior

quartz kindle
#

it depends on the content/context i guess

#

in some cases, the reference would be a pointer instead of the value

wheat mesa
#

yeah

proven lantern
#

the & makes it a reference

wheat mesa
#

I'm aware

#

But there's no noticeable difference in just a basic example like that

viral spade
#

in mongodb, should i store chat messages onto the channel collection, by making a property that is an array of (textmessage)objects or should i make a new collection only for textmessages with a reference to the channel? what is the better thing to do?

lyric mountain
#

don't store chat messages on db

#

use an expiring cache for that

viral spade
#

yes, but if i would, how would i do it?

lyric mountain
#

what lang?

viral spade
#

nodejs

lyric mountain
#

js then

#

node is a framework

viral spade
#

bro, that doesnt answer my question

lyric mountain
#

it does

#

use that to store messages

#

and set an expiring time depending on how long you'll need the msgs

viral spade
#

the messages i intend to store i need stored persistent, and i have every right to store them

lyric mountain
#

are you planning to store only command messages or any message?

viral spade
#

if i tell you the answer you will say "wrong channel"

lyric mountain
#

why would I?

viral spade
#

because its not discord related

wheat mesa
#

this channel is development related, not necessarily just for discord related projects

lyric mountain
#

...what? like, are you going to store command messages OR all messages?

#

A or B

viral spade
#

comments

#

on a website

lyric mountain
#

that's an important detail, I was thinking you were talking abt discord messages

viral spade
#

all that is important is

#

the messages i intend to store i need stored persistent, and i have every right to store them

lyric mountain
#

as long as it's not a discord message, sure

woeful pike
#

mongodb records have a max size. Normally you want to denormalize data in mongo to get faster reads but if you have infinitely growing data like a comment feed it might be a better idea to add a "foreign key" in a separate collection instead

viral spade
#

now thats an answer xD

woeful pike
#

mongodb is way more difficult than people think because of this. There's no single answer to anything

#

beginners use it because they see it as a json file but in reality it's much more complex to use correctly than relational databases with straightforward normalization rules

lyric mountain
viral spade
#

well thanks for the answer, i guess ill go for an extra collection

earnest phoenix
#

i am currently building a status page for my bot, does the website code be inside my bots website code?

boreal iron
#

Better not, no but you just frequently report your bots data to a database for example and use it to get the status and calculate statistics (if wanted)

earnest phoenix
#

so use the database to post stuff on to the website?

boreal iron
#

You query the database, it doesn’t post data but yeah

#

It’s simply the connection between your bot and your website storing the status history

earnest phoenix
#

ohh got it thank you!

boreal iron
#

👍

lament rock
#

Does anyone know any js opus decoding and encoding libs that isn't prism-media

#

I really don't want to have to pipe literally everything through ffmpeg because the use case would lead to a lot of overhead costs

slender wagon
#

so i am working on a yt video downloader, in this case mp3. The issue is that with vids that are like 5 minutes it starts it at a few kb and then slowly goes to 0
i am currently using ytdl-core

#
 res.setHeader("Content-Disposition", 'attachment;\ filename="'+filename+'"');
    ytdl(videoURL, {
        filter: format => format.itag == itag
    }).pipe(res);
#

any reason this could be happening

eternal osprey
#
let m12 = "klmk12k3j21opidjqwodjas09dm21em908da84*)@(*n1290ind208)!(@*DADDNMK)!@NID_S*EM*EM129MC(A(m121mik"
  let a = new Set([...g1])
let b1 = new Set([...m12])
let intersect = new Set([...a].filter(i => b.has(i)));```i have this codde, that needs to check if the inputted string follows the m12 string.
#

It now only checks for characters. However how would i also check the word order?

modest maple
#

pithink idk about js but sets are inherently unordered

#

Also does Set not have . Intersection(S2) method?

woeful pike
#

nope, js sucks and does not have the only methods on sets that you'd ever want to use a set for in the first place

slender thistle
#

🤣

earnest phoenix
quartz kindle
#

lmao

earnest phoenix
#

Good I don't use classes

crystal wigeon
#

Anyone facing issues logging into discord from mobile?

#

Like if I try to login via oauth from mobile it keeps redirecting back to login page on discord

#

But it works fine from lappy

#

Weird shit

#

I spent the whole day trying to debug my app

rustic nova
#

discord issue

spark flint
#

I get that

empty pier
#

Hello,
I want to do a upvote reward for my Python bot, but I don't know how to do it.
I've already checked the docs
Thank you

#

PS: I need to get the user id in the process

wheat mesa
#

Ah yes, the python docs will tell you exactly how to implement X or Y

viral spade
earnest phoenix
#

Why my bot change guild name when it upload / commands

earnest phoenix
#

Oh nwm i forgot the put .commands.edit lol

hollow depot
#

with express, how can i change the sent file on a specific event? i tried with app.sendFile(filepath) but nothing changes, i keep seeing the previous page

spark flint
#

alr is there any way to play music from an mp3 source on discord.py

#

I can't find a working example anywhere

lethal trout
#
const filter = (interaction) => {
          return !interaction.user.bot && interaction.user.id == message.author.id
        };```

How can i make this to message smth?
i tried many things but it did not work
spark flint
#

@rustic nova

#

scam

rustic nova
#

@earnest phoenix dont advertise

#

thanks

rustic nova
#

banned

spark flint
#

epic

#

For those who can help

#

my bot JOINS the vc but never actually plays

#

thats the error

pale vessel
spark flint
#

I've managed to find a workaround

spark flint
#

It doesn't use YTDL anymore

pale vessel
#

You using wavelink or something?

spark flint
#

It streams from an MP3 stream

#

its not a music bot like normal ones

#

it has a set stream to play from

pale vessel
#

It still uses ffmpeg

spark flint
#

Yep

#

And it works this time

#

I have a working test playing a file

#

yep it works

modest maple
#

👏 Im afraid i gotta report you now to the bbc

spark flint
#

Lol my bot won’t actually use BBC radio 1

#

I just needed a working audio stream to test with

earnest phoenix
hollow depot
#

res sorry lol

proven lantern
#

is there anyway to make scalable app using java spring boot or is the cold start time too long? i've seen a minimum of 30 seconds for a cold start with spring boot. is there some special type of hosting for java spring boot that deals with this?

signal estuary
#

How can I add my bot to these quick actions?

boreal iron
#

Aren't they just components or am I wrong?

wheat mesa
#

Context menus

wheat mesa
#

Pretty sure they’re just components

#

Although it might require a different scope or something stupid in true discord fashion

boreal iron
#

Didn't use context menu components yet, also I wonder about the icons

proven lantern
tardy hornet
#

why isnt it working

boreal iron
proven lantern
#

that file should be index.js

spark flint
#

my bot only plays music in one server at a time

#

how to fix

proven lantern
#

and the other should be bot.js

proven lantern
spark flint
#

how

#

wdym

tardy hornet
proven lantern
#

it'll manage the shards

hollow depot