#development

1 messages · Page 1676 of 1

snow urchin
boreal iron
#

Well then 401 means missing permissions

snow urchin
#

i KNOW

#

but it HAS permissions

boreal iron
#

The Authorization header must be a Bot token (belonging to the same application used for authorization), and the bot must be a member of the guild with CREATE_INSTANT_INVITE permission.

#

Checked that?

snow urchin
#

yes

boreal iron
# snow urchin yes

Checked that as well?

If using Gateway Intents, the GUILD_MEMBERS intent will be required to receive this event.

snow urchin
#

yup

#

getting this now

sterile lantern
#
const casea = await punishments.findOne({ CaseID: args[0] });```
#

how come this returns null

#

i did +viewcase 1

#

thats a valid case

shell crest
#

how can I fix thiss

woeful pike
pale vessel
#

isn't args[0] a string?

pale vessel
sterile lantern
#

caseID is a number

#

o

#

wait

pale vessel
#

sorry, args[0]

sterile lantern
#

hm

pale vessel
#

not case id

sterile lantern
#

wouldnt it still work regardless

#

if args[0] was 1

pale vessel
#

how about postgres

woeful pike
#

uh I don't think mongoose magically checks subdocuments

tribal oriole
#

where is dank meme?

pale vessel
#

oh wtf

boreal iron
pale vessel
#

yeah do it like xet or { Punishments: { CaseID: args[0] } }

#

i didn't see the picture

sterile lantern
#

it stillreturns null

#

still returns*

#
const casea = await punishments.findOne({ "Punishments.CaseID": args[0] }); ```
woeful pike
#

mongoose cares about types so you have to cast to a number

#

or just mongodb in general, not mongoose

sterile lantern
#

cast to a number?

#

wym

woeful pike
#

look it up

sterile lantern
#

so like, Number(args[0])

snow urchin
sterile lantern
#

idk cuz if args[0] is a string then it probs wouldnt owrk

pale vessel
sterile lantern
#

ayy works

#

but now to display the info

#

case.map wont work

#

case.UserID

#

hmm

#

yep

woeful pike
#

findOne returns the entire document, not the subdocument you filtered by

sterile lantern
#

its casea.UserID

#

huh

#

it only returned the case ID 1

#

ah wait nvm

#

i only had one case ID in

#

oof

#

so how would i return subdoc

#

confusion,

#

if i am using the case ID to find it

#

then why is it returning case ID's that don't match args[0]

pale vessel
#

that finds a doc that includes the case id provided inside its punishments

sterile lantern
#

o

#

its in an array

#

so couldnt i just

pale vessel
#

the whole doc

sterile lantern
#

filter the array

pale vessel
#

yeah since it's guaranteed to include the case id

