#development
1 messages · Page 1864 of 1
cf dont put a markup on, you cant get cheaper for renewal
but they STILL dont do .co.uk 😦
or .cc 😦
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
there are two name.com offers that u can get
two free domains, as long as u have access to Azure Student
i got two free domains using github student
i used to buy domains to use with silly reverse DNS on irc
Azure has a free Name domain, GitHub has a free Name, and then a free .me
i'm 15 and currently own 14 domains with namecheap
like i had one that was like "my-fart.made-an.eternalstorm.org" lol
i also have like 4-5 with lcn
and one with brixly (transferred there as i use them for reseller hosting)
and i still got one i think like "crap.im.in.trouble.norton.wont.take.the.virus-away.co.uk" or something
i have nevergonnagiveyouup.co.uk
nice
sometimes i fuck around with IPs on OVH and host really fucking stupid shit in VMS with those IPs, having dumb as fuck rDNSes
put a path on its web
and i plan to buy eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeea.sports when the .sports tld is relased
lol
omfg
good idea
i bought a domain for my custom nameservers which i now also use for dynamic dns
or even funnier just make it a png
good idea
well png path
give me a min
with a MIME type of HTML
you got many ipv4s dannington?
yee
like
i think i have like two /29 blocks and three /30 blocks for each one of my dedis
nice
so two 8 blocks and three 4 blocks
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
fair enough, my dedis aren't that powerful but i need a lot of IPs to run DDoS protection
i guess in sets of 8 or 16 they dont ask too many questions
OVH has had a hard time with IPs
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
ah
but they give everyone like a /48 of ipv6
can just use that for most things 😄
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
yea but OVH's IPv6 routing is weird as hell
i made the site ugly
decent
their routing 'feels like' its an ipv6 over ipv4 tunnel
it is an IPv6 over IPv4 type of thing
i get similar routing and stuff to tunnelbroker
i think you assign IPv6 using IPv4 IPs
compared to your typical IPv4 which assigns using MAC
pain
dhcp6 is a joke
it shouldnt be needed, in a world which has auto assignment by radvd
i agree, tbh i just use static if ever IPv6 at all
i mean what they gonnna do, try to nat ipv6? lol
sounds like the silly shit virgin media do
virgin media NATs IPv6?
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
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
damn
I just made the best 404 page
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
I was thinking another hash function specifically for ints
https://media.discordapp.net/attachments/825407339254644779/882806425880002570/unknown.png
gotta love the github client
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
What happens if the image 404's
LOL
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.
What?????????????
my question?
trying to conduct some research. how is blockchain and tokens reach the technology illiterate, how is it helping them, etc.
Probably best to use a survey for something like that
https://support.google.com/surveys/answer/2372144?hl=en#zippy=%2Cwhere-will-my-survey-questions-appear
Creating a new survey is simple: Visit https://surveys.google.com/your-surveys. Click + NEW SURVEY. In step 1 (Write questions), select the appropriate que
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
- PHP
yes
we use jsp
japanscript?
🤦♂️
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)
Do they not provide sandbox for localhost to test out the webhook? it says i can't add http to listen to events
You have to put {} after the else like else { return }
oh nvm that wasn't a syntax error
im taking part in a webdev competition...
can anyone give css tips?
also a good layout suggestion
<navbar>
<main>
<footer>
here is an example of my skills
http://abdul-kalam.great-site.net/
images look terrible on mobile
ikr not responsive
here desktop look
ok
any suggestions/tips?
oof
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?
The yellow doesn't fit
1 year old
I don't think it matters that the site was generate by jsdoc, just scrape it
I'm guessing they extract the jsdoc data in JSON format and expose an API which queries it, and the bot just uses that API
or maybe not even the entire data, just the data used for the search feature
For discord.py, is there any way to ignore pinning and unpinning messages in on_message ?
ints dont really need a hash function, you can just modulo them, unless they have very bad distribution
stuff like snowflakes for example dont need hashing
what actually needs hashing to use the api
what api
discord api?
How to put to replit.file
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
provide the code snippet
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
What is it defined as
I assume it's the bytes of the image that's returned from the URL?
yes
Huh
did u even know we can read the image bytes from a url?
Yeah
then why the "huh"
Do you have a similar issue with other commands?
Have you tried using the command with your bot's instance turned off?
Try commenting out the command
won't it just stop to work then?
🤷 Unless you somehow have 2 functions handling the same message input (aka command), pretty much
Unless your command itself somehow uploads the emote twice
I see, thanks
The golden apple guys said to put the code in .replit file but wat is .replit file?
if you dont have one, you create one
doesn't npm only has node v16.1?
ye the node npm packages
package*
hey time why does the run.sh file wont let me download some old node versions 
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
How to do this?
Import discord.js properly???
Maybe they did, but it's Discord.Client()
Could be
Is this right?
How to do this?
You are not requiring discord.js
ik im probably being stupid but how do i ping a role with the role id?
put a const Discord = require("discord.js"); at the top of your file
<@&id> iirc
<@&265125253443878912>
yeah it is
ty i forgot lol
oh role mentions are clickable now??
It said these
my god
Do u know how to do
go back to what you had before
you added a duplicate line
there was no need to add that to the top
It said this
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
looks like you have seen https://www.youtube.com/watch?v=MAlSjtxy5ak 
Lol
well, install it
yes 
ffmpeg-static worked
if you dont know how to install FFmpeg, you can install ffmpeg-static, which is an npm package
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?
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
so i should be totally safe to use snowflakes for all my resources (in a basic example - users, guilds, channels, sessions)
correct
assuming the same generator is used for all resources, instead of a dedicated generator for each resource, then no snowflake would ever be identical
I was mainly worried about poor distribution but after some testing they seem to be very good actually
better performance since no hashing is required lmao
ye
yep, same one
thanks then, that helps
o/
we dont know how discord implements snowflakes in their backend, but im assuming they do it like that
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
I commanded help first
Lets just continue to post blurry ass pictures of errors why dont we

