#development

1 messages · Page 1864 of 1

green vale
#

I buy all from Porkbun or Namecheap or Name and then transfer to CFR

green kestrel
#

cf dont put a markup on, you cant get cheaper for renewal

#

but they STILL dont do .co.uk 😦

#

or .cc 😦

green vale
#

yea they only charge what the NIC charges

#

.co.uk makes sense as they're not doing ccTLDs until they get a sizeable amount of gTLDs

spark flint
#

then i redeemed my free student domains using nc.me (namecheap) and name.com (loads of tlds)

#

i still have a free .tech domain

green vale
#

there are two name.com offers that u can get

#

two free domains, as long as u have access to Azure Student

spark flint
#

i got two free domains using github student

green kestrel
#

i used to buy domains to use with silly reverse DNS on irc

green vale
#

Azure has a free Name domain, GitHub has a free Name, and then a free .me

spark flint
#

i'm 15 and currently own 14 domains with namecheap

green kestrel
spark flint
#

i also have like 4-5 with lcn

#

and one with brixly (transferred there as i use them for reseller hosting)

green kestrel
spark flint
green kestrel
#

nice

green vale
#

sometimes i fuck around with IPs on OVH and host really fucking stupid shit in VMS with those IPs, having dumb as fuck rDNSes

green kestrel
#

put a path on its web

spark flint
#

and i plan to buy eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeea.sports when the .sports tld is relased

spark flint
#

good idea

#

i bought a domain for my custom nameservers which i now also use for dynamic dns

green vale
#

or even funnier just make it a png

spark flint
green vale
#

well png path

spark flint
#

give me a min

green vale
#

with a MIME type of HTML

green kestrel
#

you got many ipv4s dannington?

green vale
#

yee

#

like

#

i think i have like two /29 blocks and three /30 blocks for each one of my dedis

green kestrel
#

nice

green vale
#

so two 8 blocks and three 4 blocks

green kestrel
#

i just have an additional set of 8

#

theyre kinda hard to get these days in a lot of places

#

on ovh you just fill out a form and they allocate them

green vale
#

fair enough, my dedis aren't that powerful but i need a lot of IPs to run DDoS protection

green kestrel
#

i guess in sets of 8 or 16 they dont ask too many questions

green vale
#

OVH has had a hard time with IPs

green kestrel
#

how so

#

you mean getting them from RIPE etc?

green vale
#

once it took them like three hours to assign a four block

#

they're running low in terms of IP allocations from RIPE and ARIN

green kestrel
#

ah

#

but they give everyone like a /48 of ipv6

#

can just use that for most things 😄

green vale
#

and they're in like a massive amount of debt, their dcs are rotting like yesterday they literally had a water leak in their GRA1 datacentre

spark flint
#

i fixed it

#

sorry for sending it twice lol

green vale
#

yea but OVH's IPv6 routing is weird as hell

spark flint
#

i made the site ugly

green kestrel
#

their routing 'feels like' its an ipv6 over ipv4 tunnel

green vale
#

it is an IPv6 over IPv4 type of thing

green kestrel
#

i get similar routing and stuff to tunnelbroker

green vale
#

i think you assign IPv6 using IPv4 IPs

#

compared to your typical IPv4 which assigns using MAC

green kestrel
#

on my box, the ipv6 are dhcp6 :/

#

like whyyyyyyy

green vale
#

pain

green kestrel
#

dhcp6 is a joke

#

it shouldnt be needed, in a world which has auto assignment by radvd

green vale
#

i agree, tbh i just use static if ever IPv6 at all

green kestrel
#

i mean what they gonnna do, try to nat ipv6? lol

#

sounds like the silly shit virgin media do

green vale
#

virgin media NATs IPv6?

green kestrel
#

like if youre on business vm and you want a static ip... they cant technically give you a real static ipv4.

#

their infastructure and cable modems dont allow it

#

sooooo they give you a 4in4 tunnel with one end at your local green box

green vale
#

so do they just assign a "persistent" IPv4 via DHCP-

#

o

green kestrel
#

and the other end at the HQ

#

🤣

#

and the 4in4 tunnel breaks voip

#

businesses love it, well done vm

#

where i used to work we got a leased line instead of deal with their bs

green vale
#

damn

fleet lion
#

I just made the best 404 page

split hazel
#

1/10 not bold enough

#

@quartz kindle when you see this, what if I use a hashmap with ints as keys?

#

yeah I can convert them to chars but we're talking about very high levels of performance required and that doesn't sound very great

#

could also fuck up hashing

#

minimal overhead with fetching keys

split hazel
#

I was thinking another hash function specifically for ints

green kestrel
#

i cobbled this together in 30 mins, it fetches the artifacts from the last successful CI run, and uploads them into a draft release tagged with the version number from version.h in the source code 😄