sterile lantern
#
{
  Punishments: [
    {
      PunishType: 'Warn',
      Date: 'Mar 29, 2021, 4:28:23 PM',
      Moderator: '526424692366639125',
      CaseID: 1,
      Reason: 'ahaha'
    },
    {
      PunishType: 'Warn',
      Date: 'Mar 29, 2021, 4:48:49 PM',
      Moderator: '526424692366639125',
      CaseID: 2,
      Reason: 'NO'
    },
    {
      PunishType: 'Warn',
      Date: 'Mar 29, 2021, 4:48:51 PM',
      Moderator: '526424692366639125',
      CaseID: 3,
      Reason: 'BYE'
    }
  ],```
#

so do i just filter casea

pale vessel
#

you can just use find()

#

you only need case id 1, no?

sterile lantern
#

yeah

pale vessel
#

yeah just use array.find()

sterile lantern
#

Punishments.find

#

but with what filter

pale vessel
#

a matching case id with the arg

sterile lantern
#

const casea = await punishments.findOne({ "Punishments.CaseID": Number(args[0]) });

#

so just this but punishments.find

pale vessel
#

casea.Punishments.find()?

#

casea is the doc that includes the punishments and one of them matches the provided case id

#

you get me?

sterile lantern
#
let br =  casea.Punishments.find(Number(args[0]))```
pale vessel
#

you need to provide a function

sterile lantern
#

wait no that wouldnt work

#

yeah

#

hmm

woeful pike
#

you can also use a mix of $unwind and $match

#

if you only want to return the filtered subdocument

sterile lantern
#

what function would i use to match the number

#

function checkCase(Number(args[0]))

#

hmm

woeful pike
#

uhh I think it's something like

db.$aggregate([{
  "$unwind": "Punishments"
}, {
  "$match": {
    "Punishments.CaseID": Number(args[0])
  }
}, {
  "$project": { "Punishments": 1 }
}])
clever notch
#

Hi

woeful pike
#

mongodb is overly complicated for doing nested querying

sterile lantern
#

so that would return

#

just the info associated with case ID 1?

#

also whats the 1 here for
"$project": { "Punishments": 1 }

woeful pike
#

you'd get a Punishments key with just the subdocument that matches the given filter

clever notch
#

Can you please give me an webcahin batchfile coz i got errors

woeful pike
#

1 means to include the given key and exclude everything else

rare forum
#

i want to make a discord bot send a message someone sent earlier but add something to it.
with discord.js

sterile lantern
#

db.$aggregate is not a function

#

is db defined as mongoose or the schema

#

well i tried both, still doesnt work

woeful pike
#

oh it's without the dollar sign I think

#

this won't work if you're on mongodb atlas btw

sterile lantern
#

is db defined a-

#

rip

woeful pike
#

they don't allow you to use real mongodb features on the free tier lol

sterile lantern
#

how would i find it via an array then

#

casea.Punishments.find(

woeful pike
#

array.find with the same predicate

sterile lantern
#
"Punishments.CaseID": Number(args[0])```
#

this?

woeful pike
#

yes, convert that to js

sterile lantern
#

what?

#

is that not js?

woeful pike
#

that's not how you pass a callback into find

#

you have to change it a bit

#

aha ok cool this is how you do it

db.aggregate([
  { "$unwind": "Punishments" },
  { "$match": { "Punishments.CaseID": Number(args[0]) } },
  { "$replaceRoot": { newRoot: "Punishments" }
}])

pretty shitty

sterile lantern
#

what is db defined as?

#

mongoose or the schema

woeful pike
#

it's still not going to work for you because you're using a free tier lol

sterile lantern
#

oooooof

woeful pike
#

aggregates are super powerful, if you're gonna use mongodb it doesn't make sense to not use them so mongodb atlas is pretty pointless

#

you're forced to duplicate the search logic instead

sterile lantern
#

for the find, what would i need to do

ornate otter
#
    at OpusScript.decode (C:\Users\Outdated Cosplay\Desktop\LittlePSA\node_modules\opusscript\index.js:82:15)
    at Decoder._decode (C:\Users\Outdated Cosplay\Desktop\LittlePSA\node_modules\prism-media\src\opus\Opus.js:64:25)
    at Decoder._transform (C:\Users\Outdated Cosplay\Desktop\LittlePSA\node_modules\prism-media\src\opus\Opus.js:189:20)```
#

This error just started happening out of no where

#

it used to work like 10 minutes ago

#

and yesterday too

woeful pike
#

it's just regular find, go look up examples

sterile lantern
#
array.find(u => u.discriminator === '1000');```
#

like this?

woeful pike
#

why would you ask me when you have a javascript interpreter in front of you

sterile lantern
#

hmm true

ornate otter
#

cus xetera is big brain?

quartz kindle
#

big bren

sterile lantern
#

AYY i got it

#

:D

pure stream
#

Hey i have a bot and I want to make it so it can do math but I dont know how to get it to. How would i do that?

feral skiff
#

What does a database do for discord bots?

lament rock
#

if anyone knows the pg client on npm, I'm trying to use prepared statements and select a column where it's LIKE a value and I'm not sure how to use both the wildcards and prepared index identifiers. I tried LIKE $1% and that gave a syntax error. Any help is appreciated

pure stream
#

python

#

ok thanks ill try it

ornate otter
#

Tim

#

can u help

#
        throw new Error("Decode error: " + OpusError["" + len]);
        ^

Error: Decode error: Invalid packet
    at OpusScript.decode (C:\Users\Outdated Cosplay\Desktop\LittlePSA\node_modules\opusscript\index.js:82:15)
    at Decoder._decode (C:\Users\Outdated Cosplay\Desktop\LittlePSA\node_modules\prism-media\src\opus\Opus.js:64:25)
    at Decoder._transform (C:\Users\Outdated Cosplay\Desktop\LittlePSA\node_modules\prism-media\src\opus\Opus.js:189:20)
    at Decoder.Transform._read (_stream_transform.js:191:10)
    at Decoder.Transform._write (_stream_transform.js:179:12)
    at doWrite (_stream_writable.js:403:12)
    at writeOrBuffer (_stream_writable.js:387:5)
    at Decoder.Writable.write (_stream_writable.js:318:11)
    at Readable.ondata (_stream_readable.js:717:22)
    at Readable.emit (events.js:315:20)``` it used to work 10 minutes ago then decided it didnt wanna
#

@quartz kindle if u cant its ok

sterile lantern
#
 let cid = await inc.findOneAndUpdate({}, { $inc: { Inc: 1 } })
        data.Punishments.push({
            PunishType: 'Warn',
            Date: date,
            Moderator: message.author.id,
            CaseID: cid.Inc,
            Reason: reason,
        });
        data.save();
    let swarn = new Discord.MessageEmbed()
        .setTitle("Sucess!")
        .setColor("GREEN")
        .setDescription(`I have sucessfully warned the user! Details below.`)
         .addFields(
  {name: "User Warned", value: `${toWarn}`, inline: true},
  {name: "Case ID", value: `${data.Punishments.CaseID}`, inline: true}
  )```

how come case id returns undefined
#

i tried data.CaseID

#

nvm

#

i just did cid.Inc for it

hazy horizon
#
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:925:15)
    at Function.Module._load (node:internal/modules/cjs/loader:769:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)        
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []```
sterile lantern
#

that file doesnt exist is what it's saying

drifting wedge
#

how do i delete a message in dpy?

hazy horizon
sterile lantern
#

i'm assuming your using VSC or atom?

#

or a code editor

#

of some sorts

hazy horizon
#

yes

full orchid
#

uh

hazy horizon
#

where do I fix the path?

#

@sterile lantern

sterile lantern
#

uh

#

im not sure

#

find your bot.js file in windows explorer

#

and copy the path

#

oh wait

#

i think the issue is

#

that you dont have bot.js in that folder

hazy horizon
#

ah

#

I dont even have a file called bot.js

sterile lantern
#

thats why

#
 let br =  casea.Punishments.find(c => c.CaseID === Number(args[0]))```
#

how would i delete this now

#

like remove the entry from the db

hazy horizon
#

fixed 👍

earnest phoenix
#

I have successfully install phpmyadmin but when i go to localhost/phpmyadmin, is a blank page

#

how can i do?

sterile lantern
#
 let br =  casea.Punishments.remove(c => c.CaseID === Number(args[0]))```
#

i tried this

#

but it doesnt delete from db

prisma wren
#

https://sourceb.in/054KyhQ2eX when i node it, the terminal says it's online and it comes online like it should but when i try to test a command, it doesn't work. The terminal doesn't even say smth is wrong like normal. I'm using JavaScript

quartz kindle
#

length

prisma wren
#

i feel so dumb rn, thanks

quartz kindle
#

.remove(id)

#

or whatever key you saved it with

graceful shore
#

how can i fix this?

const channel = member.guild.channels.cache.find(ch => ch.name === "welcome");

(it isnt cached)

vivid fulcrum
hazy horizon
#

what does this mean?

sterile lantern
#

install node

opal plank
#

actually

#

i played with opus

#

dont do it

vivid fulcrum
#

lavalink is garbage

opal plank
#

its finicky as fuck

sterile lantern
#

I tried .remove but it doesn’t delete the warning

opal plank
vivid fulcrum
#

lavalink is good enough for people who really have no clue what they're doing

opal plank
#

indeed, i agree

hazy horizon
opal plank
#

but its a lot easier to fuck with than manual connections

#

its finicky as fuck

#

raw opus i mean

hazy horizon
#

i did the right one, was i supposed to do the left one?

vivid fulcrum
#

i got it working within an hour christmasthink

opal plank
#

i sent you last time JUST the problems of INSTALLING it

vivid fulcrum
#

yeah well, that's because node™️

opal plank
#

afterwards it got worse

#

really worse

#

handling connections is really delicate

vivid fulcrum
#

doing native addons in node sucks so much

#

you need 3 different environments

opal plank
#

i had manage to install opusscript and get it running

#

after 30 minutes in, i said fuck it and went with lavalink

#

could've done it no problem with opus

#

the issue is the errors and de-syncs

#

its insanely infurating dealing with all of that

snow urchin
vivid fulcrum
#

the desyncing is more than likely a product of mistimed packets

#

but oh well

opal plank
#

its still a problem that needs to be fixed

#

and i didnt wanna deal with it

#

in all honesty

graceful shore
opal plank
#

COULD =/= SHOULD

vivid fulcrum
#

guild#fetch()

graceful shore
#

thought so

opal plank
#

would've prob spent around 3 or 4h properly setting it up

vivid fulcrum
#

it's a promise btw

#

so you should probably await it

opal plank
#

@snow urchin wrong

#

axios already parses the payload for you

pure stream
#

How do i make messages embed?

snow urchin
#

ignore the axios part, its actually node-fetch

opal plank
#

you can also call axios.post() instead

snow urchin
#

switched from axios to node-fetch cause axios created issues somehow

opal plank
#

cuz you are trying to json() something that is already json

pure stream
#

also how would i make a list without it being screwed up

#

oop

#

sorry forgot it had an invite in it

vivid fulcrum
graceful shore
vivid fulcrum
#

well

#

you said the channel is not in cache

pure stream
vivid fulcrum
#

if it's not in cache, you have to fetch the guild

opal plank
# snow urchin wut lol
let { data } = await axios.post('hhtps://123.com', {data: {/*body here*/}}).catch(() => { data: null });

use something like this instead

snow urchin
#

not using axios

graceful shore
#

so i cant get the channel?

snow urchin
#

said this already

opal plank
#

then why u put axios there

vivid fulcrum
#

once you fetched the guild, you can then query the channels as they're going to be in cache

snow urchin
#

cause it WAS axios, but axios was being annoyin so switch to node-fetch

#

just didnt update var name

opal plank
#

axios is better than node my dude

vivid fulcrum
snow urchin
#

i know, but it was being a right nob

opal plank
#

it has proper error catching and parses the payload for you

#

also why you doing a POST to a member?

snow urchin
#

its put

#

i have PUT

#

not post

opal plank
#

ah right

snow urchin
#

dk where u got that from

#

😄

opal plank
#

you trying this?

snow urchin
#

mhmm

#

done your axios code, getting bad request now

opal plank
#

cuz its data{}

#

not body:{}

snow urchin
#

oh wait

#

shh im blind

graceful shore
snow urchin
vivid fulcrum
#

although, if you're using regular djs, all channels should be in cache at all times

opal plank
#

idk if the acces_token is 1 time use

snow urchin
#

its a new at

vivid fulcrum
opal plank
#

hmmmmm

#

im running out of ideas in all honesty

graceful shore
#

using const channel = member.guild.channels.cache.find(ch => ch.name === "welcome"); requires intents tho doesnt it

vivid fulcrum
#

no it doesn't

graceful shore
#

wtf why isnt it working now then

vivid fulcrum
#

i don't know

#

it's your code

#

debug it

opal plank
#

@graceful shore you using vsc?

graceful shore
#

i didnt do anything to the code

opal plank
#

visual studio code

graceful shore
opal plank
#

i mean your editor

#

is it visual studio code?

#

this

snow urchin
graceful shore
opal plank
graceful shore
#

notepad XD

opal plank
#

YIKES

#

download vsc

#

and start using that instead

graceful shore
#

i have it lol

royal herald
#

is node-fetch is better then request?

opal plank
graceful shore
#

oh turns out i do have visual studio code, i thought i only had the 2017 version installed

snow urchin
opal plank
#

updtae it and use that instead

opal plank
graceful shore
opal plank
#

fuck whats the thing

snow urchin
#

loool

pure stream
#

how do you make the bot respond with embed

opal plank
#

there we go

small tangle
#

developers?

#

oh already

graceful shore
#

im in it

opal plank
#

now read this

graceful shore
#

ok so i have my code in visual code.... now what lmao

opal plank
#

read that

small tangle
#

man when i see the JS, im really missing nice template strings

opal plank
#

you'll never have questions regarding why is this not working again

#

cuz you can see your code real-time

graceful shore
#

ok

snow urchin
#

this reminds me of the time erwin struggled for ages to get the debugger working on my vscode, then just.. gave up

#

LOL

graceful shore
#

i have no errors tho

opal plank
#

it doesn need errors to work

opal plank
boreal iron
#

Erwin’s trying... oldEyes

opal plank
graceful shore
opal plank
#

you debug your code, if something doesnt work like you thought, debug it there

graceful shore
opal plank
#

you didnt read the guide at all did you?

#

you put a breakpoint into stuff you want to debug

graceful shore
#

ok

snow urchin
#

ok at erwin giving me wrong axios code now getting 403 error, thats.. progress

opal plank
#

wait what/?

snow urchin
#

this works

#

but now getting 403

sour flame
#

to edit code

graceful shore
#

me

sour flame
#

how???

graceful shore
lyric mountain
#

language?

#

oh, node

graceful shore
lyric mountain
#

already figured it out, node right?

graceful shore
#

yeah

#

discord.js

snow urchin
lament rock
#

The access token is probably invalid and needs refreshed

#

Or it's as simple as the fact that request bodies need to be a string

sour flame
#

I want to know how to make it so you can only buy 1 pc here code ```js

@client.command()
async def bag(ctx):
await open_account(ctx.author)
user = ctx.author
users = await get_bank_data()
try:
bag = users[str(user.id)]["bag"]
except:
bag = []

em = discord.Embed(title = "Bag")
for item in bag:
    name = item["item"]
    amount = item["amount"]

    em.add_field(name = name, value = amount)  
    
await ctx.send(embed = em)  

async def buy_this(user,item_name,amount):
item_name = item_name.lower()
name_ = None
for item in mainshop:
name = item["name"].lower()
if name == item_name:
name_ = name
price = item["price"]
break

if name_ == None:
    return [False,1]

cost = price*amount

users = await get_bank_data()

bal = await update_bank(user)

if bal[0]<cost:
    return [False,2]

try:
    index = 0
    t = None
    for thing in users[str(user.id)]["bag"]:
        n = thing["item"]
        if n == item_name:
            old_amt = thing["amount"]
            new_amt = old_amt + amount
            users[str(user.id)]["bag"][index]["amount"] = new_amt
            t = 1
            break
        index+=1 
    if t == None:
        obj = {"item":item_name , "amount" : amount}
        users[str(user.id)]["bag"].append(obj)
except:
    obj = {"item":item_name , "amount" : amount}
    users[str(user.id)]["bag"] = [obj]        
with open("mainbank.json","w") as f:
    json.dump(users,f)
await update_bank(user,cost*-1,"wallet")
return [True, "Worked"]

async def update_bank(user, change = 0, mode = "wallet"):
users = await get_bank_data()
users[str(user.id)][mode] += + change

with open("mainbank.json", "w") as f:
json.dump(users, f)
bal = (users[str(user.id)]["wallet"],users[str(user.id)]["bank"])
return bal

vivid fulcrum
#

consider using not json

sour flame
#

ye I gave up on db

lament rock
#

json is not a database

sour flame
#

ik

#

I just want to make it so that you can only buy 1 pc

lament rock
#

I believe you'd get more mileage out of learning SQL statements and use a database like MariaDB or Postgres.

sour flame
#

Ok

arctic epoch
#

Guys

#

I also want to make a bot :)

graceful shore
#

i have no idea what im doing

arctic epoch
#

Drako is helping me rn

#

Thx for help

#

I will ask ya later

long crow
#

Almost everything, since the documentation is mostly autogenerated, and hard to get support

graceful shore
snow urchin
earnest phoenix
#

when i change the page it a tag to the user. what should i do?

graceful shore
opal plank
long crow
#

The very first step, understanding from where to where on documentation

opal plank
#

theres 2 places you should seek to understand it

long crow
#

like if I wanted the same thing as <message>.channel.send

opal plank
#

its the same

#

but createMessage()

long crow
#

I donno where would I start looking

opal plank
#

instead of .send()

#

<message>.channel.createMessage()

#

are you using typescript?

long crow
#

no

opal plank
#

you should, let me show you why

#

@long crow behold typescript and its intellisense with auto-complete

unreal estuary
#

does auto complete not work with js

#

what

opal plank
#

if you got the plugins for it, should, but ts offers integrated docs out of the gate

unreal estuary
#

ah

#

i havent rlly looked into typescript b4

#

maybe i will

opal plank
#

if you code on js, you should 100000% move to ts

#

ts IS javascript

#

but better

#

in almost every sense

unreal estuary
#

ok

opal plank
#

can send you a link if you want to know more about it

unreal estuary
#

ok can u dm me it

#

i should sleep now but ill look into it tomorrow

opal plank
unreal estuary
#

ok

opal plank
#

the intro should tell you a lot of the amazing things ts offers

unreal estuary
#

thx

opal plank
#

np

#

theres quite a few people here using Ts now, i recall a couple months ago where basically me and @cinder patio were the only people who used it

unreal estuary
#

lol

onyx jay
# sour flame ye I gave up on db

(sorry late to this)
not sure what types of DB you have tried in the past, but one that I find very straight forward for python is SQLite with a library called peewee.

You can download a DB browser like this one (https://sqlitebrowser.org/) and create a DB file, then configure your database however you want (you could just have one column for user ID's that have a PC), then using peewee's tool called pwiz (http://docs.peewee-orm.com/en/latest/peewee/playhouse.html#pwiz), you can run a command that creates a python file with your entire database structured in the form of classes and variables. From there, you can use peewee's querying operators (things like select, from, etc) along with the name of the database model to easily get things in list form.

Sorry if this isn't at all useful, but I figured I would just share this as it's been way easier for me to configure compared to other methods

arctic epoch
#

hmm

#

guys

#

i ned help

#

@client.command()
async def 'name'(ctx):
ctx.send('Text')

#

what should i type in ctx

arctic epoch
#

ya

#

im starter

lusty atlas
#

Idk

arctic epoch
#

idk anything

#

bruh

lusty atlas
#

I'm kinda started

arctic epoch
#

oh

#

me too

#

lol

lusty atlas
#

I already made a bot

arctic epoch
#

oh

lusty atlas
#

But idk ctx thingy

arctic epoch
#

oh

#

hmm

#

k

#

cya

lusty atlas
#

Type any

#

Like type the bot name

arctic epoch
#

hmm?

#

oh

#

hmm

#

k

#

wait

lusty atlas
#

Any examle

arctic epoch
#

oh hmm

lusty atlas
#

Example*

arctic epoch
#

lemme test

#

bro i use python

lusty atlas
#

Oh

#

I use JavaScript

graceful shore
#

@opal plank i think i found the problem

#

client.on('guildMemberAdd', async member => { }); just wont do anything

#

same with remove

#

it wont even log "member"

#

so strange

opal plank
#

@graceful shore cuz you arent doing anything with the code

#

whats inside the brackets?

#

also

#

do you have intents enabled?

graceful shore
opal plank
#

then, you got intents enabled?

graceful shore
opal plank
#

you NEED intents to use members

graceful shore
#

right

#

do u think discord will let me have them just for a welcome function? @opal plank

opal plank
#

yeah, they usually allow for welcome messages

graceful shore
opal plank
#

your bot already verified?

graceful shore
#

yes

opal plank
#

then it takes a bit longer

#

requesting new intents usually require more time

graceful shore
#

yeah i tried applying for intents before for a /serverstats command and they declined my request so i doubt they will for this

opal plank
#

serverstats doesnt need it

#

they were right to deny

#

but welcome function needs it

graceful shore
#

right ok

#

guess ill apply

zenith terrace
#

pain of having to apply got intents

graceful shore
feral arch
#

Hi (: Regarding to Commando.js framework, Is it possible to make subfolders inside groups folders to store my commands? like
commands

  • group1
    • subfolder1
      • command.ts
  • subfolder2
    • command2.ts

Commando does not seem to recognize commands in subfolders

arctic epoch
#

guys

#

can anyone help me make a bot in repl

umbral zealot
#

You don't make a bot in repl, you make it in a language, using a library, and just put that code in repl.

#

what language/library do you want to use?

arctic epoch
#

oh

#

idk about them

#

im starter

#

idk about anything rn

umbral zealot
#

Then you need to start by choosing, and learning, a programming language.

arctic epoch
#

can ya guideme

umbral zealot
#

That's the first step

arctic epoch
#

oh can ya help

umbral zealot
#

assuming you're ok with choosing javascript

arctic epoch
#

hmm

#

idk any langs

umbral zealot
#

JavaScript is a pretty good starting language, it's relatively easy to pick up

#

Python is also said to be easy to learn

arctic epoch
#

oh ok sure

#

so java

#

lesgoo

umbral zealot
#

No, not Java

#

JavaScript

arctic epoch
#

k

#

javascript

#

hmm

umbral zealot
#

But either will be weeks/months of learning, so, strap yourself in, it'll take a while.

arctic epoch
#

k

#

sure!!

#

i really wanna make a bot

#

hmm

#

now what next?!!

umbral zealot
#

The first step, what I linked, will take you weeks and months. that's your next step

arctic epoch
#

hmm

umbral zealot
#

As in: take the time to learn a programming language

arctic epoch
#

oh hmm

umbral zealot
#

There is no easy route here. Programming is hard, you have to dedicate yourself to learning something.

arctic epoch
#

hmm sure

#

btw

#

do u know python

umbral zealot
#

I don't

arctic epoch
#

hmm

#

then what do u know?

umbral zealot
#

Have you clicked the link I sent?

arctic epoch
#

hmm yup

umbral zealot
arctic epoch
#

hmm

#

wait

#

@umbral zealot

umbral zealot
#

hmm

arctic epoch
#

bruw

umbral zealot
#

what

arctic epoch
#

like python i used it in repl

#

so

#

what place should i use the java scrpt

umbral zealot
#

You can use javascript on repl.it also

arctic epoch
#

oh

#

hmm

umbral zealot
#

It's the "nodejs" repl

arctic epoch
#

oh

#

hmm

umbral zealot
#

hmm

arctic epoch
#

now how to start of

#

@umbral zealot

umbral zealot
#

Do I have to link the same thing again

arctic epoch
#

hmm

umbral zealot
#

hmm

arctic epoch
#

bro @umbral zealot

#

thats a lot to read

#

btw

solemn latch
#

learning to program is a lot to read

#

can take hundreds of hours of practice

arctic epoch
#

can i get some info about making bot with repl

#

using javascript

solemn latch
#

code the bot in repls editor, they have docs.

mental willow
#

hey guys just wondering what i am doing wrong, my discord bot isnt adding / commands to discord

i dont know why and there is no errors being thrown
here is my sample code for this issue


from discord_slash import SlashCommand, SlashContext

bot = commands.Bot(command_prefix=str(config['SETTINGS']['CommandPrefix']), intents=discord.Intents.all())

slash = SlashCommand(bot, sync_commands=True)


@slash.slash(name="testping")
async def _ping(context):
    d = datetime.utcnow() - context.message.created_at
    s = str(d.seconds//1000 + d.microseconds//1000)
    embed = discord.Embed(title='Ping', color=0xffffff)
    embed.add_field(name=':ping_pong:', value=f'{s}ms')
    await context.channel.send(embed=embed)

as you can probably tell i have not included all the commands, but this is the only code related to my slash commands

Please Ping me if you can help, as i have not been able to find anything on stack overflow and the Docs are very difficult to understand

#

what is the name of the bot file @earnest phoenix

umbral zealot
#

That usually happens if the file is empty or you didn't actually save it.

#

like this

#

no that's a folder not a file

#

the file would be index.js or bot.js or main.js or whatever

#

make sure to save, it CTRL+S

mental willow
#

well try @umbral zealots thing and try

node index.js

umbral zealot
#

Happens to the best of us don't worry 😄

mental willow
umbral zealot
mental willow
#

6 hours of coding

gone...........

umbral zealot
#

Well, at least you learned a super important lesson!

mental willow
#

yea h

#

i got 500 back tho, due to autosave tho

lusty atlas
#

I have a bit of probz

#

I'm beginner

#

But can someone come to the voice channel?

earnest phoenix
#

What lang? @lusty atlas

lusty atlas
#

I'm using JavaScript

earnest phoenix
#

so you're using discord.js correct

lusty atlas
#

Yea

earnest phoenix
#

i can probably help you out then

#

do you have basic javascript knowledge?

lusty atlas
#

Kinda

#

Soo ur helpin'

#

Or?

summer torrent
lusty atlas
#

Oh

#

Right

earnest phoenix
#

hey does anyone have any knowledge on why my bot just randomly went offline with no errors, because my bot just got declined due to it being offline

umbral zealot
#

could be a number of reasons but just "went offline" is a bit too vague to be helpful, I think

ripe shadow
#

It only works if in your package.json have a main like this.

{
  "name": "(the name)",
  "version": "1.0.0",
  "description": "",
  "main": "Index.js or file name",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "discord.js": "^12.5.1"
  }
}
umbral zealot
#

We've already fixed that issue...

ripe shadow
#

Oh sorry

umbral zealot
#

smh

ripe shadow
#

.-.

umbral zealot
#

Always remember to scroll to the bottom of the channel before you start answering questions, folks! Only you can prevent forest fires answering hour-old messages

feral arch
#

Hi (: Regarding to discordjs commando framework, Is it possible to make subfolders inside groups folders to store my commands? like
commands

  • group1
    • subfolder1
      • command.ts
  • subfolder2
    • command2.ts

Commando does not seem to recognize commands in subfolders

lusty atlas
#

I have rlly annoying prob

#

Can anyone help??

umbral zealot
#

Show us index.js line 6

nimble python
#

Help

#

I'm using the top.gg API but when someone votes for my bot, the user ID appears but I want the name to appear

#

how can I do that?

umbral zealot
#

What's your code right now?

nimble python
#
let user_vote = req.vote.user;
.setDescription(`El usuario con el ID: `+user_vote+` ha votado por mi!`)
#

@umbral zealot

umbral zealot
#

Right so presumably discord.js

#

You can pull the user from client.users.cache.get(user_vote) to get their user object

#

From there you can get their tag, a mention, etc

nimble python
umbral zealot
#

Use its properties as described in the discord.js docs

#
nimble python
#

but I'm using the top.gg so it must be a different way, right?

umbral zealot
#

This has nothing to do with top.gg

#

You need to fetch the user info from discord.js

#

Because top.gg only provides the id, but that can be used to fetch the user.

crystal wigeon
#

anyone use lavalink?

opal plank
crystal wigeon
#

when you dc a bot manually

#

it doesn't changestate

#

so the bot never joins back

#

for some reason

earnest phoenix
#

It is a goodnight here

crystal wigeon
#

i dont see any logs

opal plank
#

which lib u using?

crystal wigeon
#

i just see the trakc name being searched

#

erelajs

opal plank
#

are you logging voice states?

earnest phoenix
#

ok support and general is dead and i need help with an issue is this a good place to get said help ?

opal plank
#

from erelajs?

crystal wigeon
#

yeah it logs on the lavalink overlay

opal plank
#

nono, the raw state

#

from discord

crystal wigeon
#

lemme try

#

there a lot of state updates,

#

anyways

#

the one im looking for is voice state change right?

#

there's no state log when i dc it manually

opal plank
#

voiceStateUpdate

#

this is the event you looking for

crystal wigeon
#

yeah

#

it did log

#

both for join and dc

#

but they're both same mmmm. there's no indication of what action is being carried out?

opal plank
#

wait

#

when the bot leaves?

#

or the person who requested?

crystal wigeon
#

when i manually "disconnect" the bot

opal plank
#

then it should pass under voiceServerUpdate iirc

crystal wigeon
#

but its not being reflected on lavalink?

#

it used to before

opal plank
#

idk what you feeding it, never used erelajs

crystal wigeon
#

see the voiceUpdates?

#

after i dc the bot, all it logs is the search

#

it even says the player was destroyed. but it never joins the vc again

opal plank
#

hmmm im not sure tbh

crystal wigeon
#

mindfk, it used to work before

#

there's no server state update. for both join and dc manually it sends the same voice state update

long crow
#

@opal plank Short browsing, might understand the flow how to read the documentation

opal plank
long crow
#

Maybe try out my discord bot version in djs into detritus during this weekend

opal plank
#

it would be much better to use typescript and get intellisense directly onto vsc

long crow
#

not familiar yet with TS, so I stick for JS

opal plank
#

well, your loss, ts by itself is worth it

#

you saw the perks of it

#

not only it completes for you

#

it also tells you whats wrong or not

long crow
#

I mean, I can't run without learning to walk first

opal plank
#

in js you would have to try it and catch the error that way

#

here you get it before running it

#

ts IS js

#

theres no learning curve

#

you can setup ts to be lax at the beggining

crystal wigeon
#

is there an event i can listen to on the client itself? for manual voice dc

opal plank
#

dont think so

#

well

#

if you're leaving manually

#

why not do it in the command?

#

ignore the event

crystal wigeon
#

if the bot gets disconnected manually

opal plank
#

manually as in kicked?

#

or manuallyl as in command?

crystal wigeon
#

yeah like from the vc

#

not command

#

the command one works fine

#

when the bot is playing music in a vc, and someone manually disconnects it by right clicking on the bot and "disconnect"

#

thats when it doesnt rejoin

#

if there's an event it emits, when this triggers

#

i could probably do something

opal plank
#

it should be the same

#

vsu

crystal wigeon
#

i dont get an event when i do the command

#

the command is pretty much straight forward. typing "bot dc" would be the trigger for me to destroy the player

#

etc

opal plank
#

are you listening to both events?

crystal wigeon
#

nop

opal plank
#

voiceStateUpdate
voiceServerUpdate

#

you need BOTH

crystal wigeon
#

the voice update events are automatic

#

voiceserverupdate isnt there

#

when i disconnected it manually

opal plank
#

then add it

crystal wigeon
#

on the "raw"?

opal plank
#

wdym on the raw?

crystal wigeon
#

the "raw" event doesnt have that voiceServerUpdate

#
    if (d.t == "VOICE_STATE_UPDATE") {
      console.log(d)
    }
    client.music.updateVoiceState(d)
  });```
#

this one

#

i checked the d

#

it has message typing etc

#

when i dc manually it throws voice state update

mortal plank
#

Hi

crystal wigeon
#

never the voiceserverupdate

#

i found my problem, its actually in the queue

#

when i dc, the queue doesnt get cleared

#

i need a trigger for it

#

the "dc" command would be 1 trigger

#

but when someone does it manualyl there's no trigger

opal plank
#

its right here

#

if your lib doesnt have voiceServerUpdate

#

its shit

crystal wigeon
#

well like i said, when it gets disconnected manually, it throws a voice state update, and the lib automatically destroys the player

#

the problem is with my queue that still exists

#

and isnt cleared

#

when its manually disconnected

opal plank
#

then i've no clue

crystal wigeon
#

both voice state changes have the exact same object

opal plank
#

sounds like a lavalink issue

crystal wigeon
#

there's no indication if the bot was disconnected

#

nop, i see the "destroy player" operation

#

when it dc manually

#

nvm i figured it out lol

sage bobcat
#

One message removed from a suspended account.

icy skiff
#

Are reactions rate limited or smth rn

#

my bot has the thingy that you pass pages with reactions

#

but after adding/removing the same reaction three times discord keep taking the reaction off or smth idk

#

i thought i messed something up but same thing is happening with other bots i tested

sage bobcat
#

One message removed from a suspended account.

icy skiff
#

yes yes i know that but

sage bobcat
#

One message removed from a suspended account.

icy skiff
#

whats happening rn is kinda weird and i dont think should be happening?

#

like

#

Mudae for example, which is a pretty famous bot

#

I used a paging command

#

added reaction like just three times

#

and it stopped working

#

i thought it was an issue with my bot but after i saw it happening to mudae as well i think theres something wrong with the api idk

thin echo
#

I’m trying to separate a command so that only I, the creator, can use it. No one else. Is this a thing I can do? Discord.oh

#

.py

icy skiff
#

Yes

thin echo
#

Mary you help me please?

#

May*

#

Auto correct sucks

icy skiff
#

Lmao

thin echo
#

lol

icy skiff
#

Use the check decorator

#

@commands.check(your_function_here)

thin echo
#

?

icy skiff
#

Your function should return True or False

thin echo
#

I will just search the web, but I will keep this in mind

slender thistle
icy skiff
#

Just create a function that returns true if the id is your id

#

And pass it at the check decorator

thin echo
#

Ok?

slender thistle
#

With commands.ext you can just @commands.is_owner()

#

With on_message you can if message.author.id != your_id: return

icy skiff
#

I mean ye but sometimes you want to allow not only youself but maybe a few selected people

#

Like Mods or smth

slender thistle
#

Then that's on server permissions, which is @commands.has_permissions

icy skiff
#

That's not what i meant

#

xd

slender thistle
#

A group of people... I don't remember if passing owner_ids to commands.Bot reflects on is_owner

#

They did specify "and no one else" so

icy skiff
#

I just do

return ctx.message.author.id in (id1, id2, etc)

#

And pass It in a check decorator

slender thistle
#

Eh works too

icy skiff
#

Btw

#

Could you be as kind to explain to me why that's happening

#

That problem is Messing with my bot as well

opal plank
icy skiff
#

Shhhhh

slender thistle
#

You're spamming reactions

icy skiff
#

Não conta pra ninguém

slender thistle
#

Discord has a ratelimit on those

#

Just try not to click as often

opal plank
#

@icy skiff press ctrl + shift + i

icy skiff
#

Same thing

opal plank
#

@icy skiff do it

icy skiff
#

I did it

opal plank
cinder patio
#

Maybe discord increased the rate-limits

opal plank
#

make sure you're on this tab

#

Console

icy skiff
#

I am

opal plank
#

okay

#

now spam the reaction

icy skiff
#

Yeee

#

Red text

#

Red texts are never good

opal plank
#

show it

icy skiff
#

its not happening just with me btw

opal plank
#

click on it

#

not on the link

#

just expand the text

cinder patio
#

Bad requests and too many requests

opal plank
#

i assume its ratelimits

cinder patio
#

yeah

opal plank
#

but i want him to collapse it so i can be sure

icy skiff
opal plank
#

oh

#

right

#

mime

#

actually

icy skiff
#

what

opal plank
#

400

icy skiff
#

its just happening with bots

#

i can spam people's messages with reactions

#

but any bot

#

it gets rate limited after 2 or 3 reactions

#

permanently

opal plank
#

do you have any client mods?

icy skiff
#

sorry for my stupidity but i dont know what that is

opal plank
#

perfect, then i assume you dont

icy skiff
#

kek

opal plank
#

your acc might have been flagged for reaction spam possibly

icy skiff
#

i mean, if u have any bots to test it i think u could try it yourself, pretty sure same thing will happen

#

its not just me

#

i asked some random friends and same thing

#

and as i said only happens with bots' messages

#

i can spam YOUR messages for example

#

but not bots'

opal plank
icy skiff
#

kek

#

no but like

#

any bot that has any command that works with reactions

#

just add/remove the reaction twice or thrice and BOOM

#

stops working

opal plank
#

well, i dont see the issue, thats probably an intended discord feature, they are likely trying to prevent peple from abusing bots

#

its ratelimits

#

period

icy skiff
#

that legit sucks

opal plank
#

how so?

#

spam = bad

icy skiff
#

no yes but like

#

my bot has a album thingy right

opal plank
#

blame whoever coded the bot if they have 30+ pages you gotta flip through

icy skiff
#

u do a command and it gives u 10 stickers

#

u pass the stickers with reactions

opal plank
#

add a search function then

icy skiff
#

u cant see past sticker 3

opal plank
#

or a page selector

icy skiff
#

ye but it was working 15 minutes ago okeh

opal plank
#

clearly isnt anymore, so fix it

#

add a page selector

#

dont rely on people spam

#

nobody is going thru 30 pages, sorry to give it to you

#

10 is already much

icy skiff
#

ok

#

lemme give ya a example real quicc

#

Mudae right, everyone knows mudae

#

it has that command that u search a character

opal plank
#

i dont

craggy pine
#

Just poking my head in and curious on what you're saying Erwin.

icy skiff
#

uh

#

its an anime bot

#

u can search characters

opal plank
#

well, idk about bots in general

icy skiff
#

and characters have pictures

#

u can scroll through pictures

craggy pine
#

Pagination when there's 30 pages but you go through them pressing
<-- -->
emojis is fine since it's only two

craggy pine
#

I mean, we do it mexShrug

icy skiff
#

bro

opal plank
craggy pine
#

Never been ratelimited.

opal plank
#

cuz we dont spam it

#

its client spam miyuka

craggy pine
#

Ah.

#

Gotcha.

icy skiff
#

lve seen dozens of bots working like that so its kinda weird it being broken all of a sudden

opal plank
#

his client is being ratelimited cuz he's spam clicking like a madman

icy skiff
#

pretty famous ones

#

mudae is always on top page on top,gg

#

lol

craggy pine
#

Oh.

opal plank
#

thats a pretty bad way to run things dude

icy skiff
#

its getting rate limited after two clicks

craggy pine
#

Could throw in a custom rate limiter with the system itself. Like only can react ever few seconds.

opal plank
#

just cuz they do it, i'll do it too

icy skiff
#

that definitely shouldnt be intended

craggy pine
#

Idk we make sure people can't abuse.

opal plank
craggy pine
#

It do be like that.

icy skiff
#

i totally agree with you BUT

#

as i said

icy skiff
#

same thing is happening with friends

thin echo
#

I find it more formal to say in japanese

icy skiff
#

that dont even use the bots

opal plank
#

like i said, probably discord ratelimiting people

#

which is good

icy skiff
#

it IS good

opal plank
#

preventing reaction spam for us bot devs

craggy pine
#

Indeed.

icy skiff
#

but not LIKE THAT

opal plank
#

it IS good

icy skiff
#

not after TWO GODDAMN CLICKS

opal plank
#

if you bot requires 5 reactions to do something its shit

#

sorry

icy skiff
#

bro come on

#

its not REQUIRED

#

its just for fun

opal plank
#

join my support server

#

and check bot-spam

icy skiff
#

people scroll thorugh pictures, stickers, whatever

#

dm me ur support server plz

opal plank
#

just click me

icy skiff
#

oh

craggy pine
#

U know what. I'll join you aswell bec Erwin is poggers

frigid mountain
#

Poggers

opal plank
#

@slender thistle, @icy skiff got a question for ya

slender thistle
#

A

icy skiff
#

yes

#

ok

#

so

#

weird things are happening and my head feels like exploding

#

so

#

my bot has a pagination command right

#

people use reactions to pass pages

#

if i use such command on server x

#

the reaction gets rate limited after 2 reactions or smth

#

if i use same command on server y

#

works like a charm

#

ill record a quick video just a sec

thin echo
#

is there anyone I can DM and ask if the gif I have is epileptic?

pale vessel
#

dm a moderator

thin echo
#

ok

#

who to choose

icy skiff
pale vessel
#

dylan is poggers

thin echo
#

choosing safe

pale vessel
#

oh

#

that's good

thin echo
#

ok

earnest phoenix
#
const client = new Discord.Client({ allowedMentions: { parse: [] } });```
#

Correct?

#

For not mentioning everyone, here & roles

pale vessel
#

yes

#

also, TIAS

#

no point asking here

earnest phoenix
#

Hmm Ok

icy skiff
slender thistle
#

My guess is your ratelimit was increased for spamming reactions

#

Guess you'll have to wait

icy skiff
#

i showed in the video, it works at one server but not on the other

slender thistle
#

I'm not sure if reaction ratelimits are tied to guilds or channels

icy skiff
#

but it also doesnt work for some friends of mine?

#

i dont get it

#

ill wait for tomorrow and see if its back to normal

slender thistle
#

Well I have absolutely not a fucking clue XGWkekwlaugh