TwT
@inner warren
inb4 a server where you can pay people to write code for you comes up
it shouldn't, because even if they both occur in same time, the process or worker will be different resulting in different id
that's from my understanding from how snowflake format is
yeah
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
Why would it be wasteful? You’re still querying the db for the same information.
because findone would return the document which hurts performance if the document is large enough and you dont need the data at all
the best way to do so is to just retrieve the id field if your driver lets you do that
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
@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
hm, ok
looks fine, idk the details of how fnv works
I'm confused.
let member = interaction.options.getMember('user') || interaction.member;
member.presence.status
Cannot read property status of null.
Ah
Presence can be nullable as well
So it probably presence that is returning that erorr
What can I do?
Well
"Well that sucks"
You can check whether they have a presence or not
.. and what does it mean if they do not?
lazy me would just
member?.presence.status || "none"
He could have a presence but return null?
It's not lazy if it's efficient 
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?
Is it possible to have a presence status but return null?
i was just basing it off of the js implementation https://github.com/sindresorhus/fnv1a/blob/main/index.js
It seems so
One message removed from a suspended account.
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
ye i looked at this one as well
fucking sindre
I have the guild Presences Intent, though.
he has libs for everything
Ah I see
That makes sense
It could still be uncached
The bot is legit in 4 servers.
Members aren't always cached
Yes, still uncached
You have to fetch them most of the time
You can fetch the member though flaze
Oh but I think you csn through WS
and get the presence from that fetched member
With withPresence set to true
Dont spam
My Wifi.. I'm sorry.
i guess it depends, do you want to fetch the member each time?
or do you want to just default to a specific value
I would think it would be easier to fetch the member then get their presence but ig flaze says otherwise
check out this implementation
One message removed from a suspended account.
uber hardcore implementation
i tested it, this is the fastest js fnv1a implementation
a hashing algorithm
I see
ie to convert keys into hashes for a hash table
I see I see
I didn't understand where the withPresence is.
It is an option for fetch
members.fetch({ withPresences: true })
Ah..
<Guild>.members.fetch({withPresence: true})
Though that fetches all the users in the guild no?
Tim would that be an issue or?
provide the user as option
Yea
or if you want to be weird.
https://discord.js.org/#/docs/main/stable/class/GuildMember?scrollTo=fetch