#
#!/bin/bash
NEWVER=`cat include/dpp/version.h  | grep DPP_VERSION_TEXT | sed 's/\|/ /' |awk '{print $4}'`
echo "Building and tagging release $NEWVER"
mkdir temp
cd temp
echo "Download assets from CI..."
gh run list -w "D++ CI" -L 1
gh run download `gh run list -w "D++ CI" -L 1 | grep master | sed 's/\|/ /'|awk '{print $9}'`
echo "Move assets..."
mkdir assets
mv ./libdpp*/* assets/
echo "Create release..."
gh release create "v$NEWVER-test" --draft --title "v$NEWVER release" --notes "Please populate changelog/notes" ./assets/*.zip ./assets/*.deb
echo "Cleaning up..."
cd ..
rm -rf temp

yeah its a mess... but feel free to clean it up and reuse it however you like.

#

if you do you'll need to change the workflow name in gh run list

solemn latch
fleet lion
short gyro
#

Copy/pasta from general, but wonder from a development perspective, does anyone have a view about any tokens out there that are fulfilling Satoshi's vision particularly for the technology illiterate? Legit question, not a scam.

fleet lion
#

What?????????????

short gyro
#

my question?

#

trying to conduct some research. how is blockchain and tokens reach the technology illiterate, how is it helping them, etc.

solemn latch
short gyro
#

sure. it's early days. conducting the server requires the pre-scoping to get a sense of the breadth of data likely, and particularly the types of questions that the insiders think are relevant. So that's where I'm at now, pre-scoping

earnest phoenix
fleet lion
earnest phoenix
#

japanscript?

fleet lion
plain ingot
#
                if (spammedMessage) {

                    // ban
                    message.member.ban({days: 1, reason: `Anti spam`});
                } else return;```
how would i get it to not crash when it fails to not ban someone? (role hierarchy, etc)
crystal wigeon
#

Do they not provide sandbox for localhost to test out the webhook? it says i can't add http to listen to events

earnest phoenix
#

oh nvm that wasn't a syntax error

mild agate
#

im taking part in a webdev competition...
can anyone give css tips?
also a good layout suggestion

mild agate
earnest phoenix
#

images look terrible on mobile

mild agate
#

ikr not responsive

earnest phoenix
#

no

#

the images are super small

#

and have huge margin

mild agate
#

here desktop look

earnest phoenix
mild agate
#

I made it last year in another competition

earnest phoenix
#

ok

mild agate
#

any suggestions/tips?

earnest phoenix
#

not yet

#

besides using a ui library instead of normal css KEKW

mild agate
#

cant

#

no libs/frameworks allowed

#

even jquery

earnest phoenix
#

oof

errant flax
#

is it possible to get some information on a jsdoc site?
what im trying to do is make a docs command from a jsdoc site is that possible?

cinder patio
mild agate
#

1 year old

cinder patio
errant flax
#

i wonder how they made a djs docs command monkaHmm

cinder patio
#

or maybe not even the entire data, just the data used for the search feature

wheat sun
#

For discord.py, is there any way to ignore pinning and unpinning messages in on_message ?

quartz kindle
#

stuff like snowflakes for example dont need hashing

earnest phoenix
#

what actually needs hashing to use the api

quartz kindle
#

what api

earnest phoenix
#

discord api?

quartz kindle
#

nothing? idk

#

depends what you're doing/storing

mint rain
#

How to put to replit.file

untold hamlet
#

deos anyone knows how to fix ?

earnest phoenix
#

can you show your code

#

I need help in d.py, my emote command gets executed twice even tho we're running it only once

#

so basically what my command does is it creates a emote and that's it

#

but it creates it twice idk why

small tangle
#

provide the code snippet

earnest phoenix
#

hold on

#
@commands.command(aliases=['make-emoji', 'mk-emoji', 'mk-emote', 'mkemote'])
  @commands.has_permissions(manage_emojis=True)
  async def mkemoji(self, ctx, emoteName=None, *, url=None):
    try:
        await ctx.guild.create_custom_emoji(name=emoteName, image=image, roles=None, reason=f"Created by {ctx.author}");await ctx.send("The emote has been created 👍");return
    except:await ctx.send("Please specify a valid `Emote_Name` and `Image Url`.");return
#

and yes before u guys ask image is defined in my code above

slender thistle
#

What is it defined as

earnest phoenix
#

bytes

#

of a image file

slender thistle
#

I assume it's the bytes of the image that's returned from the URL?

earnest phoenix
#

yes

slender thistle
#

Huh

earnest phoenix
#

did u even know we can read the image bytes from a url?

slender thistle
#

Yeah

earnest phoenix
#

then why the "huh"

slender thistle
#

Do you have a similar issue with other commands?

earnest phoenix
#

nope

#

just w this

#

others work fine

slender thistle
#

Have you tried using the command with your bot's instance turned off?

earnest phoenix
#

yep

#

I'm not running my bot twice

slender thistle
#

Try commenting out the command

earnest phoenix
#

won't it just stop to work then?

slender thistle
#

🤷 Unless you somehow have 2 functions handling the same message input (aka command), pretty much

#

Unless your command itself somehow uploads the emote twice

pale vessel
#

I see, thanks

mint rain
#

The golden apple guys said to put the code in .replit file but wat is .replit file?

quartz kindle
errant flax
#

doesn't npm only has node v16.1?

quartz kindle
#

no?

#

oh you mean the node npm package?

#

idk i dont use it

errant flax
#

ye the node npm packages

#

package*

#

hey time why does the run.sh file wont let me download some old node versions monkaHmm

quartz kindle
#

which versions?

#

you have to check which files are available for each version

#

for example older versions might not have a pointer-compression variant

#

so you have to change the file name according to what is available in that version's folder

#

just open the mirror url in your browser and you'll see

mint rain
#

How to do this?

earnest phoenix
pale vessel
#

Maybe they did, but it's Discord.Client()

earnest phoenix
#

Could be

mint rain
#

Is this right?

earnest phoenix
#

Probably

#

It should work

#

Unless you did something wrong in the code itself

mint rain
earnest phoenix
#

You are not requiring discord.js

knotty zodiac
#

ik im probably being stupid but how do i ping a role with the role id?

earnest phoenix
#

put a const Discord = require("discord.js"); at the top of your file

earnest phoenix
#

<@&265125253443878912>

#

yeah it is

knotty zodiac
quartz kindle
#

and tried to use it as Discord

vivid fulcrum
mint rain
vivid fulcrum
#

my god

mint rain
#

??

#

Nice

mint rain
quartz kindle
#

you added a duplicate line

#

there was no need to add that to the top

mint rain
#

It said this

quartz kindle
#

read the discord.js v13 guide

#

if you're using a tutorial, its outdated

small tangle
earnest phoenix
#

tutorials should be banned from discord tbh

99% of em are just so copy and paste this and there we go we've created minecraft

small tangle
earnest phoenix
#

Lol

coral lichen
#

I need help

#

@small tangle @quartz kindle

#

yes

#

🤨

quartz kindle
#

well, install it

small tangle
#

yes LULW

coral lichen
#

🤷‍♂️

quartz kindle
#

FFmpeg is not a npm package

coral lichen
#

ffmpeg-static worked

quartz kindle
#

if you dont know how to install FFmpeg, you can install ffmpeg-static, which is an npm package

sick cloud
#

random question about snowflakes (using in my own api)

if i used snowflakes for two diff resources - say for users and sessions
if by some chance they both got made at the same time, could the user and session then "share" a snowflake/id?
and if so, would that cause issues?

vivid fulcrum
#

it's possible, but the chance of it happening is the same of a real world snowflake being identical to another

#

so, nearly impossible

#

hence "snowflake"

#

they're made for that use case

quartz kindle
#

ye

#

we dont know how discord generates them

sick cloud
#

so i should be totally safe to use snowflakes for all my resources (in a basic example - users, guilds, channels, sessions)

vivid fulcrum
#

correct

quartz kindle
#

assuming the same generator is used for all resources, instead of a dedicated generator for each resource, then no snowflake would ever be identical

split hazel
#

better performance since no hashing is required lmao

quartz kindle
#

ye

sick cloud
#

thanks then, that helps

#

o/

quartz kindle
#

we dont know how discord implements snowflakes in their backend, but im assuming they do it like that

peak patrol
#

Hello

#

I need help

#

actually

#

it's like the OwO bot

#

when you do OwO slap

#

and you have to tag someone

#

like OwO slap @peak patrol

coral lichen
#

I need help

peak patrol
#

I commanded help first

coral lichen
#

lol

#

I need help , You need code

earnest phoenix
#

Lets just continue to post blurry ass pictures of errors why dont we

coral lichen
peak patrol
#

TwT

earnest phoenix
#

No one is going to give you code either

#

You are expected to write your own code

peak patrol
#

@inner warren

split hazel
#

inb4 a server where you can pay people to write code for you comes up

low bone
sick cloud
#

yeah

peak patrol
#

Guys

#

I need help with the user mentioning command thing

sick cloud
#

one other question while i'm at it

using mongodb's native node driver, is there a way to just check if something exists? like a hasOne method?
feels kinda wasteful to use findOne if i just want to check if it exists or not

wheat mesa
#

Why would it be wasteful? You’re still querying the db for the same information.

split hazel
split hazel
wheat mesa
#

Unless you’re storing a massive amount of information in one document (which you shouldn’t do in the first place), then it shouldn’t be too much of an issue. you could just cache whether it exists or not once you get the document back

split hazel
#

@quartz kindle wrote a quick copy of the fnv hashing algorithm mind checking if it's okay?

#

i also ignored checking for non ascii characters

#

will optimise some things later

quartz kindle
#

looks fine, idk the details of how fnv works

feral aspen
#

I'm confused.

#
let member = interaction.options.getMember('user') || interaction.member;
member.presence.status

Cannot read property status of null.

wheat mesa
#

The member doesn’t have a status

#

Try it with someone you know 100% has a status

feral aspen
#

Bruh..

#

It's for a !userinfo command though..

earnest phoenix
#

well a member can be nullable

#

so check that there actually is a member first

feral aspen
#

Done that..

#

There is a member!

earnest phoenix
#

Ah

#

Presence can be nullable as well

#

So it probably presence that is returning that erorr

feral aspen
#

What can I do?

earnest phoenix
#

Well

pale vessel
#

"Well that sucks"

earnest phoenix
#

You can check whether they have a presence or not

feral aspen
#

.. and what does it mean if they do not?

solemn latch
#

lazy me would just
member?.presence.status || "none"

earnest phoenix
#

Then you don't display any presence info

#

yea

#

that would work

feral aspen
pale vessel
#

It's not lazy if it's efficient wesmart

earnest phoenix
#

Hence why he is using the status prop

#

if there is no status you display none

#

If you wanna display more presence stuff

#

just check if they have a presence and just display none for all of it ig

#

Also in what case would a presence be nullable?

#

If the client isn't ready maybe?

feral aspen
#

Is it possible to have a presence status but return null?

split hazel
earnest phoenix
#

It seems so

sage bobcat
feral aspen
#

HOW

pale vessel
#

It's nullable since v13. Previously it would have an instance of Presence with offline status but they made it nullable if the bot doesn't have GUILD_PRESENCES intent

quartz kindle
#

fucking sindre

feral aspen
quartz kindle
#

he has libs for everything

pale vessel
earnest phoenix
#

I forgot about the presence intent

#

Also yea

feral aspen
earnest phoenix
#

Members aren't always cached

pale vessel
#

Yes, still uncached

earnest phoenix
#

You have to fetch them most of the time

pale vessel
#

Try changing your status

#

You can't fetch presences

#

You receive them

earnest phoenix
#

You can fetch the member though flaze

pale vessel
#

Oh but I think you csn through WS

earnest phoenix
#

and get the presence from that fetched member

pale vessel
#

With withPresence set to true

feral aspen
#

Could I get a final solution..

#

Bruh

#

tf

earnest phoenix
#

Dont spam

feral aspen
#

My Wifi.. I'm sorry.

solemn latch
#

i guess it depends, do you want to fetch the member each time?
or do you want to just default to a specific value

earnest phoenix
#

I would think it would be easier to fetch the member then get their presence but ig flaze says otherwise

quartz kindle
sage bobcat
#

One message removed from a suspended account.

quartz kindle
#

uber hardcore implementation

#

i tested it, this is the fastest js fnv1a implementation

earnest phoenix
#

What even is fnv1a

quartz kindle
#

a hashing algorithm

earnest phoenix
#

I see

quartz kindle
#

ie to convert keys into hashes for a hash table

earnest phoenix
#

I see I see

feral aspen
earnest phoenix
#

It is an option for fetch

quartz kindle
#

members.fetch({ withPresences: true })

feral aspen
#

Ah..

earnest phoenix
#
<Guild>.members.fetch({withPresence: true})
feral aspen
#

It didn't show in the documentation or I may be searching somewhere wrong.

#

👍

earnest phoenix
#

Though that fetches all the users in the guild no?

#

Tim would that be an issue or?

pale vessel
#

provide the user as option

earnest phoenix
#

Yea

solemn latch
pale vessel
#

probably uses REST

#

so no presence

#

withPresences is an option for bulk request guild members gateway opcode

last tapir
#

wait

#

when wanting to fetch for a user.. you input the id

earnest phoenix
#

if you wanna fetch a specific user yea

vivid fulcrum
#

oh my god

#

pro tip

#

when doing ui design

#

use hsl instead of rgb

earnest phoenix
#

lawl

#

use hex

#

ez

boreal iron
#

rgba

last tapir
#

use math

earnest phoenix
#

rbga is actually really good ngl

vivid fulcrum
#

no but really, you can easily add/remove saturation with hsl which gives you nice looking palettes

earnest phoenix
#

I use it in web dev

feral aspen
#
interaction.guild.members.fetch(member, { withPresence: true }).presence.status
#

Like this, correct?

solemn latch
#

fetch is a promise, youll need to await it

feral aspen
#

Forgot. 👍

pallid jungle
#
-----> Building on the Heroku-20 stack
-----> Using buildpack: heroku/nodejs
-----> Node.js app detected
       
-----> Creating runtime environment
       
       NPM_CONFIG_LOGLEVEL=error
       NODE_VERBOSE=false
       NODE_ENV=production
       NODE_MODULES_CACHE=true
       
-----> Installing binaries
       engines.node (package.json):  unspecified
       engines.npm (package.json):   unspecified (use default)
       
       Resolving node version 14.x...
       Downloading and installing node 14.17.6...
       Using default npm version: 6.14.15
       
-----> Restoring cache
       Cached directories were not restored due to a change in version of node, npm, yarn or stack
       Module installation may take longer for this build
       
-----> Installing dependencies
       Installing node modules
       npm ERR! register-scheme not accessible from discord-rpc
       
       npm ERR! A complete log of this run can be found in:
       npm ERR!     /tmp/npmcache.RfQZz/_logs/2021-09-02T14_06_27_538Z-debug.log
-----> Build failed
       
       We're sorry this build is failing! You can troubleshoot common issues here:
       https://devcenter.heroku.com/articles/troubleshooting-node-deploys
       
       Some possible problems:
       
       - Node version not specified in package.json
         https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
       
       Love,
       Heroku
       
 !     Push rejected, failed to compile Node.js app.
 !     Push failed
feral aspen
#

Oof.

#

status of undefined.

pale vessel
feral aspen
pale vessel
#

and use (await fetch()).presence (like Woo said, resolve the promise)

pallid jungle
#

I just updated to discord.js v13

solemn latch
#
We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
#

id start there

#

also

       Some possible problems:
       
       - Node version not specified in package.json
         https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
pale vessel
#

Doesn't it also need node v16.6 min?

pallid jungle
last tapir
#

👍

pallid jungle
#

Should i send package ?

pale vessel
#

change it to 16.x in package.json under engines

#

that might fix the issue, I'm not sure

last tapir
#

the node? you can do it via downloading the latest one on the website

solemn latch
#

on heroku?

#

👀

last tapir
#

if he is downloading the latest node

pallid jungle
pallid jungle
# pale vessel change it to 16.x in package.json under engines
{
  "name": "wolfy-bot",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "ᒍoe#0001",
  "license": "ISC",
  "description": "",
  "dependencies": {
    "@discordjs/builders": "^0.6.0",
    "@discordjs/opus": "^0.4.0",
    "@discordjs/rest": "^0.1.0-canary.0",
    "@discordjs/voice": "^0.6.0",
    "@iamtraction/google-translate": "^1.1.2",
    "@top-gg/sdk": "^3.1.2",
    "alexa-bot-api": "^0.2.1",
    "alexa-bot-api-v3": "^3.0.7",
    "ascii-table": "0.0.9",
    "axios": "^0.21.1",
    "canvacord": "^5.2.3",
    "canvas": "^2.8.0",
    "chatcord": "0.0.5",
    "common-tags": "^1.8.0",
    "covidapi": "^0.5.0",
    "currency-system": "^2.6.13",
    "discord-api-types": "^0.22.0",
    "discord-interface": "^2.0.6",
    "discord-mongo-economy": "^0.3.0",
    "discord-player": "^5.0.2",
    "discord-reply": "^0.1.2",
    "discord-rpc": "^4.0.1",
    "discord-together": "^1.1.14",
    "discord-xp": "^1.1.16",
    "discord.js": "^13.1.0",
    "discord.js-commando": "^0.12.2",
    "discord.js-guard": "^1.0.5",
    "discord.js-pagination": "^1.0.3",
    "discord.js-player": "^1.0.3",
    "discord.js-slash-command": "^1.2.1",
    "distube": "^2.8.10",
    "djs-buttons-pagination": "^1.6.2",
    "djs-games": "^1.4.6",
    "dsc-slash": "^2.0.2",
    "event-target-shim": "^6.0.2",
    "ffmpeg-static": "^4.2.7",
    "fortnite": "^4.3.2",
    "fs-extra": "^10.0.0",
    "gcommands": "^5.2.5",
    "glob": "^7.1.7",
    "got": "^11.8.1",
    "humanize-duration": "^3.27.0",
    "jsdom": "^16.4.0",
    "lodash": "^4.17.21",
    "lyrics-finder": "^21.7.0",
    "mal-scraper": "^2.11.3",
    "mathjs": "^9.2.0",
    "mcapi": "^1.0.1",
    "moment": "^2.29.1",
    "mongoose": "^5.13.7",
    "ms": "^2.1.3",
    "node": "^16.6.1",
    "node-superfetch": "^0.2.3",
    "nuggies": "^1.0.9",
    "parse-ms": "^2.1.0",
    "simple-fortnite-api": "^0.1.9",
    "snekfetch": "^4.0.4",
    "sourcebin": "^4.2.5",
    "twitter-api.js": "0.0.12",
    "txtgen": "^2.2.8",
    "util": "^0.12.4",
    "utils-discord": "^1.2.0",
    "weather-js": "^2.0.0",
    "weky": "^2.0.9",
    "ytdl-core": "^4.8.3"
  }
}

where

split hazel
#

i think the worse performance is the better hand off between rewriting all of that in c++

pale vessel
#

add a new property called engines

pallid jungle
#

ok

pale vessel
#
{ "engines": { "node": "16.x" } }```
cinder patio
#

wow that's a lot of dependencies

pale vessel
#

that's what happens when you rely too much on simple packages

#

I almost thought they sent their lockfile

pallid jungle
#
2021-09-02T14:19:23.052590+00:00 app[Worker.1]: /app/node_modules/discord.js/src/rest/RequestHandler.js:298
2021-09-02T14:19:23.052608+00:00 app[Worker.1]:       throw new DiscordAPIError(data, res.status, request);
2021-09-02T14:19:23.052609+00:00 app[Worker.1]:             ^
2021-09-02T14:19:23.052610+00:00 app[Worker.1]: 
2021-09-02T14:19:23.052610+00:00 app[Worker.1]: DiscordAPIError: Missing Access
2021-09-02T14:19:23.052611+00:00 app[Worker.1]:     at RequestHandler.execute (/app/node_modules/discord.js/src/rest/RequestHandler.js:298:13)
2021-09-02T14:19:23.052612+00:00 app[Worker.1]:     at runMicrotasks (<anonymous>)
2021-09-02T14:19:23.052612+00:00 app[Worker.1]:     at processTicksAndRejections (node:internal/process/task_queues:96:5)
2021-09-02T14:19:23.052616+00:00 app[Worker.1]:     at async RequestHandler.push (/app/node_modules/discord.js/src/rest/RequestHandler.js:50:14)
2021-09-02T14:19:23.052617+00:00 app[Worker.1]:     at async GuildApplicationCommandManager.set (/app/node_modules/discord.js/src/managers/ApplicationCommandManager.js:146:18)
2021-09-02T14:19:23.052617+00:00 app[Worker.1]:     at async /app/handler/command.js:29:7 {
2021-09-02T14:19:23.052617+00:00 app[Worker.1]:   method: 'put',
2021-09-02T14:19:23.052618+00:00 app[Worker.1]:   path: '/applications/821655420410003497/guilds/873901747670765568/commands',
2021-09-02T14:19:23.052619+00:00 app[Worker.1]:   code: 50001,
2021-09-02T14:19:23.052619+00:00 app[Worker.1]:   httpStatus: 403,
2021-09-02T14:19:23.052620+00:00 app[Worker.1]:   requestData: { json: [], files: [] }
2021-09-02T14:19:23.052620+00:00 app[Worker.1]: }
solemn latch
#

youll need to handle permission errors yeah.

pallid jungle
#

If someone

#

didn't invite the bot with scope bot applications.commands

pale vessel
#

Are you creating guild commands on every invite?

#

That's not efficient for production, use global commands instead

pallid jungle
#
const { Client } = require("discord.js");
const { glob } = require("glob");
const { promisify } = require("util");
const globPromise = promisify(glob);
const { readdirSync } = require("fs");
const ascii = require("ascii-table");
let table = new ascii("Commands");
table.setHeading("Command", "Load status");

/**
 * @param {Client} client
 */

module.exports = async (client) => {
  // slashcommands start
  const slashCommands = await globPromise(
    `${process.cwd()}/SlashCommands/*/*.js`
);

const arrayOfSlashCommands = [];
slashCommands.map((value) => {
    const file = require(value);
    if (!file?.name) return;
    client.slashCommands.set(file.name, file);
    arrayOfSlashCommands.push(file);
});
client.on("ready", async () => {
    client.guilds.cache.forEach(async (g) => {
      await client.guilds.cache.get(g.id).commands.set(arrayOfSlashCommands);
    });

 
});

}; 
#

command.js folder

#

@pale vessel

boreal iron
#

Wtf looping through each guild and then fetching it inside the loop again?

#

You have to register commands once and then update them if needed.
Setting them on each startup is a horrible mess and will cause a fast rate limitation.

pallid jungle
#

Oh

#

@boreal iron How it will looks like ?

boreal iron
#

That’s how I do things:

  • the ready event loads all commands into a map
  • the global commands of the client will be fetched
  • looping through the fetched commands
  • check if the local commands match the global one
  • if not add command to the client, update it or delete it (if no local command has been found)
#

Which is a very short explanation of the whole command handler

pallid jungle
#

I should load them at guildcreate event?

#

guildcreate*

boreal iron
#