probably uses REST
so no presence
withPresences is an option for bulk request guild members gateway opcode
if you wanna fetch a specific user yea
use math
rbga is actually really good ngl
no but really, you can easily add/remove saturation with hsl which gives you nice looking palettes
I use it in web dev
interaction.guild.members.fetch(member, { withPresence: true }).presence.status
Like this, correct?
fetch is a promise, youll need to await it
Forgot. 👍
-----> 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
Should be withPresences, my bad
Ahh.. sweet.
and use (await fetch()).presence (like Woo said, resolve the promise)
How to fix this ?
I just updated to discord.js v13
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
Doesn't it also need node v16.6 min?
I think
👍
So
Should i send package ?
change it to 16.x in package.json under engines
that might fix the issue, I'm not sure
the node? you can do it via downloading the latest one on the website
if he is downloading the latest node
same
yes
{
"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
i think the worse performance is the better hand off between rewriting all of that in c++
add a new property called engines
ok
{ "engines": { "node": "16.x" } }```
wow that's a lot of dependencies
that's what happens when you rely too much on simple packages
I almost thought they sent their lockfile

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]: }
youll need to handle permission errors yeah.
I need it for slash commands
If someone
didn't invite the bot with scope bot applications.commands
Are you creating guild commands on every invite?
That's not efficient for production, use global commands instead
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
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.
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
Oh
But i now added catch and it worked but the bot is working but still didn't load the slash it will take long ?
I should load them at guildcreate event?
guildcreate*
Guild commands should be used for testing purpose only and they are available immediately
I tested it on another bot on one server and it loaded fast
As I said guild commands are getting deployed immediately
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
channel is undefined
Yes
you need to define it to use it
did u try visiting localhost:3001 in ur browser?
Yep
no error in the console?
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]: }
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
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?
Ah yes.
I have.
i have checked so so so many times but it still gives me this.
At first i thought it was a problem regarding Top.gg's webhook.
dblapi.js is deprecated
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
Thank you very much ❤️
Okay so regarding what you posted. This is the command I have running for the votes.
I don't use Top.gg's sdk
But I guess, I could work around this and use the example on the documentation, Woo.
dblapi is deprecated, and is no longer supported
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.
this embed is inaccurate
kek
this channel is in fact ONLY FOR DEVELOPMENT SUPPORT
yeah, started my message with dblapi
prefix is cringe
Ahh well, that makes more sense.
I mean while installing the dependencies, it did warn me but I tend to ignore it.
Thanks for the notice, Woo. ❤️
i changed my bot avatar from hours now it's still the same ?
what's wrong with discord now ?
did you change the application icon, or the bot avatar?
lmao
How can I disable a specific permission for a role that is enabled in the everyone role?
just disable it
Bcoz im thinking if a permission is disabled it defaults to the permission set for everyone role
by default any role is higher than everyone role
in server settings you can decide what role is higher than other
So does that mean if a role is higher it completely overwrite the lower roles
yep
How do I change the number of columns in a grid based on screen size?
See media query in css
@earnest phoenix also if you're experienced in css, i recommend learning tailwind. And forget all these problems
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!');
},
};
Errors?
you are looking for the files im the wrong folder
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)
?
Channel is not defined and what Tim said
Im trying to work with bitfield in js. How can i create flags more than 32
check your readdir functions
you are loading files from the slashcommands folder
not from its subfolders
Then ?
commands\bot\ping.js
that is the file being executed
which is not in slashcommands folder
either bigint or math
oh
How can I use bitwise operators with them.?
Oh
just that all operands have to be bigints as well
How many flags can i create with bigint
infinite
Oohhk thnks
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());
ok thanks
and the latter var wasn't used at all
@low bone slashCommands.push(command.data.toJSON());
^
ReferenceError: command is not defined
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
does anyone know how to set a custom biography for a bot via the api, without the discord developer dashboard ?
not allowed i think
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 });
}
});
what is slashCommands for first?
It was in discord.js guide idk i will delete it
k sad :/
let me edit the code you sent, with removing some things and try
ok
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
cool
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
client.slashCommands.set(file.split(/.js$/)[0],slash);
below this add
commands.push(command.data.toJSON());
ok
and after this
client.slashCommands = new Collection();
add
const commands=[]
I already have commands handler
client.commands = new Discord.Collection();
it's different from client.commands
it's the one responsible of listing all the slash commands data
so he refresh it
oh
i got this
ReferenceError: command is not defined
at Object.<anonymous> (E:\C) Developing\Wolfy Djs-13\index.js:43:19)
wait
u maybe missed s
y wlc
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...
I use chakra ui
So much easier than tailwind
disconnect is undefined or cannot read property disconnect of undefined?
Any recommended screen sizes for media queries to detect mobile?
cannot read property of undefined, i explained myself bad sorry lol
in this function u must first check if the bot in vc or not first
or just use
voice.getVoiceConnection(message.guild.id)?.disconnect?.();
yo why is there a cpp file
long story lol, im just trying some things on that
but this will avoid giving error , so catch will be useless 😄
yes exactly lol
by doing this it does everything right
except for the only thing it had to do
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)
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
How does discord permissions work?
I created a role and disabled all permissions.
But it has no effect...
well, official docs dont even help much, there are listed like only a handful of functions
If the base role has admin they can do anything
no it has no any other role with admin permission
does all roles below a specific roles gets add up? ie union (OR) of each permission
likely yes
why not use the djs13 directly to disconnect?
if a permission is on everyone, then its on all roles
i tried this
message.guild.me.voice.channel.leave();
does it work? fuck no
Imagine making an anarchy server where everyone has admin
what
voice.disconnect()
how can I overwrite @everyone.
I want to make a role that cant join a vc, but @everyone can
ok yes this works lol, but as soon as i changed the leave command the join one stopped working LMAO
im done
add permission overrides to all voice channels
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(() => {});
Not possible
thats weird. Why dont they allow reordering @everyone
channel overrides are the only way
and disable the role perms for the bot role in vc settings
async execute(client, interaction)
did u change the execute arguments from the main file?
because it was passing interaction only not client
No ._.
better: use destructuring because it's easy to forget the order of your parameters
.< weird tho 😄
and how do I restrict a role to add reactions, but @everyone can
ik lol i'll try to fix it now
pretty sure you can forbid reactions on a per channel basis
await <Channel>.permissionOverwrites.edit(`RoleID`,
{
ADD_REACTIONS:false
})
await <Channel>.permissionsOverwrites.edit(<Guild>.roles.everyone,
{
ADD_REACTIONS:true
})
You can combine them together
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);
If you want to load your .env file, you should use a package like dotenv
Not working too
oh, how?
show your source code
This working in bottom of code but i want to add const { token } for the slash commands
client.login(process.env.token);
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
If you're using a .dotenv file, you want dotenv to load that file. You'll first require it (like Mido demonstrated). You can find the token under the process.env (like you were doing)
kk
I am using heroku
You should still be able to install dependencies.
anyone know how to make a select option on discord.py
doesn't that require slash commands
so like it outputs the top 3 items and shows whatever answer you react with
i think on deployment it automatically install dependencies (or i forgot)
I will try
or does anyone know how i can select only the first 3 options from a json response
If it's an array, you can use slicing (e.g. arr[:3])
if process.env already works, just use it again lol
you dont need to do anything different to use it with slash commands
const { token } = require('process.env') ?
no
oh
do you mind if i play around with the tiny discord lib? since its got no license would prefer to ask ^_^ @quartz kindle
haha
this is amusing
wtf
no

are you trolling at this point
literally put it in your slash commands
.<
Or just should i add
well yes
why u want this TOKEN!! var
if you absolutely must put it in a var then yes
const rest = new REST({ version: '9' }).setToken("bottoken");
just put it there
.setToken(process.env.token)
oh okay
anywhere u want token do same thing
process.env.token
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
Oh it another problem
bruh
How to fix this
the nv char hashing algo has a really low collision rate
going to measure the performance of my map implementation when i quickly port it from osless to linux lol
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 😅
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?
in the .ban() function
like <user>.ban({ reason: 'blabla' });
Guys my bot is public and i want to skip the server that didn't invite my bot with the scope
I ban with: .guild.members.ban(user)
just add a second option in the ban function
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?
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
of items?
i got it to work
embed = discord.Embed(title=f"{r['items'][0]['volumeInfo']['title']}", url=r['items'][0]['volumeInfo']['infoLink'])
I read this Book lol
whut, I have an another opinion xD
if you are using .py, i think you can set a url parameter that is applied to the whole title
its sorted alreadey
my b
how to make a public bot skip the server that didn't invite the bot with the slash command scope
no,
const { token } = process.env;
``` or
```js
const token = process.env.token;
what language
Discord.js
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)
}
});
}
})
just trycatch it and ignore when it errors
also forEach bad
@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 ?
yes
And will not load the slashs too
it's called "silent error"
@lyric mountain But it won't send this message
console.log('Successfully reloaded application (/) commands.');
In console
yes
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
Is it possible to create a linked text in an embed's footer?
no
Anyone know a half decent package for getting color palletes where I am able to get the priority color?
color-thief
Oki
Get the dominant color or color palette from an image.
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?
It says you need a token
Wait wtf is (“token”)
I think you’re supposed to use your token that was generated for you
Make sure you're providing a valid token
Make sure no characters are cut off from the one you're giving to it
Have you read the message?
So you’re just putting token as your token
The way the sentence was, it sounded like you were putting token
Fixed
What's Api
const { Webhook, Api } = require("@top-gg/sdk")
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
how do i get a random line from a json file using python
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
probably something like this (prob wont work, i stole code from google then modified it)
import json
import random
f = open('data.json', 'r')
data = json.load(f.read())
print(random.choice(data))
assuming data.json is ["never", "gonna", "give", "you", "up"] or an array
You don't need the .read() part
@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
Put them in a list so you can pick a random item
But that means I can't store the data in it too
its in the format "book":"submitting user"
Yes you can json [ { "book": "user" }, { "book2": "user2" } ]
Actually you can keep your structure, but just get a random key from the object
ah ok
I found a great article on how to get an https certificate on a server:
thats the response
how do i then split it up
into "title":"submission user" format
You do py random = random.choice(tuple(data.items()))
Actually you could unpack it py book, author = random.choice(tuple(data.items()))
Use your old structure
It's good enough
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
oh it works now
no clue sorry
It was more of a question that’s aimed to anyone who can answer it
im pretty sure it is youtube tho
Dunno mate
Jake I hate you 
YT for sure
I know, I know
LP doesn't support Deezer plus the tracks would be DRM protected
Deezer mentioned not letting mp3s be downloadable to any user of your app so it made me question it
Deezer nuts
hm thanks (might learn py soon, looks really easy)
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
Probably why YouTube is so pissy about it
If they don’t get the traffic it’s just costing them money with no return
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?
Manually yes
Guild commands shouldn't be used in production unless it's part of a global command (that creates a guild command)
Of course with a proper command handler being called on the guild_create event
my plan is to avoid all ws event listeners
But yeah as flazepe said they are supposed to be used for testing purposes only
You can't
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
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
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
Guild commands can be nifty for something like premium-only commands though
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
Your webserver receiving the webhooks will need to be online 24/7 as well as the node process for example
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
Hi, how can I check if a message is inside a specific category? (discord.js)
Channel category?
Off the top of my head, check the <Message>.channel.type (https://discord.js.org/#/docs/main/stable/typedef/ChannelType)
What do you mean by category, particularly?
A channel category, yes. Just like this
that would be <Message>.channel.parent?.name
Parent could be nullable, so you have to take that into account
Basically, I want to do something like
if (!message.isinsidecategory(category_id)) return;
You can use flaze's solution but instead of checking the .name check the .id
Then just compare it with === category_id
Thanks!
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?
.
Wut
what is the integration?
Open my replied message
found
thanks
it looks like the guild wont receive newly registered slash commands if the bot isn't invited to the guild.
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()
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?
use a command handler btw 
Oh lmao you're right 
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
Have you done some debugging of any sort
Is the role undefined, is the Member object undefined, are you caching roles and members, etc?
Just fixed it and something else regarding reactions; it worked now, thanks a lot for the help 
members.fetch() returns a Promise, be sure to await it before accessing its properties (await members.fetch(id)).roles.add(...)
around 30ish hours
ill try that
Make sure you have the guild message reactions intent too
await reaction.message.guild.members.fetch(user.id).roles.add(reaction.message.guild.roles.cache.find(role => role.id === '880408756360450048')); better?
already triple checked
no, the parentheses are crucial
You should probably store the fetched member in a variable to make your code more readable... Just a tip
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
Try that
kk
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")
wait thats a thing now?
why does everyone then always say the cache.find method
Why var
Always has been, since it takes a RoleResolvable
IDs/snowflakes can be resolved to a role
u gotta be kidding me -___- the await was the issue the whole time
Resolving promises is important
30 hours of debugging sounds like a bit of an exaggeration 😉
Ive been working on it for 3 days ._. i didnt even think about promises
10 hours of debugging a day?!
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?
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?
just put the ID for the role
ok
(await reaction.message.guild.members.fetch(user)).roles.add('880408756360450048')?
Yeah
Am I the only one who’s not afraid to make a variable just to make it easier to read
Well not necessarily for this, but the code he had before
(await reaction.message.guild.members.fetch(user)).roles.add(reaction.message.guild.roles.cache.get('880408756360450048')) that all?
Only use variables if you need to use it more than once
I typically use variables for resolving promises as well, just because it can get messy
Otherwise you'd be sacrificing (insignificant) performance for readability
Which is fine tbh
It’s a tiny amount of performance at most
But I'm used to not doing that
Obviously if it needed to be extremely optimized for some reason, you wouldn’t even be using js so it’s not a problem 
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
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?
i tried, my brain fried... its too late for me to learn rn
Seems correct
uk idk why, but it works so i dont ask
Still a bad habit to get into, but you do you
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
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?
i like my var
use of var can have unintended side effects and is widely discouraged and it is viewed as a legacy initializer