Guild commands should be used for testing purpose only and they are available immediately

pallid jungle
boreal iron
#

As I said guild commands are getting deployed immediately

pallid jungle
#

Hmm

#

ok

flat copper
#
const express = require('express');
const app = express();

app.get('/', (req, res) => {
	res.send("Hlo")
});

app.get('/commands', (req, res) => {
	res.send('Hlo');
});

app.listen(3001, () => {
	console.log('im alive');
});

#

It's not showing anything

solemn latch
#

channel is undefined

coral lichen
#

Yes

solemn latch
#

you need to define it to use it

low bone
flat copper
#

Yep

low bone
rancid moss
#

Hey, does anyone know why I am getting this error?
It is part of Top.gg's DBL vote reporting.

Error: 401 Unauthorized
2021-09-02T15:07:38.459512+00:00 app[Worker.1]:     at IncomingMessage.<anonymous> (/app/node_modules/dblapi.js/src/index.js:118:25)
2021-09-02T15:07:38.459513+00:00 app[Worker.1]:     at IncomingMessage.emit (node:events:406:35)
2021-09-02T15:07:38.459513+00:00 app[Worker.1]:     at IncomingMessage.emit (node:domain:475:12)
2021-09-02T15:07:38.459513+00:00 app[Worker.1]:     at endReadableNT (node:internal/streams/readable:1343:12)
2021-09-02T15:07:38.459514+00:00 app[Worker.1]:     at processTicksAndRejections (node:internal/process/task_queues:83:21) {
2021-09-02T15:07:38.459515+00:00 app[Worker.1]:   raw: '{"error":"Unauthorized"}',
2021-09-02T15:07:38.459516+00:00 app[Worker.1]:   body: { error: 'Unauthorized' },
2021-09-02T15:07:38.459516+00:00 app[Worker.1]:   status: 401,
2021-09-02T15:07:38.459516+00:00 app[Worker.1]:   headers: {
2021-09-02T15:07:38.459517+00:00 app[Worker.1]:     date: 'Thu, 02 Sep 2021 15:07:38 GMT',
2021-09-02T15:07:38.459517+00:00 app[Worker.1]:     'content-type': 'application/json; charset=utf-8',
2021-09-02T15:07:38.459518+00:00 app[Worker.1]:     'content-length': '24',
2021-09-02T15:07:38.459518+00:00 app[Worker.1]:     connection: 'close',
2021-09-02T15:07:38.459518+00:00 app[Worker.1]:     'set-cookie': [
2021-09-02T15:07:38.459519+00:00 app[Worker.1]:       'country=IE; Path=/; Secure; SameSite=Strict',
2021-09-02T15:07:38.459519+00:00 app[Worker.1]:       'mode=light; Path=/',
2021-09-02T15:07:38.459519+00:00 app[Worker.1]:       'device=desktop; Path=/'
2021-09-02T15:07:38.459520+00:00 app[Worker.1]:     ],
2021-09-02T15:07:38.459520+00:00 app[Worker.1]:     'access-control-allow-origin': '*',
2021-09-02T15:07:38.459520+00:00 app[Worker.1]:     'access-control-allow-headers': 'Authorization',
2021-09-02T15:07:38.459521+00:00 app[Worker.1]:     etag: 'W/"18-XPDV80vbMk4yY1/PADG4jYM4rSI"',
2021-09-02T15:07:38.459521+00:00 app[Worker.1]:     'cf-cache-status': 'DYNAMIC',
2021-09-02T15:07:38.459521+00:00 app[Worker.1]:     'expect-ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
2021-09-02T15:07:38.459522+00:00 app[Worker.1]:     'strict-transport-security': 'max-age=15552000; includeSubDomains; preload',
2021-09-02T15:07:38.459522+00:00 app[Worker.1]:     'x-content-type-options': 'nosniff',
2021-09-02T15:07:38.459522+00:00 app[Worker.1]:     server: 'cloudflare',
2021-09-02T15:07:38.459523+00:00 app[Worker.1]:     'cf-ray': '6887a62d1ae434d2-DUB',
2021-09-02T15:07:38.459523+00:00 app[Worker.1]:     'alt-svc': 'h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; ma=86400'
2021-09-02T15:07:38.459523+00:00 app[Worker.1]:   },
2021-09-02T15:07:38.459523+00:00 app[Worker.1]:   ok: false,
2021-09-02T15:07:38.459524+00:00 app[Worker.1]:   statusText: 'Unauthorized'
2021-09-02T15:07:38.459524+00:00 app[Worker.1]: }
rancid moss
# solemn latch the authorization is wrong.

Hmm.
I have checked so many times if everything's correct 🤣.
All I needed was the dbl api (Iwhich is the webhook token), the auth (the password I have made) and the logs channel.

#

but still it gives me a "Unauthorized" error

solemn latch
#

this is for a webhook correct?
did you fill in the auth on the website?
are you sure you are checking it code wise correctly?

rancid moss
solemn latch
#

dblapi.js is deprecated

candid cypress
#

while importing dbl I got this error and it never happened before

ImportError: cannot import name 'ApplicationCommandInvokeError' from 'discord.app.errors' (/app/.heroku/python/lib/python3.8/site-packages/discord/app/errors.py)
#

for traceback here it is

rancid moss
rancid moss
#

But I guess, I could work around this and use the example on the documentation, Woo.

solemn latch
#

dblapi is deprecated, and is no longer supported

livid jackalBOT
#

This channel is ONLY for the Top.gg API!
This channel is only for: suggestions/help/bugs to do with official API libraries and API docs found at: https://docs.top.gg
Any Off-Topic conversation may get deleted and muted.

If you need help with development about your bot or development in general, feel free to use #development.

solemn latch
#

lol

#

the bot

split hazel
#

this embed is inaccurate

solemn latch
#

kek

split hazel
#

this channel is in fact ONLY FOR DEVELOPMENT SUPPORT

solemn latch
#

yeah, started my message with dblapi

split hazel
#

prefix is cringe

rancid moss
hot sleet
#

i changed my bot avatar from hours now it's still the same ?

#

what's wrong with discord now ?

solemn latch
hot sleet
#

................

#

i will not answer this bye and ty

spark flint
#

lmao

rocky hearth
#

How can I disable a specific permission for a role that is enabled in the everyone role?

hot sleet
#

just disable it

rocky hearth
#

Bcoz im thinking if a permission is disabled it defaults to the permission set for everyone role

hot sleet
#

by default any role is higher than everyone role

#

in server settings you can decide what role is higher than other

rocky hearth
#

So does that mean if a role is higher it completely overwrite the lower roles

hot sleet
#

yep

earnest phoenix
#

How do I change the number of columns in a grid based on screen size?

rocky hearth
#

See media query in css
@earnest phoenix also if you're experienced in css, i recommend learning tailwind. And forget all these problems

pallid jungle
#

I am trying to make discord.js guide slash commands and not working what is the problem

index.js

const Discord = require('discord.js')
const { Client, Intents, Collection } = require('discord.js')
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');

const { prefix, developer, token, clientId } = require('./config.json');

client.slashCommands = new Collection();

const slashCommands = [];

const slashFolders = fs.readdirSync('./slashCommands');
for (const folder of slashFolders) {
    const commandFiles = fs.readdirSync(`./slashCommands/${folder}`).filter(file => file.endsWith('.js'));
}
const slashFiles = fs.readdirSync('./slashCommands').filter(file => file.endsWith('.js'));
for (const file of slashFiles) {
    const command = require(`../slashCommands/${file}`);
    slashCommands.push(command.data.toJSON());
}

const rest = new REST({ version: '9' }).setToken(token);

(async () => {
    try {
        console.log('Started refreshing application (/) commands.');

    await rest.put(
      Routes.applicationCommands(clientId),
      { body: commands },
    );

        console.log('Successfully reloaded application (/) commands.');
    } catch (error) {
        console.error(error);
    }
})();
client.on('interactionCreate', async interaction => {
    if (!interaction.isCommand()) return;

    const command = client.commands.get(interaction.commandName);

    if (!command) return;

    try {
        await command.execute(interaction);
    } catch (error) {
        console.error(error);
        await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
    }
});

Ping.js

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

module.exports = {
    data: new SlashCommandBuilder()
        .setName('ping')
        .setDescription('Replies with Pong!'),
    async execute(interaction) {
        await interaction.reply('Pong!');
    },
};
grim aspen
#

Errors?

quartz kindle
#

you are looking for the files im the wrong folder

pallid jungle
# grim aspen Errors?
TypeError: Cannot read property 'channel' of undefined
    at Object.execute (E:\C) Developing\Wolfy Djs-13\commands\bot\ping.js:17:27)
    at Client.<anonymous> (E:\C) Developing\Wolfy Djs-13\index.js:73:23)
    at Client.emit (node:events:394:28)
    at InteractionCreateAction.handle (E:\C) Developing\Wolfy Djs-13\node_modules\discord.js\src\client\actions\InteractionCreate.js:66:12)
    at Object.module.exports [as INTERACTION_CREATE] (E:\C) Developing\Wolfy Djs-13\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
    at WebSocketManager.handlePacket (E:\C) Developing\Wolfy Djs-13\node_modules\discord.js\src\client\websocket\WebSocketManager.js:345:31)
    at WebSocketShard.onPacket (E:\C) Developing\Wolfy Djs-13\node_modules\discord.js\src\client\websocket\WebSocketShard.js:443:22)
    at WebSocketShard.onMessage (E:\C) Developing\Wolfy Djs-13\node_modules\discord.js\src\client\websocket\WebSocketShard.js:300:10)
    at WebSocket.onMessage (E:\C) Developing\Wolfy Djs-13\node_modules\ws\lib\event-target.js:132:16)
    at WebSocket.emit (node:events:394:28)
    at Receiver.receiverOnMessage (E:\C) Developing\Wolfy Djs-13\node_modules\ws\lib\websocket.js:970:20)
    at Receiver.emit (node:events:394:28)
    at Receiver.dataMessage (E:\C) Developing\Wolfy Djs-13\node_modules\ws\lib\receiver.js:517:14)
    at Receiver.getData (E:\C) Developing\Wolfy Djs-13\node_modules\ws\lib\receiver.js:435:17)
    at Receiver.startLoop (E:\C) Developing\Wolfy Djs-13\node_modules\ws\lib\receiver.js:143:22)
    at Receiver._write (E:\C) Developing\Wolfy Djs-13\node_modules\ws\lib\receiver.js:78:10)
grim aspen
#

Channel is not defined and what Tim said

rocky hearth
#

Im trying to work with bitfield in js. How can i create flags more than 32

quartz kindle
#

check your readdir functions

#

you are loading files from the slashcommands folder

#

not from its subfolders

pallid jungle
low bone
#

commands\bot\ping.js
that is the file being executed

which is not in slashcommands folder

pallid jungle
#

oh

rocky hearth
quartz kindle
#

you can do bitwise with bigints

#

the same way as normal numbers

rocky hearth
#

Oh

quartz kindle
#

just that all operands have to be bigints as well

rocky hearth
#

How many flags can i create with bigint

quartz kindle
#

infinite

rocky hearth
#

Oohhk thnks

low bone
#
    const command = client.commands.get(interaction.commandName);

so you simply getting a normal commands that has name of that interaction slash command (which is ping in this case)

#

and in same time, something is a little weird
you are assigning a var slashCommands to client in

client.slashCommands = new Collection();

but then u are loading all slashCommands in another var slashCommands in

slashCommands.push(command.data.toJSON());
pallid jungle
#

ok thanks

low bone
#

and the latter var wasn't used at all

pallid jungle
#

@low bone slashCommands.push(command.data.toJSON());
^

ReferenceError: command is not defined

grim aspen
#

What is command

#

What does that correspond to

low bone
#
    const command = require(`../slashCommands/${file}`);

is wrong here

#

not double dot (..)
it should be one dot

#

anyway ur code is a little weird and won't behave as you think because in the end u are using client.commands and not the slash ones
and the slash commands aren't saved properly, so fix them then try again

hasty lotus
#

does anyone know how to set a custom biography for a bot via the api, without the discord developer dashboard ?

low bone
#

not allowed i think

pallid jungle
#

I did this changes and still same thing

client.slashCommands = new Collection();

const slashCommands = [];

const slashFiles = fs.readdirSync('./slashCommands').filter(file => file.endsWith('.js'));
for (const file of slashFiles) {
    const slash = require(`./slashCommands/${file}`);
    slashCommands.push(slash.data.toJSON());
}

const rest = new REST({ version: '9' }).setToken(token);

(async () => {
    try {
        console.log('Started refreshing application (/) commands.');

    await rest.put(
      Routes.applicationCommands(clientId),
      { body: commands },
    );

        console.log('Successfully reloaded application (/) commands.');
    } catch (error) {
        console.error(error);
    }
})();
client.on('interactionCreate', async interaction => {
    if (!interaction.isCommand()) return;

    const slash = client.commands.get(interaction.commandName);

    if (!slash) return;

    try {
        await slash.execute(interaction);
    } catch (error) {
        console.error(error);
        await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
    }
});
low bone
#

what is slashCommands for first?

pallid jungle
#

It was in discord.js guide idk i will delete it

hasty lotus
low bone
pallid jungle
#

ok

grim aspen
#

Slash command does /(input)

#

It responds to /

low bone
#
client.slashCommands = new Collection();

const slashFiles = fs.readdirSync('./slashCommands').filter(file => file.endsWith('.js'));
for (const file of slashFiles) {
    const slash = require(`./slashCommands/${file}`);
    client.slashCommands.set(file.split(/.js$/)[0],slash);
}

const rest = new REST({ version: '9' }).setToken(token);

(async () => {
    try {
        console.log('Started refreshing application (/) commands.');

    await rest.put(
      Routes.applicationCommands(clientId),
      { body: commands },
    );

        console.log('Successfully reloaded application (/) commands.');
    } catch (error) {
        console.error(error);
    }
})();
client.on('interactionCreate', async interaction => {
    if (!interaction.isCommand()) return;

    const slash = client.slashCommands.get(interaction.commandName);

    if (!slash) return;

    try {
        await slash.execute(interaction);
    } catch (error) {
        console.error(error);
        await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
    }
});

i didn't test but give it a try

pallid jungle
#

ok

#

Worked!

low bone
#

cool

pallid jungle
#

But why i can't load new slash cmd ?

#

The bot is only in one server

low bone
#

what u mean

pallid jungle
# low bone what u mean
const rest = new REST({ version: '9' }).setToken(token);

(async () => {
    try {
        console.log('Started refreshing application (/) commands.');

        await rest.put(
            Routes.applicationGuildCommands(clientId),
            { body: commands },
        );

        console.log('Successfully reloaded application (/) commands.');
    } catch (error) {
        console.error(error);
    }
})();
#

When i try to add new slash command

low bone
#
client.slashCommands.set(file.split(/.js$/)[0],slash);

below this add

commands.push(command.data.toJSON());
pallid jungle
#

ok

low bone
#

and after this

client.slashCommands = new Collection();

add

const commands=[]
pallid jungle
low bone
#

it's different from client.commands

#

it's the one responsible of listing all the slash commands data
so he refresh it

pallid jungle
#

oh

#

i got this

#

ReferenceError: command is not defined
at Object.<anonymous> (E:\C) Developing\Wolfy Djs-13\index.js:43:19)

#

wait

low bone
#

u maybe missed s

pallid jungle
#

Yes worked!

#

@low bone Thank you bro

low bone
#

y wlc

hollow depot
#
const voice = require('@discordjs/voice');

module.exports = {
    name: "leave",
    ref: '../rescources.cpp',
    description: 'leaves the channel',
    run(client, message, args, guildprefix) {
        try {
            voice.getVoiceConnection(message.guild.id).disconnect();
            message.react(client.emotes.success)
        } catch (e) { 
            message.reply(`${client.emotes.error} | I'm not in a voice channel.`);
            console.log(e)
        }

    }
};```
in djsv13, it always returns an error saying that disconnect is an undefined property...
earnest phoenix
quartz kindle
#

disconnect is undefined or cannot read property disconnect of undefined?

earnest phoenix
#

Any recommended screen sizes for media queries to detect mobile?

hollow depot
low bone
quartz kindle
#

then the problem is not the disconnct

#

getvoiceconnection did not find a guild

low bone
#

or just use
voice.getVoiceConnection(message.guild.id)?.disconnect?.();

earnest phoenix
hollow depot
low bone
hollow depot
#

by doing this it does everything right

except for the only thing it had to do

low bone
#

but im curious the function should be working
because it was expecting an error that will be caught

to know if he's in vc or not

#

and the error u see is from console.log(e)

quartz kindle
#

the voice variable is likely incorrect or uninitialized

#

idk how djs voice works but i doubt they would make guilds accessible direclty on the exported object without any form of initialization

rocky hearth
#

How does discord permissions work?
I created a role and disabled all permissions.
But it has no effect...

quartz kindle
#

role permissions are added on top of each other

#

afaik

hollow depot
earnest phoenix
#

If the base role has admin they can do anything

rocky hearth
#

no it has no any other role with admin permission

rocky hearth
quartz kindle
#

likely yes

low bone
quartz kindle
#

if a permission is on everyone, then its on all roles

hollow depot
earnest phoenix
#

Imagine making an anarchy server where everyone has admin

quartz kindle
#

been in one

#

was fun

earnest phoenix
#

what

hollow depot
#

wait ill try lol

#

i didnt think of it

low bone
rocky hearth
#

how can I overwrite @everyone.
I want to make a role that cant join a vc, but @everyone can

hollow depot
#

ok yes this works lol, but as soon as i changed the leave command the join one stopped working LMAO

#

im done

quartz kindle
pallid jungle
#
TypeError: Cannot read property 'deferReply' of undefined
const Discord = require('discord.js');
const { SlashCommandBuilder } = require('@discordjs/builders');
const { MessageActionRow, MessageButton } = require('discord.js');

module.exports = {
    data: new SlashCommandBuilder()
        .setName('invite')
        .setDescription('Replies with bot links/invite!'),
    async execute(client, interaction) {
        await interaction.deferReply({ ephemeral: false }).catch(() => {});
rocky hearth
#

thats weird. Why dont they allow reordering @everyone

earnest phoenix
#

@everyone applies to EVERYONE

#

unless you have a different role for the bot

quartz kindle
#

channel overrides are the only way

earnest phoenix
#

and disable the role perms for the bot role in vc settings

low bone
low bone
#

then change it there

#

await slash.execute(client,interaction);

pallid jungle
#

kk

#

Worked

earnest phoenix
rocky hearth
hollow depot
quartz kindle
low bone
pale vessel
#

You can combine them together

pallid jungle
#
2021-09-02T18:47:39.108194+00:00 app[Worker.1]: Error: Cannot find module 'process.env.token'
const { token } = require('process.env.token')
#
client.login(process.env.token);
sudden geyser
#

If you want to load your .env file, you should use a package like dotenv

low bone
sudden geyser
#

show your source code

pallid jungle
#

This working in bottom of code but i want to add const { token } for the slash commands

client.login(process.env.token);
low bone
#
require('dotenv')()

Then make a file called .env content to be:

token=YOUR BOT TOKEN HERE
#

make sure to install the dotenv package with

npm i dotenv

in your shell

sudden geyser
sudden geyser
#

You should still be able to install dependencies.

spark flint
#

anyone know how to make a select option on discord.py

sudden geyser
#

doesn't that require slash commands

spark flint
#

so like it outputs the top 3 items and shows whatever answer you react with

low bone
pallid jungle
#

I will try

spark flint
#

or does anyone know how i can select only the first 3 options from a json response

sudden geyser
#

If it's an array, you can use slicing (e.g. arr[:3])

quartz kindle
#

you dont need to do anything different to use it with slash commands

pallid jungle
quartz kindle
#

no

pallid jungle
#

const { token } = require('process.env.token') ?

#

Didn't work for me

quartz kindle
#

just literally the same way you used it in client.login

#

no require no nothing

pallid jungle
#

oh

solemn latch
#

do you mind if i play around with the tiny discord lib? since its got no license would prefer to ask ^_^ @quartz kindle

quartz kindle
#

oh i forgot that

#

sure

pallid jungle
#
const { token } = client.login(process.env.token)

Like that ? ._.

#

Lol

low bone
#

haha

sudden geyser
#

this is amusing

pallid jungle
sudden geyser
#

are you trolling at this point

quartz kindle
#

literally put it in your slash commands

pallid jungle
#
const { token } = process.env.token;
#

Should it work ?

low bone
#

.<

pallid jungle
#

Or just should i add

quartz kindle
#

well yes

low bone
#

why u want this TOKEN!! var

quartz kindle
#

if you absolutely must put it in a var then yes

pallid jungle
#
const rest = new REST({ version: '9' }).setToken("bottoken");
quartz kindle
#

just put it there

low bone
#

.setToken(process.env.token)

quartz kindle
#

process.env.token

#

lol

pallid jungle
#

oh okay

low bone
#

anywhere u want token do same thing
process.env.token

pallid jungle
#
2021-09-02T19:19:29.307984+00:00 app[Worker.1]: DiscordAPIError[20012]: You are not authorized to perform this action on this application
2021-09-02T19:19:29.308026+00:00 app[Worker.1]:     at SequentialHandler.runRequest (/app/node_modules/@discordjs/rest/dist/lib/handlers/SequentialHandler.js:198:23)
2021-09-02T19:19:29.308027+00:00 app[Worker.1]:     at processTicksAndRejections (node:internal/process/task_queues:96:5)
2021-09-02T19:19:29.308028+00:00 app[Worker.1]:     at async SequentialHandler.queueRequest (/app/node_modules/@discordjs/rest/dist/lib/handlers/SequentialHandler.js:99:20)
2021-09-02T19:19:29.308029+00:00 app[Worker.1]:     at async /app/index.js:52:9 {
2021-09-02T19:19:29.308030+00:00 app[Worker.1]:   rawError: {
2021-09-02T19:19:29.308030+00:00 app[Worker.1]:     message: 'You are not authorized to perform this action on this application',
2021-09-02T19:19:29.308030+00:00 app[Worker.1]:     code: 20012
2021-09-02T19:19:29.308031+00:00 app[Worker.1]:   },
2021-09-02T19:19:29.308031+00:00 app[Worker.1]:   code: 20012,
2021-09-02T19:19:29.308031+00:00 app[Worker.1]:   status: 403,
2021-09-02T19:19:29.308032+00:00 app[Worker.1]:   method: 'put',
2021-09-02T19:19:29.308033+00:00 app[Worker.1]:   url: 'https://discord.com/api/v9/applications/876813450662273115/commands'
2021-09-02T19:19:29.308033+00:00 app[Worker.1]: }

Still 😦

#

Even if i set the token in config

pallid jungle
#

bruh

#

How to fix this

split hazel
#

going to measure the performance of my map implementation when i quickly port it from osless to linux lol

hasty lotus
#

Hey, i'm trying to make a dm ticket system, and when i send a dm message to my bot (which has the direct message intent enabled in the client initialisation), the js code doesn't recieve it, but if i ask my bot to send me a dm message by fetching my user with my id in the client.ready part, the bot then detects the messages i send until i restart the script.

Any idea why ? And is there any way to recieve the messages without sending the user a dm first ?

#

i'm not really up to date with the v13 of djs and v9 of discord api 😅

signal estuary
#

How can you set a reason when banning someone, so you can see the reason when looking in the banned member list in the server?

pallid jungle
signal estuary
signal estuary
#

I have another problem. (slash command)
I have a ban command which takes the user (required) reason (optional) time (optional)
But the user can choose in which order he wants to make the fields.
For example he can have:
user and time. But the time requires the reason. How to do this so?

spark flint
#

how do i get a single json response

#

My json response currently is

{
  "kind":"book/volumes",
  "totalItems":2000,
  "items":[
    {
      "kind":"book/volumes",
      "id":"id"
       more under icba to repeat
    }
    {
      "kind":"book/volumes",
      "id":"id"
       more under icba to repeat
    }```
how do i get python to only get the first response
spark flint
#

yeah

#

it goes on and on

split hazel
#

object["items"][0]

#

the number being the index

#

which is zero based hence it's 0

spark flint
#

it works

split hazel
#

nice

#

love that book btw

#

and the other tom gates books

spark flint
#

yup

#

now i need more help

#

how do i hyperlink a title

#

of an embed

boreal iron
#

Using the url option

#

title: { name: "text", url: "link" }

spark flint
#

i got it to work

#

embed = discord.Embed(title=f"{r['items'][0]['volumeInfo']['title']}", url=r['items'][0]['volumeInfo']['infoLink'])

tired panther
spark flint
#

same

#

its great

tired panther
#

whut, I have an another opinion xD

charred mural
spark flint
#

its sorted alreadey

charred mural
#

my b

pallid jungle
#

how to make a public bot skip the server that didn't invite the bot with the slash command scope

inland quail
pallid jungle
#

Is that right ?

client.slashCommands = new Collection();

const commands=[]

const slashFiles = fs.readdirSync('./slashCommands').filter(file => file.endsWith('.js'));
for (const file of slashFiles) {
    const slash = require(`./slashCommands/${file}`);
    client.slashCommands.set(file.split(/.js$/)[0],slash);
    commands.push(slash.data.toJSON());
}

const rest = new REST({ version: '9' }).setToken(token);

client.on("ready", () => {
    if(config.loadSlashsGlobal){
        client.application.commands.set(commands)
        .then(slashCommandsData => {
            console.log(`${slashCommandsData.size} slashCommands ${`(With ${slashCommandsData.map(d => d.options).flat().length} Subcommands)`.green} Loaded for all: ${`All possible Guilds`.underline}`.brightGreen); 
            console.log(`Because u are Using Global Settings, it can take up to 1 hour until the Commands are changed!`.bold.yellow)
        }).catch((e)=>console.log(e));
    } else {
        client.guilds.cache.map(g => g).forEach((guild) => {
            try{
                guild.commands.set(commands)
                .then(slashCommandsData => {
                    console.log(`${slashCommandsData.size} slashCommands ${`(With ${slashCommandsData.map(d => d.options).flat().length} Subcommands)`.green} Loaded for: ${`${guild.name}`.underline}`.brightGreen); 
                }).catch((e)=>console.log(e));
            }catch (e){
                console.log(String(e).grey)
            }
        });
    }
})
lyric mountain
#

also forEach bad

pallid jungle
#

@lyric mountain

try {
client.slashCommands = new Collection();

const commands=[]

const slashFiles = fs.readdirSync('./slashCommands').filter(file => file.endsWith('.js'));
for (const file of slashFiles) {
    const slash = require(`./slashCommands/${file}`);
    client.slashCommands.set(file.split(/.js$/)[0],slash);
    commands.push(slash.data.toJSON());
}

const rest = new REST({ version: '9' }).setToken(token);

(async () => {
    try {
        console.log('Started refreshing application (/) commands.');

        await rest.put(
            Routes.applicationCommands(clientId),
            { body: commands },
        ).catch(() => null)

        console.log('Successfully reloaded application (/) commands.');
    } catch (error) {
        console.error(error);
    }
})();
client.on('interactionCreate', async interaction => {
    if (!interaction.isCommand()) return;

    const slash = client.slashCommands.get(interaction.commandName);

    if (!slash) return;

    try {
        await slash.execute(client, interaction);
    } catch (error) {
        console.error(error);
        await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
    }
});
}catch (e){
    return;
}

So by that why it should load the slash for servers that invited with scope and skip that didn't ?

lyric mountain
#

I guess

#

remember promises ignore try-catch blocks

pallid jungle
#

But i think

#

It just will not send the error in console

lyric mountain
#

yes

pallid jungle
#

And will not load the slashs too

lyric mountain
#

it's called "silent error"

pallid jungle
#

@lyric mountain But it won't send this message

 console.log('Successfully reloaded application (/) commands.');
#

In console

lyric mountain
#

yes

boreal iron
#

You’re registering your slash commands with that code.
It can take up to one hour if they’re pushed to all guilds.

#

I wonder why you don’t use discordjs methods to push commands if you’re already using the library?

#

The client applications manager allows you to fetch (get) all already registered interactions as well creating (registering) them, editing them or deleting them.

#

(take a look at the methods listed in the docs)

#

There are examples as well

#

Already tried to explain the steps, too a little earlier

#

Also tried to explain if you’re registering them over and over again you will reach the daily limit and it will always take up to one hour again since identical registrations will replace existing ones.

#

Register them once, check if they are registered and up to date in your bots ready event and register/edit/delete them if needed, not any time you start the bot.

#

Same goes for guild commands, reloading your bot due testing purposes 40x for example with each 5 commands you register over and over again and boom rate limit (200) for 24h

#

Handling slash commands correctly is really important or the guilds your bot is in will see your global commands after a bot restart but can’t use them because you register them over and over again causing an application error

#

Because they will overwrite the previous registered ones and will take up to another hour to work

#

Guess that was detailed enough tho

#

credits to the master of write and drive

median raft
#

Is it possible to create a linked text in an embed's footer?

lyric mountain
#

no

blissful coral
#

Anyone know a half decent package for getting color palletes where I am able to get the priority color?

blissful coral
#

Oki

lyric mountain
winged mulch
#

I have this code:

``` Where `token` is my real token of course, yet I get this error. ```(node:23581) UnhandledPromiseRejectionWarning: Error: 401 Unauthorized (You need a token for this endpoint)
``` Why?
grim aspen
#

It says you need a token

#

Wait wtf is (“token”)

#

I think you’re supposed to use your token that was generated for you

earnest phoenix
#

Make sure you're providing a valid token

#

Make sure no characters are cut off from the one you're giving to it

winged mulch
grim aspen
#

Which one?

#

The error?

#

You need a proper token

winged mulch
#

The message below the code

#

The first 5 words

grim aspen
#

So you’re just putting token as your token

winged mulch
#

No

#

I said token is a placeholder for my real token lol

grim aspen
#

The way the sentence was, it sounded like you were putting token

winged mulch
#

Fixed

winged mulch
shy turret
#

using pure css, how would you be able to perfect back and front arrows

#

no matter how much i try, even setting the .state and using it, and a ton of stackoverflow, it just doesnt work well

#

the front and back arrows keep breaking and doesnt work properly

#

and sometimes it makes me click the button twice, but it still breaks

#

and wtf did i just do i fixed it

spark flint
#

how do i get a random line from a json file using python

shy turret
#

basically, if you know how to get a random number and read a json file with python

#

you can do math

#

idk python lmao

#

but basically

shy turret
#

assuming data.json is ["never", "gonna", "give", "you", "up"] or an array

spark flint
#

nope

#

didn't work

winged mulch
#

@spark flint ^

spark flint
#

alr

#

lemme try

#

not working

#

i need it as a list

#

my json looks like this:

#
{
  "Tom Gates":"big.bun#6969",
  "An Inspector Calls":"big.bun#6969"
}```
#

I need to get a random entry each time, like I need "Tom Gates":"big.bun#6969" etc returned to me

winged mulch
spark flint
#

I tried

winged mulch
#

Go in the file

#

Remove everything

#

Put [] in it

#

Done

spark flint
#

But that means I can't store the data in it too

#

its in the format "book":"submitting user"

pale vessel
#

Yes you can json [ { "book": "user" }, { "book2": "user2" } ]

#

Actually you can keep your structure, but just get a random key from the object

spark flint
#

ah ok

fleet lion
#

I found a great article on how to get an https certificate on a server:

spark flint
#

thats the response

#

how do i then split it up

#

into "title":"submission user" format

pale vessel
#

Actually you could unpack it py book, author = random.choice(tuple(data.items()))

#

Use your old structure

#

It's good enough

spark flint
#

alr

#

error

#

too many values to unpack

drifting shell
#

Does anyone know of Hydra streams directly from Deezer or if it just uses their api to do a YouTube search? Didn’t think they did but thought I’d ask

spark flint
#

oh it works now

drifting shell
#

It was more of a question that’s aimed to anyone who can answer it

spark flint
#

im pretty sure it is youtube tho

drifting shell
#

Jake I hate you onesieKEKW

plain talon
pale vessel
#

LP doesn't support Deezer plus the tracks would be DRM protected

drifting shell
#

Deezer mentioned not letting mp3s be downloadable to any user of your app so it made me question it

pale vessel
#

Deezer nuts

spark flint
#

LMAO

#

thats new

shy turret
pale vessel
#

But yeah most services do not offer downloads in formats of MP3 or some sort

#

They're obviously going to be used for piracy reasons

#

Even YouTube stores downloaded videos with encryption

#

Most of these integrations on music bots rely HEAVILY on YouTube

#

Hench why Groovy closed up shop since it's powerless without YT

drifting shell
#

Probably why YouTube is so pissy about it

#

If they don’t get the traffic it’s just costing them money with no return

proven lantern
#

is there a way to make a bot invite link that installs slash commands at a guild(not global) level or do i need to manually call the api to register the commands for each guild?

pale vessel
#

Manually yes

#

Guild commands shouldn't be used in production unless it's part of a global command (that creates a guild command)

boreal iron
#

Of course with a proper command handler being called on the guild_create event

proven lantern
#

my plan is to avoid all ws event listeners

boreal iron
#

But yeah as flazepe said they are supposed to be used for testing purposes only

pale vessel
#

You can't

proven lantern
#

i might need to make them global then

#

global commands are available once the invite is accepted i think

#

i dont want DMs to work

boreal iron
#

I’ve added a property to the command module including an array of guild IDs it will be pushed to (if the array isn’t empty)

#

Also just for testing purposes

#

The command handler will register/update/delete them in the ready event as well as if a guild was added

proven lantern
#

im removing all my ws code so i dont need a vps. ill need to think of a way to do it without that event

pale vessel
#

Guild commands can be nifty for something like premium-only commands though

proven lantern
#

so can you make an invite that gives you the slash commands, but doesn't invite the bot?

#

how would you remove the slash commands then

pale vessel
#

Delete the integration

#

Should be in server settings

boreal iron
#

Your webserver receiving the webhooks will need to be online 24/7 as well as the node process for example

proven lantern
#

im using firebase. it goes to sleep, but wakes up pretty fast

#

i made a new discord bot for test the global commands

#

i need to see how those work without breaking my current bot

coarse topaz
#

Hi, how can I check if a message is inside a specific category? (discord.js)

pale vessel
#

Channel category?

pale vessel
#

What do you mean by category, particularly?

coarse topaz
#

A channel category, yes. Just like this

pale vessel
#

that would be <Message>.channel.parent?.name

#

Parent could be nullable, so you have to take that into account

coarse topaz
#

Basically, I want to do something like

if (!message.isinsidecategory(category_id)) return;

sudden geyser
#

You can use flaze's solution but instead of checking the .name check the .id

#

Then just compare it with === category_id

coarse topaz
#

Thanks!

proven lantern
#

i just added my slash commands to my guild without adding the bot. how am i supposed to delete the slash commands now? add the bot and then delete it?

pale vessel
proven lantern
#

like this?

pale vessel
#

Wut

proven lantern
#

what is the integration?

pale vessel
#

Open my replied message

proven lantern
#

found

#

thanks

#

it looks like the guild wont receive newly registered slash commands if the bot isn't invited to the guild.

coarse topaz
#

Could someone please tell me what am I doing wrong? I'm not getting errors in the console
if (message.content === `${prefix}gamevote`){ let args = message.content.split(" "); let gameLinksArray = args.slice(1); message.delete(); for (const gameLink of gameLinksArray) { const embed = new Discord.MessageEmbed() .setTitle("test") .setDescription(`${gameLink}`) .setColor("GREEN") const m = await message.channel.send(embed) m.react("883171729545887744", "883171774672404480", "877661359226097686", "883171774672404480"); } }
When the command is ran, the bot should create a separated embed for each gameLink in gameLinksArray, and then react to every embed with those emojis in m.react()

pale vessel
#

You're checking if the message content is explicitly <prefix>gamevote

#

You sure you don't want to check if it starts with <prefix>gamevote instead?

errant flax
#

use a command handler btw danceydance

forest drift
#

Could someone please tell me where my codes going wrong?

Within the block:

client.on('messageReactionAdd', async (reaction, user) => {});

Is this code:

reaction.message.guild.members.fetch(user.id).roles.add(reaction.message.guild.roles.cache.find(role => role.id === '880408756360450048'));

Ive tried probally 20 different methods but just can't get it to work

wheat mesa
#

Have you done some debugging of any sort

#

Is the role undefined, is the Member object undefined, are you caching roles and members, etc?

coarse topaz
pale vessel
forest drift
pale vessel
#

Make sure you have the guild message reactions intent too

forest drift
#

await reaction.message.guild.members.fetch(user.id).roles.add(reaction.message.guild.roles.cache.find(role => role.id === '880408756360450048')); better?

forest drift
pale vessel
#

no, the parentheses are crucial

wheat mesa
#

You should probably store the fetched member in a variable to make your code more readable... Just a tip

forest drift
#
var usermain = await reaction.message.guild.members.fetch(user);
var rolemain = reaction.message.guild.roles.cache.find(role => role.id === '880408756360450048')
usermain.roles.add(rolemain)

@pale vessel

pale vessel
#

Try that

forest drift
#

kk

pale vessel
#

Btw you can just provide role ID, no need to use .find() (actually roles.cache.get(id) would have been the preferred method since you have the id but I digress)

#

usermain.roles.add("id")

forest drift
#

wait thats a thing now?

wheat mesa
#

Ew

#

var

forest drift
#

why does everyone then always say the cache.find method

wheat mesa
#

Why var

pale vessel
#

Always has been, since it takes a RoleResolvable

#

IDs/snowflakes can be resolved to a role

forest drift
#

u gotta be kidding me -___- the await was the issue the whole time

wheat mesa
#

Resolving promises is important

#

30 hours of debugging sounds like a bit of an exaggeration 😉

forest drift
wheat mesa
#

10 hours of debugging a day?!

forest drift
#

await(reaction.message.guild.members.fetch(user.id)).roles.add(reaction.message.guild.roles.cache.find(role => role.id === '880408756360450048'));
wait so why doesnt that work?

pale vessel
#

await should be inside

#

Not outside

forest drift
#

ah

#

also i said user.id there when it seems just user works

#

(await reaction.message.guild.members.fetch(user)).roles.add(reaction.message.guild.roles.cache.find(role => role.id === '880408756360450048'));

#

entire thing?

pale vessel
#

just put the ID for the role

forest drift
#

ok

pale vessel
#

you don't need to find the object

#

Btw if you do, use roles.cache.get(id) instead

forest drift
#

(await reaction.message.guild.members.fetch(user)).roles.add('880408756360450048')?

pale vessel
#

Yeah

wheat mesa
#

Am I the only one who’s not afraid to make a variable just to make it easier to read

pale vessel
#

Probably

#

I don't see a need for it

wheat mesa
#

Well not necessarily for this, but the code he had before

forest drift
#

(await reaction.message.guild.members.fetch(user)).roles.add(reaction.message.guild.roles.cache.get('880408756360450048')) that all?

pale vessel
#

Only use variables if you need to use it more than once

wheat mesa
#

I typically use variables for resolving promises as well, just because it can get messy

pale vessel
#

Otherwise you'd be sacrificing (insignificant) performance for readability

#

Which is fine tbh

wheat mesa
#

It’s a tiny amount of performance at most

pale vessel
#

But I'm used to not doing that

wheat mesa
#

Obviously if it needed to be extremely optimized for some reason, you wouldn’t even be using js so it’s not a problem mmulu

forest drift
#

just quick question before i mess it up, to remove a role is just the same thing but with .remove instead of .add? for some reason ive never had to remove roles before

pale vessel
#

Yeah

#

Read docs fir GuildMemberRoleManager (I think it's called that)

forest drift
#

add

client.on('messageReactionAdd', async (reaction, user) => {
    if (reaction.partial) {try {await reaction.fetch()} catch (error) { return console.error('Something went wrong when fetching the message: ', error)}}
    if(reaction._emoji.name==="💸"&&reaction.message.id==='881921227449593886'){
    (await reaction.message.guild.members.fetch(user)).roles.add(reaction.message.guild.roles.cache.find(role => role.id === '880408756360450048'));
    }
});

remove

client.on('messageReactionRemove', async (reaction, user) => {
    if (reaction.partial) {try {await reaction.fetch()} catch (error) { return console.error('Something went wrong when fetching the message: ', error)}}
    if(reaction._emoji.name==="💸"&&reaction.message.id==='881921227449593886'){
    (await reaction.message.guild.members.fetch(user)).roles.remove(reaction.message.guild.roles.cache.find(role => role.id === '880408756360450048'));
    }
});

so is the "remove" one correct?

forest drift
pale vessel
#

Seems correct

wheat mesa
#

Uh

#

Why reaction._emoji

forest drift
#

uk idk why, but it works so i dont ask

pale vessel
#

Yea that's an internal property

#

Oh well if it works it works

wheat mesa
#

Still a bad habit to get into, but you do you

pale vessel
#

It's like using member._roles to get an array of role IDs of that member

#

It's probably fine but don't complain if they decided to change the internal stuff and your command stops working

forest drift
#
client.on('messageReactionAdd', async (reaction, user) => {
    if (reaction.partial) {try {await reaction.fetch()} catch (error) { return console.error('Something went wrong when fetching the message: ', error)}}
    var emojireacts = ["💸","📢","👀"];
    var rolereacts = ["880408756360450048","880408592883257435","880408702019063848"];
    if(reaction.message.id==='881921227449593886'){
    for(let i=0; i<emojireacts.length;i++ ){
        if(reaction._emoji.name===emojireacts[i]){
            (await reaction.message.guild.members.fetch(user)).roles.add(reaction.message.guild.roles.cache.find(role => role.id === rolereacts[i]));
        }
    }
    }
});

so this all should work?

wheat mesa
#

Try it and see

#

Also

#

var is yucky

#

Use let or const

forest drift
#

i like my var

wheat mesa
#

Var yucky

lament rock
#

use of var can have unintended side effects and is widely discouraged and it is viewed as a legacy initializer