#development
1 messages · Page 2022 of 1
On response create, where you specify your content
Oh the line where I send the ping? So like:
interaction.channel.send({ content: "<@&" + roles.queuePing + ">", allowed_mentions: true });
oh ic. okay ill check the djs docs. thx for your help!
Once again I'm using discord.js v12 and trying to do >profile to show the user place on the leaderboard and when I put
${client.user.cache.get(member.id).tag}
It only show member tag but idk if this is right or not
You shouldn't be using v12 as API v8 will be deprecated quite soon
also, it's only showing user tag because that's all you tell it to show
client.users / client.user is a ClientUser
It what I started off with and I know
I will switch when it does break
Atm just let me learn
were it so easy in Discord development. I wish Discord would stop updating so fucking fast. I'm overworked as a library dev 
You'll be shitting bricks when "1 small thing" takes a long time for a rewrite
Lol
why the image is not displaying?
createinvite is not a function, what the name for it on djs 13
i think it was <Guild>.invites.create()
tried this
maxAge: args[0] ? ms(args[0]) : 0,
maxUses: args[1] ? args[1] : 0,
reason: "Invite requested by " + message.author.tag
})```
and instead undefined reading create
ahhh no it is wrong
it is
<Channel>.createInvite()
sorry
I tried that before and it said it's not a function
Is the first channel a category? If it is then it won't work
gonna bookmark that
I think, so basically it create a invite link of that server
guys, how can I make bot to get mentioned role...ammm Something like message.mentions.channels.first() but jus for roles
Use .roles instead of .channels
ahh mybe it could work
I don't think roles are ordered in any particular way though, so .first() may not return the actual first role
ordered by how the gateway returns them
based
whats wrong
Look
I'm trying to pull an image
Like this
docker pull parrotsec/core
But then I get this

Is the docker daemon running?```
you on a linux system?
if using systemd you can sudo systemctl start dockerd or just sudo dockerd
failed to connect to {unix:///var/run/docker/containerd/containerd.sock 0 }. Err :connection error: desc = "transport: error while dialing: dial unix:///var/run/docker/containerd/containerd.sock: timeout". Reconnecting... failed to start containerd: timeout waiting for containerd to start
I already tried dockerd
And I got this
wait a bit
Haven’t seen someone use Unix in quite a while.
why not use unix
weird
Anyways here are the logs
My stackoverflow question got deleted lol
I can run it
Ik this really aint devvin but like can someone make me a discord bot that Announces when twitch drops happen
@austere surge anything?
localhost:~# service docker status
- status: started
localhost:~# service containerd status - status: started
whats the pull command saying now
How do i install discord.js and a twitch api
npm
Same thing
Anyone wanna make me a discord bot?
You need to install NPM (Node Package Manager) first:
https://docs.npmjs.com/downloading-and-installing-node-js-and-npm
then install discord.js by running:
$ npm install discord.js
or
$ npm i discord.js
for short
There are multiple libraries for interacting with the Twitch API, the most popular one being https://npmjs.com/package/@twurple/api which can be installed the same way as you can install discord.js, by just providing the NPM package name
Wait wait
Now it says(when I run dockerd)
@austere surge
failed to start daemon: error while opening volume store metadata database: timeout
Trinity-BOT-alpha\events\messageCreate.js:14
.setColor(client.config.EMBED_THEME_COLOR)
^
ReferenceError: client is not defined```
const config = require("./configuration/config.js");
const emojis = require("./configuration/emojis.js");
client.config = config;
client.emoji = emojis;```
index.js
const config = {
botId: "957958989944062033",
botToken: "bruhhhh",
ownerId: "850938117422448670",
EMBED_THEME_COLOR: "AQUA",
};
module.exports = config;
in ./configuration/config.js
It likely has something to do with the code in \events\messageCreate.js
ayo is a json file saved only till the session ends?
i am working on a vanilla js site and i want to save info on a .json file
is that possible or would i have to use .txt files
no
unless you use replit or heroku, yes
It's said discordapi cannot send empty message, but this what I try to do.
so when i click the like button on mobile it brings up this nasty select of the span block
how do i get rid of this
if you are using discord.js v13 you can use like this "if(!message.member.permissions.has([Permissions.FLAGS.ADMINISTRATOR]))"
aight, lemme try
nope still same, and when i remove if() for permissions, then i get an error undefined "channels"
Try with []
try
if(!message.member.permissions.has([Permissions.FLAGS.ADMINISTRATOR])
Show your code also if you are using discord.js you can use "message.client" for message event
welp that's too long I guess
Show your code
¯\_(ツ)_/¯
tried to send and it got deleted, probably because it's too long
Then use pastebin or something like that
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
trying to reuse old code from previous project
I can't see the content because pastebin is banned in my country lmfao
imagine living in Turkey
Make sure the message is not too big with .length will probably fix this issue
Like args.length
Also you don't need const channel = message.channel
You can use like const { channel } = message;
on which
ok figured out permissions & channels errors...now i need to figure out why does bot not sotring anything to mongo...
lol...command executed, no errors, no response
let bug = args.join(" ")
if (!bug) return message.channel.send("Please provide a bug report")
let bugembed = new Discord.MessageEmbed()
.setTitle("Bug Report")
.setDescription(`${message.author} has sent a bug report`)
.addField("Bug Report", bug)
.setColor("ORANGE")
.setTimestamp()
.setFooter("PhoeniX")
let bugchannel = client.channels.cache.get(config.bugchannel)
if (!bugchannel) return message.channel.send("Bug channel not found")
bugchannel.send(bugembed)
message.channel.send("Bug report sent")
}
}```
for some reason it's still say discordapierror cannot send empty message, despite user send a text after the command.
what Discord.js version
djs 13
.send({embeds: [embed]})
bugchannel.send({ embeds: [bugembed] });
uhh why, the button is there tho
how do I make bot create an invite, I already make one but the bot said it doesn't have perm to create instant invite despite I already invite the bot as administrator
you need to learn how to catch errors properly
for the error to fall in the catch clause, anything async needs to be awaited
and an error can appear in the callback, the callback is not a part of the run function
when I submit a form, I dont want the browser to refresh or redirect.
But I still want to submit the form. Is it possible?
One message removed from a suspended account.
well there's preventDefault on events
I can't find api for chatbot
ik, but than form will not submit
if u find something, plz tell me too.
I tried to sign up for brainapi but it require a domain, even if I use my active one it still not let me to register
IBM Watson
Just dont expect to flip a switch and now your bot is fluent in 60 languages
lol no, I just expect the bot could chat in english language
Exactly
uh I don't know which to choose on their products page
This one
Do note, chat bots require a huge amount of configuration
It isn't a plug 'n play thing
try this
I use this and work decent https://brainshop.ai/
isnt it paid?
max 150 calls
npm ERR! missing script: start
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2022-04-15T16_24_22_329Z-debug.log
exit status 1```
??? theres literally a start script
show your package.json
why typeof null = "object"?
who? what? where? how? when?
plz tell
I tried to make my bot create invite link for a server by giving the server ID, but it said bot don't have permission to create instant invite, despite the perm is administrator
reworking it and now ended up with message.guild.fetchInvites is not a function
"name": "modmail-by-the-brogamer",
"version": "1.0.0",
"description": "",
"main": "index.js",
"dependencies": {
"discord.js": "^13.6.0",
"express": "^4.17.3"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Brogames85-star/modmail-by-the-brogamer.git"
},
"keywords": [],
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/Brogames85-star/modmail-by-the-brogamer/issues"
},
"homepage": "https://github.com/Brogames85-star/modmail-by-the-brogamer#readme"
}```
im using it for a friends server
There isn't any start defined
So use node . to execute the file defined in main
i used node start and npm start
internal/modules/cjs/loader.js:818
throw err;
^
Error: Cannot find module 'node:events'
Require stack:
- /home/runner/modmail-by-the-brogamer/node_modules/discord.js/src/client/BaseClient.js
- /home/runner/modmail-by-the-brogamer/node_modules/discord.js/src/index.js
- /home/runner/modmail-by-the-brogamer/index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
at Function.Module._load (internal/modules/cjs/loader.js:667:27)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/home/runner/modmail-by-the-brogamer/node_modules/discord.js/src/client/BaseClient.js:3:22)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/home/runner/modmail-by-the-brogamer/node_modules/discord.js/src/client/BaseClient.js',
'/home/runner/modmail-by-the-brogamer/node_modules/discord.js/src/index.js',
'/home/runner/modmail-by-the-brogamer/index.js'
]
}
exit status 1```
you didn't make a start script
still a error
that means your node is outdated. update it
how do i do that in repl
I don't know, I don't use replit
Can you show the code?
This is a tutorial of how to change the node version inside your repl. Please check the README.md file.
hey guys can someone help me with this
when i am in mobile devices this shit selected the div
how am i supposed to disable that thing
can someone help me pls
where will i add the start script? which part of package.json
In the scripts field
display: none; for screen sizes small than your choice or generally for touch devices if you prefer that
by using css media queries
"node": "^16.14.2"
},
"scripts": {
"start": "node ."
}
"test": "echo \"Error: no test specified\" && exit 1"```
like that?
I wonder why you don't simply use node .
i want that in touch devices but i dont want the selection of div when i click the like
The test script is supposed to be inside of the scripts field also, which you separated
ye i removed the bracket there
"node": "^16.14.2"
},
"scripts": {
"start": "node ."
"test": "echo \"Error: no test specified\" && exit 1"
}```
You're missing the comma after the first script in the scripts field
Have a look at the documentation/guide I linked
try these ```css
-webkit-tap-highlight-color: transparent;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
i did that ran it said installing npm and then quit
node .
internal/modules/cjs/loader.js:818
throw err;
^
Error: Cannot find module 'node:events'
Require stack:
- /home/runner/modmail-by-the-brogamer/node_modules/discord.js/src/client/BaseClient.js
- /home/runner/modmail-by-the-brogamer/node_modules/discord.js/src/index.js
- /home/runner/modmail-by-the-brogamer/index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
at Function.Module._load (internal/modules/cjs/loader.js:667:27)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/home/runner/modmail-by-the-brogamer/node_modules/discord.js/src/client/BaseClient.js:3:22)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/home/runner/modmail-by-the-brogamer/node_modules/discord.js/src/client/BaseClient.js',
'/home/runner/modmail-by-the-brogamer/node_modules/discord.js/src/index.js',
'/home/runner/modmail-by-the-brogamer/index.js'
]
}
exit status 1```
what did you run?
Incompatible version of discord.js and nodejs. Probably not using Node lts if I was to guess.
thank you so much it worked
what discord version is it supposed to be
You haven't updated Node.js properly in ReplIt, read the guide I showed carefully on how to update
its v13.6.0
and node is v17
Yeah, so your Nodeversion is too low as Voltrex mentioned. Ah touche even have a doc linked
your node version is not v17 if you're still getting that error
im in packages and it says v17
And I recommend using v16 instead of v17 since v17 is not LTS and experimental
packages says 17 and console says v12
whats the command for v16 cuz it doesnt show up in packager only v17 does
Then you've not updated it properly, you should read the guide carefully, it shows how you can do so, it provides a simple script to run on the shell to update it
It's shown in the README.md file
npm init -y && npm i --save-dev node@16 && npm config set prefix=$(pwd)/node_modules/node && export PATH=$(pwd)/node_modules/node/bin:$PATH so i keep the 16 right?
Yeah, follow the steps as outlined, you can also use a Nix template as Tim said but that's up for your choosing
+ node-linux-x64@16.14.2
added 1 package and audited 1 package in 11.695s
found 0 vulnerabilities
+ node@16.14.2
added 1 package from 1 contributor, updated 1 package and audited 74 packages in 20.614s
4 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities```
i ran it did that
i got the script in package.json
And now follow the next steps
They just say run npm start and the script did those and ran it still a error
let es = client.settings.get(message.guild.id, "embed");
let ls = client.settings.get(message.guild.id, "language")
let invite = await message.guild.fetchInvites().then(async invites => {
let invite = invites.find(invite => invite.inviter.id === message.author.id);
if (!invite) {
return message.channel.send(new MessageEmbed()
.setColor("ORANGE")
.setFooter('Powered by PhoeniX\nMade by: Typical Finney#1893', client.user.displayAvatarURL())
.setTitle(client.la[ls].common.noinvite.title)
.setDescription(require(`${process.cwd()}/handlers/functions`).handlemsg(client.la[ls].common.noinvite.description, {prefix: prefix}))
);
}
let embed = new MessageEmbed()
.setColor("ORANGE")
.setFooter('Powered by PhoeniX\nMade by: Typical Finney#1893', client.user.displayAvatarURL())
.setTitle(client.la[ls].common.invite.title)
.setDescription(require(`${process.cwd()}/handlers/functions`).handlemsg(client.la[ls].common.invite.description, {prefix: prefix}))
.addField(client.la[ls].common.invite.invite, invite.url)
.addField(client.la[ls].common.invite.uses, invite.uses)
.addField(client.la[ls].common.invite.maxuses, invite.maxUses)
.addField(client.la[ls].common.invite.maxage, invite.maxAge)
.addField(client.la[ls].common.invite.created, invite.createdAt)
.setFooter(`${client.la[ls].common.invite.footer} ${message.author.tag}`, message.author.displayAvatarURL())
message.channel.send({ embeds: [embed] });
})
}
}```
djs 13 anyways
I don't think you followed the other steps, look at the second step
Ye i have .replit already
do you press the button "run" it usually do the stuff
yes
If you've also followed the third step, I recommend reinstalling the NPM packages you've got that must be built with the newer Node.js versions, after that it should work, if that still doesn't work, then you did something wrong in these steps
If you've double-checked that you've done them correctly, you can use the Nix template instead as Tim mentioned
Nix?
what is the error?
ok opened it do i just take all the code it put it into it?
message.guild.fetchInvites is not a function
<Guild>.invites.fetch()
as i said before, guild.fetchInvites does not exist in v13
so I replace message.guild with those ? alright then
yes
how can i fetch a ban on guildBanAdd event to get reason? audit log scraping sucks ass
Getting the audit logs entries for it is your only option
still an error
its always getting the wrong event
gets the previous event
i followed discord.js guide on it
i thought i could fetch the ban from ID and get reason from there?
show code
Show code maybe?
ok
what error
I’m trying to add images I’ve saved on Imgur to the long description? I’m unsure as to how to use the html format properly
https://haste.churton.uk/ririzatanu.typescript its not typescript ignore hastebin lol
and i insert to db on all modloggable events because it prevents dupilicates
You can edit the extension in the URL
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module 'express'
Require stack:
- /home/runner/Nodejs-16-1/index.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:94:18)
at Object.<anonymous> (/home/runner/Nodejs-16-1/index.js:1:17)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/home/runner/Nodejs-16-1/index.js' ]
}
exit status 1```
npm i express
did you copy your package.json?
The code seems fine in this case, but what exactly do you mean by it returning the wrong event?
it always returns the previous ban's reason and executor
yes and still error
as soon as i hit run it instantly stops
if you did, then run npm i to install everything
throw new TypeError('CLIENT_MISSING_INTENTS');
^
TypeError [CLIENT_MISSING_INTENTS]: Valid intents must be provided for the Client.
at Client._validateOptions (/home/runner/Nodejs-16-1/node_modules/discord.js/src/client/Client.js:548:13)
at new Client (/home/runner/Nodejs-16-1/node_modules/discord.js/src/client/Client.js:76:10)
at Object.<anonymous> (/home/runner/Nodejs-16-1/index.js:12:16)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12)
at node:internal/main/run_main_module:17:47 {
[Symbol(code)]: 'CLIENT_MISSING_INTENTS'
}
exit status 1```
The error is self-explanatory, discord.js v13 now requires you to specify the intents you need, which is also required by the Discord API
read the guide on how to use discord.js v13
thats what i'm thinking
which are
idk what im supposed to look for
lol
All the things in there since you're probably upgrading from v12 to v13, especially the intents section, this is a list of all the intents you could use:
https://discord.js.org/#/docs/discord.js/stable/class/Intents?scrollTo=s-FLAGS
note that the GUILD_MEMBERS and GUILD_PRESENCES intents are privileged and you must request access for them through Discord support if you need them
okkkkkk so
tensorflowjs
won't run on ubuntu 20.04
no flaz
not skill issue
i literally have a windows vps because of this

What's the website for the Discord Experimental Build?
As in canary?
yup
Then you're looking for https://canary.discord.com
Looks the same but it should download the canary version
I think it's this.
Ahh.
are guildIds, messageIds, userIds, etc uuids? can a guildId conflict with a messageId?
Snowflakes are unique
Discord.py:
is there a way to not have my bot double ping when using role.mention without a weird workaround like purge
show code?
async def test(ctx, amount=1):
role = ctx.guild.get_role(964632024453353563)
await ctx.send(role.mention)```
<@{roleID}> doesnt work instead of role.mention?
i tried that already and it did the same thing...
also, could you print role
wdym
print(role)
Ok
ok
👋
(discord.js)
I want to be able to a fetch a user from one of my shards using a broadcastEval, but because the user is being sent back through the broadcast thing, it is no longer of type User, which means .avatarURL() becomes simply .avatarURL. Is there a way to either a) convert this to a true user type or b) have a type definition for this altered object
I just fetch through client
I have Sharding too
Wdym?
client.users.cache.get("user id here");
I have Sharding, and I don’t need to broadcasteval to get user
const user = client.users.cache.get("user id here");
But what if they're not in cache of that shard?
What if they are in the cache of a different shard?
But surely fetch is only give you that user on the shard with the user on it
Which may not necessarily be all of them
the rest api doesnt care about shards
Yeah
fetch works from any shard
you will just end up with duplicated caches, the user will exist in both shards
but thats not an issue
Wait actually
What if I want to get a user from the sharding manager
Surely then I'd need my broadcastevals to get a client
you can fetch from it as well if you want
🤯
Absolutely
wrong chat moment
I use discord.js v12 and I'm having trouble with the code since the bot is saying Leaderboard: Undefine - for some odd reason and I'm pretty sure I did the coding right by doing ${member.position} or either ${leaderboard.position} but for some odd reason it saying " undefine "
const { MessageEmbed } = require("discord.js");
const { Color } = require("../../config.js");
const Eco = require("quick.eco");
const client = new Discord.Client();
client.eco = new Eco.Manager();
client.db = Eco.db;
module.exports = {
name: "profile",
aliases: [],
description: "Get info on user game profile",
usage: ">profile <Mention>",
run: async (client, message, args) => {
let Member = message.mentions.members.first() || message.guild.members.cache.get(`${args[0]}`) || message.guild.members.cache.get(`${message.author.id}`)
let member = message.mentions.users.first() || client.users.cache.get(`${args[0]}`) || client.users.cache.get(`${message.author.id}`)
let userBalance = client.eco.fetchMoney(member.id);
let leaderboard = client.eco.leaderboard({limit: 15, raw: false})
if(!member) {
const embed = new Discord.MessageEmbed()
.setTitle("Please mention a user")
message.channel.send(embed)
}
const embed = new Discord.MessageEmbed()
.setAuthor(`Profile ${member.tag}`, member.displayAvatarURL({dynamic: true, size: 512}))
.setDescription(`
**User:** <@${member.id}>
**ID:** ${member.id}
__**LuckyGame - Info**__
**Level:** Coming soon..
**Rank:** Coming soon..
**Bank:** **${userBalance.amount}**
**Leaderboard:** **${leaderboard.position}** `)
//${client.users.cache.get(member.id).tag}
message.channel.send(embed);
}
}; ```
I have been working on this with @fringe jewel for 3 days and still nothing
Go to the npm's support server :/
not here.
Most people told me to go to devilment :(
Oh.
You shouldn't be creating a new client instance in every command file
You seem to already be passing the client as a parameter, so no need to create a new instance
What? This is literally a development channel
Ok?
I still think it'd be best to go to the actual NPM's support server instead.
it's actually worse
How?
So it'd be best to get support here about npms than the npm we are having an issue with's support server?
Mk..
The D.JS discord server, told me to go to the support server of the NPM I am having trouble with, cause they'd be able to help me better...
djs support and npm support are shitshows
ok so, why are u getting both member and Member?
djs support is 90% redirecting you elsewhere and 99% people that have no idea what they're doing
top.gg's development channel offers Tim
and if you have Tim, you have all the knowledge

tru
One message removed from a suspended account.
One message removed from a suspended account.
They're referring to the said NPM package's support server, not NPM itself
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.

One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
They also declared a variable called member under the Member one
One message removed from a suspended account.
You should maybe take a nap
I am confuse
Im tryna make it so they can see what place there on the leaderboard
or if you want the rank instead and the users are in the same Array, you can use findIndex, .findIndex(u => u.id === author.id)
Gonna hurt ur head a little bit more
member is not actually a Member object but an User
tried to git clone my project so I would do all the update all in one to the main one but I can't install all the package via npm i because I delete those (node modules) on my main package
what's the error
npm err
basically tried to download all the package, then it got deleted
there are a lot of npm err, like visual studio is not installed, cannot find git etc, give the specific error
ah yes "npm err" very specific
I'v a private repo where Iv a .env having sercurity keys.
I want to make this repo public. How do I delete this .env file from repo history
Like it never existed!
how can i make it so i can choose to add a role or remove one instead of both appearing in slash command options?
like
/whitelist role role-a: role and /whitelist role role-r instead of /whitelist role role-a role r
you may want to make a new branch to delete commit history https://medium.com/codex/how-to-delete-your-repository-commit-history-on-github-4f6072936459#:~:text=Typically%2C you should never delete,history without touching the code.
rpc is great
i wanna make my own software customizable ||instead of hardcoded|| rpc client but i suck at ui
~ same 😂
who was the one with the ui one
oh you
😂
thanks. the theme generator is fun to mess with 🙂
yea i really do suck at ui design lol
is the sidebar a profile system?
different activities
hm
i do recall making the sidebar a little thinner ~ guess thats why it was thicker to begin with 😄
What's with the Enabled / Disabled checkboxes?
Used to enable/disable images/buttons
like, you can enable no buttons, and only small image
or no images, 1 button, whatever
But why are there both enabled AND disabled checkboxes?
Shouldn't there be only one enabled checkbox?\
or one disabled checkbox
one for each image, and each button
the disabled box turns enabled when clicked
but yea, i do need to make that more intuitive. had a few folks mention it 😛
ah
@earnest phoenix
Hmm, I'm unsure what exactly you mean by that, but I suppose you only want it to show a single role or something?
yeah
well
i want it separately
like in a normal cmd i can use args and have them function differently but in slash command it's like it's conjoined
idk
@earnest phoenix see how it shows both
i only want like one ig
You can either just set it to have one role as an argument, or make one of them optional
ahh
and how do i do the second option [optional]
wait isn't that just
required: false
or something
Yeah
kk
My bot ia using 80 percent cpu how can i know that why its using too much cpu
Can I use ctrl-key combinations in github actions?
Well I have found a odd issue, no matter what image I upload to my bot the image is extremely low quality and godawfully terribly compressed
💀
Whats the point of this react code?
const callbackRef = useRef(listener)
useEffect(() => {
callbackRef.current = listener
}, [listener])
listener is accepted from props
y shouldnt we use listener directly.
y to save it to ref
from my experience, you can't just set a global variable and render it, you need ref. not the best answer and likely to understand
how can i get the first emoji in a message with discord.js
why not just parse the message content
idk how 
regeks
(:[A-Za-z0-9_]:) is probably wrong
i found a better way
The parameters for the start and end are missing, can't remember rn
split(" ") 
const parsedEmoji = Util.parseEmoji(rawEmoji) works really well
it changes reactive code to non-reactive code. You usually only need it if you need to access a react variable that is not tied to the lifecycle of any component like a game or something
how i can fix this?
Info: Using react and a router libs
Info²: is redirecting to / in a loop
What is the best way to detect username changes?
I'm trying to detect when an account becomes a discord impersonation account 
DIscord.js
Then use <Client>.on("userUpdate", (ou, nu) => {...}): https://discord.js.org/#/docs/discord.js/stable/class/Client
ou stands for old user, while nu stands for new user. Can be any name of course.
and that fires when someone changes their username for example?
Yeah
I thought that was only when someone updates nickname etc 
Nah, that'd be part of guildMemberUpdate
Though if your bot goes offline, for example, you won't receive updates, so that's something to keep in mind.
I'm not sure.
I don't think you need any.
oh
Yep going to
oh, it is in a react hook. What's the benefit of this here.
function useEventListener(eventType, listener, element = window, options = false) {
const callbackRef = useRef(listener)
useEffect(() => {
callbackRef.current = listener
}, [listener])
useEffect(() => {
if (element == null) return
const handler = (e) => callbackRef.current(e)
element.addEventListener(eventType, handler, options)
return () => element.removeEventListener(eventType, handler, options)
}, [eventType, element])
}
oh uhh.. you could probably just use listener directly here
or at least I don't see it at a glance
My bot ia using 80 percent cpu how can i know that why its using too much cpu
by understanding what your bot is doing? 😛
Music
no. i mean.. you need to understand the logic of the code that your bot uses, to be able to identify problem areas ~ such as loops within loops, that could be the cause of the usage
like, how does your bot get the music, does it have to convert the format from something to something else, are you accidentally leaving connections opened that are eating resources in the background ~ etc
its recommended to move to v13
like v12 is outdated now
not too much is different
its message.channel.send({ embeds:[embed] })
Tbh you should have considered using v13 at the start
or you wouldn't have all these issues
yes, just do the request urself
use client.api() or fetch, PATCH to /guilds/:guild_id/members/:member_id with JSON payload that has the communication_disabled_until property (which is a timestamp)
LMFAO
The funny part is that it'll take a lot of work both now and when v12 stops working
The only difference is that the former will be 1 hour across 10 days
While the latter will be 10 hours in 1 day
Upgrading to v14 looks even easier
^ obv, you dont want to rewrite again from v13 to v14
there are a lot of major breaking
I upgraded to v14... the more changes were introduced
I’m gonna upgrade soon
Now I'm too lazy and I'll wait for a release
Something in node is binding to native code that was compiled for the wrong platform from what I can tell
Oh, is there a way to fix it?
Did you copy your node_modules folder from somewhere?
Or did you install them all properly with npm
Kinda, I cloned one of my repositories
Did it clone the node_modules folder as well?
Yes
You should .gitignore node_modules
Delete your node modules folder and just run npm i
It'll install all the packages listed in your package.json
Ok
anyone know if, using the discord game sdk, rpc types are able to be something other than 'playing'?
when using the depreciated rpc, it only allows type 0, and 3 (watching- but for some reason it still shows as playing lol)
i trying send webhook to my guild channel but webhook url returns error "Invalid webhook token" from top.gg
because its not a discord webhook
👌
if config.dynamic_ending_message == True:
if winner == config.username:
await ps_websocket_client.send_message(battle.battle_tag, [config.battle_won_message])
else:
await ps_websocket_client.send_message(battle.battle_tag, [config.battle_lost_message])
else:
await ps_websocket_client.send_message(battle.battle_tag, [config.battle_ending_message])
Any way to shorten this code?
Its python but that should be obvious
checking for True is redundant
You could keep the await ps_websocket_client.send_message(battle.battle_tag, ...) and use ternary or a function call in place of ...
unless python is weird and doesn't follow the conventions of literally every other language on the planet of course
You're correct Waffle
Could assign the message type to a variable depending on the condition and refer to it within send_message
For example,
def battle_message(config, winner):
if config.dynamic_ending_message:
if winner == config.username:
return config.battle_won_message
else:
return config.battle_lost_message
else:
return config.battle_ending_message
await ps_websocket_client.send_message(battle.battle_tag, battle_message(config, winner))
There you go
Or even 
await ps_websocket_client.send_message(battle.battle_tag, [config.battle_ending_message if not config.dynamic_ending_message else config.battle_won_message if winner == config.username else config.battle_ending_message])
Okay excuse my incompetence but is there a clean way I can fetch stuff from a ShardingManager in discordjs
I know I can just make my own requests but at that point there's no point using a lib
So it's there something built into discord.js that I can utilise from the sharding manager
you can create a client
and then do client.token = "token"
and then you can fetch using the client
you dont need to do client.login
I accidentally used this dummy client inside some code on one of my actual shards and as soon as it ran it threw a shard ready timeout error
Clearly the gods do no like me doing this, so I shall not
Just thought it was interesting
Nvm it throws that error randomly even after I removed it so I clearly broke something lmao
@zinc fable
omg
did you post this in the wrong channel by any chance
and lmaoo
So I'm making a Python module, and I'm using Classes
and in the file antifish-py.py, it is ```py
import requests
class antifish:
def init(self, client):
self.client = client
def check_message(self, message):
#do shit here
print("lol")```
ignore the print bit, thats to stop vscode crying
I basically want to (after people import from pypi) to do ```py
from antifish-py import antifish
antifish(client)
antifish.check_message(message)```
would this work?
or would I have to assign py antifish(client) to a variable?
That should work, also a guide on how to package a Python project as a package, additionally as a PyPi package with examples, it might help you on your journey
https://packaging.python.org/en/latest/tutorials/packaging-projects/
ty 
also
what is the best HTTP request library?
I was looking at Requests but I remember someone saying its not the best a while back
For Python?
Yes
From my experience and also from what I've seen, Requests has always been good, it's simple and gets the job done in a simple way, you can also have a look at Grequests, httplib2, and Treq
I know requests well
so I'd probably stick with that
I'm making a simple python module for https://anti-fish.bitflow.dev/
Oh well, good luck on that; here to help if you run into any issues
tyty ❤️
DON'T use requests, it's blocking. use an asynchronous request library, a great one is aiohttp
fun fact, the only dependency of discord.py is aiohttp
Oh yeah aiohttp is awesome as well, completely forgot about it
I mean, as Flazepe said, Requests is blocking (in other words synchronous) which can block other code from running until the current one is finished, if you don't want that then use aiohttp, which is asynchronous
alrighty
is providing the bot client to the module just to put the bot tag inside the user agent header really needed?
I mean
me use repl not VSC but i know whats VSC 
The API requests ```
Headers: Please include a User-Agent header in format Application-Name (Application-Link)!
and the best way to get the correct username is that
i'd say library name and link to its github would be sufficient, instead of the bot's tag which is useless if you don't know the id
Alrighty
and the module shouldn't associate itself with the bot client
is it specifically for discord bots?
Yeah
i see
AFAIK, the API is for Phishing links and IP loggers
that's fine i suppose, guessing you're planning on adding some features that require reference to the client
if u don't, then don't require users to provide a client. that way other applications could also use the library
It is the same API @spare karma uses (Made by the owner)
Alrighty
I'll check with the API owner rq to see what they suggest
all right
they're not rlly fond of pings though
DM is probably fine, idk
side note, if the library was meant for applications other than bots (e.g. console apps), requests would've probably been fine
not probably, but definitely
I pinged them in the API server (quite a small server)
It is only really for Discord bots

don't want to block other stuff from running just because the library is doing some requests
Yep
https://omg-its.blahaj.wtf/jLWcg34J.png Thats what they said regarding libs, just wanted to make sure the useragent field is up o the standards they set :)
so now we wait
aiohttp has websockets?
yeah
cool
they use it along with Asyncio
I'm having trouble with reading a bunch of directories. I have around 2,000 directories (essentially a storage server lol), but Node just seems to freeze around the 1,353'th directory.
async function getNovels(query) {
const commandFiles = fs.readdirSync('../web_server/novels');
let validFiles = [];
for (const folder of commandFiles) {
if (folder.endsWith(".rar")) {
return;
}
const stats = fs.readdirSync(join('../web_server/novels', folder)).filter(file => file.endsWith('.pdf'));
for (const file of stats) {
let folderName = folder;
let path = "/novels" + folderName + "/" + file;
if (!fs.existsSync(join('../web_server/', path))) {
console.log("Issue with path: " + join('../web_server/', path));
} else {
validFiles.push([path, file]);
}
}
console.log("Finished looping through " + folder); // Logs fine, but get's stuck around "O"
console.log(validFiles.length); // Logs fine, but get's stuck at 1353
}
console.log("a"); // Never logged
console.log(validFiles); // Never logged
}
'readdirsync'
with that many files/dirs, you for sure dont want to do it syncronously
Doesn't readdirsync impose a limit at some point?
It would freeze trying to do all those files/folders
It depends on the hardware and the memory of the machine at it's disposal
v- file helper functions from an old project of mine
ic
you can use the getFiles function from that file shown there, to asyncronously get all files in directories recursively
Imagine if Discord was doing everything synchronously 
im sure your use case is different, but hopefully it helps some 🙂
They could
I wouldn't put it past em
that's cursed
i love your pfp
how do you know it freezes on the 1353th?
also why async function if everything is sync lol
woops
be nice if they mentioned you cant upload 80 assets at once 😂
just had to wait a minute. but still...
Are you living under a rock?
By logging the length of validFiles. And whoops I forgot it was async
I have my nextjs app and I want to make an oauth2 system for the users on my site. Now my question is if there is a good library that can help me do this or if I have to build the complete thing by my own?
are you sure its not just stopping at a rar file?
if (folder.endsWith(".rar")) {
return;
}
theres stuff like passportjs or something, idk
Oh wow I completely missed that. Thank you
well yes but that doesn't really make it easier.. but thanks for the help
@quartz kindle So my hdd completely broke :^)
I hv installed react with version 17.
Does it implies latest version of react@17?
surely it said something after u tried running npm publish?
Sa
depends on if your function is async or returns a new Promise via the PromiseConstructor. If you use new Promise((resolve, reject) => … then you just call resolve(true or false)
If your function is async, whenever you return inside your function's scope, the return true or false is what is given to the user. Promises are automatically passed to the user when calling an async function
function func1(link) {
return new Promise(resolve => {
const isLinkScam = getBooleanSomehow(link)
resolve(isLinkScam) // value is expected to be true or false
})
}
async function func2(link) {
const islinkScam = getBooleanSomehow(link)
return isLinkScam
}
const link = "http://totally-not-a.virus.site"
func1(link).then(v => console.log(v)) // will print a boolean
func2(link).then(v => console.log(v)) // will also print a boolean. Since the inner logic of both functions is the same fundamentally, the values each function would theoretically return should be the same assuming no special conditions are met
It doesn't have to be, that's just an example
If you have a node_modules directory in your project, remove it and run npm update --save, and then run npm cache verify
Yes
module.exports = [{ id: 'message', events: [{ name: 'Message Delete', id: 'messageDelete', }, { name: 'Message Update', id: 'messageUpdate', }] }]
How can I put all of the values of events ids in an array?
Basically messageDelete and messageUpdate in an array and so on.
You just map the values
events.map((event) => event.id);
just wait lol
Hmm.. what about the exterior array?
it happens to me as well,you just have to wait lil bit
Since that's what you're working with, what I showed should suffice what you needed, unless the top array has multiple of those with events within them
What exactly are you trying to do?
An array of multiple objects, yes.
it should
And what exactly are you trying to accomplish? That's an input, and now what exact output are you expecting from that?
An array of all the IDs like messageDelete, messageUpdate, etc.
try publishing it via uhh sudo or somethin
Then you can just map all of them and flatten the array
data
.map((eventData) =>
eventData.map((eventData_) =>
eventData_.id
)
)
.flat();
Wait a second, don't tell me you're also publishing the node_modules directory
Can you show me your project files/file structure?
there is just index.js qt
its his users direcotry
OH THATS FUCKIN WHY
ITS TRYING TO PUBLISH THE ENTIRE USER DIRECTORY
My guy, you're publishing your whole user drive
put it onto another dir
Put your project files in a directory, change your directory into the said directory and run npm publish
Are you on Windows, macOS or Linux?
hes on Windows
Oh yeah, I didn't notice the path separators
i mean there is no letter drives on linux 
Now show us the terminal
try cd
cd path\to\your\project\directory
Imagine if they didn't stop the publishing process, using NPM as drive backup
LMAO
all of your personal info
boom
Well don't worry, none of it has been published so you're good
yus
could you send you package.json?
You're trying to publish a private scoped package, which are a paid feature of the NPM registry
Note the @baconkral/
Now you should be able to publish it if there's not a package with the same name
WOOO
Congrats on your first NPM package
Dangerous publishes?
That won't be published, since you cancelled the operation
You don't have to
Once you close the terminal, it'll terminate the publishing process
^
My guy was about to do a full self-doxx
tho you should keep an eye on this:https://monitor.firefox.com/
Including the homework folders
Mine says 3, but those are extremely old breaches
i use priv adresses
Then just add one, it's pretty easy to work with Markdown
for ex 036guvtg@duck.com is for my discord
@earnest phoenix could u send the npm url to me via dms owo
yu
I have tons of breaches because websites can't keep their data secure 🙄
shame on you canva
I used you for 5 minutes to find out you don't do what I want and you repay me like this
Faster way to do this?
const array = [];
modlogs.map(x => x.events.map(y => array.push(y.id)));
console.log(array)
I've figured it out, I've wanted it to return an array.
At this point just do
const arr = [];
for (const x of modlogs)
for (const y of x.events)
arr.push(y.id);
Fair enough.
isn't for of slower than for i
const arr = modLogs.flatMap(x => x.events)
apparently it's not syntactical sugar
it doesn't matter that's never going to be your bottleneck
yeah it doesn't really matter but if I remember correctly it has a huge impact if your data is very small or very big
don't remember which one
did the benchmarks myself also without relying on some website
it definitely does not have a huge impact
huge relative to itself maybe, but not relative to other code in your program
I just published a package to Pypi and it is returning a file not found error even tho the file is definately there https://omg-its.blahaj.wtf/CqSmH4Ep.png
Kinda, but nowadays the iterators are preferred rather than the standard for loop, although we use the standard for loop in our Node.js runtime to avoid mangled iterator symbols, if that wasn't the case we would use iterators still
benchmarking these kinds of things aren't reliable on a blackbox like v8 unless you understand what code interpreter is running
well not that v8 itself is a black box but it does a ton of optimizations on the code you give it and you don't know what exactly you're benchmarking
I'll still prefer the old fashioned for i technique instead of readability because I stick by my benchmarks
node isn't a tensorflow model that outputs different outputs each time 
you're joking but I think the two are comparable
they've done incredible work on the JIT compilation and optimizations
yeah I guess you can get a completely different output with different code as context
I really like it but hate the fact the learning curve is very steep
very very steep
i mean i use it
but on a windows vps
because it doesn't like telling me what the installation error is on ubuntu
I really like this demonstration of why benchmarking without understanding the code that's being run is harmful https://youtu.be/65-RbBwZQdU?t=746
A 2-day not-for-profit by-the-community and for-the-community international conference about the New Worlds of JavaScript. Lisbon, Portugal, October 2-3, 2013
I keep linking this here when someone brings up benchmarking but it's so important lol
I'll check that out
oh yeah I have a shit ton of installation errors with it
i hate installing it lol
you need some mandatory cpu instruction sets, otherwise you'll have to compile from source
oh
one of them is avx
how do i know if mine is compatable
I asked galaxygate to give me a vps with that instruction set enabled and they did
one sec
i have a dedi with Intel(R) Atom(TM) CPU C2750 @ 2.40GHz 8core
Linux or Ubuntu?
ubuntu 20.04
yeah that's the same
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes rdrand lahf_lm 3dnowprefetch cpuid_fault epb pti ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid tsc_adjust smep erms dtherm ida arat md_clear
You need avx, avx2, sse4.1, sse4.2, fma
I think some of them are optional but I know avx is a dead set requirement
you have 3 options
1 ask contabo if they can perhaps let your server get access to these instruction sets (worked with galaxygate for me)
2 recompile tensorflow from source to support your cpu completely (very slow, time consuming and difficult process)
3 run from contabo and try get a vps with those sets
this is on my oneprovider dedi i'm using
or if you're using tfjs you can also not use the binary package
which is slower but works
I think you need to do message=message
not an expert tho idk
self=client, message=message ?
Declare antifish(...) as a variable and refer to it
x = antifish(...) and then x.client
classes require instantiation
when you do x = antifish()
x becomes the class instance, while antifish is still the class itself, not an instance
only instances have access to self
Ah ok
how can I make my bot leave a guild by ID?
discord.js v13
client.guilds.cache.get(id).leave()
how did top.gg make the og color in embeds from their website?
I mean every other embed is gray
top.gg managed it to make the color idk colormatic
you mean this?
general html question
yeah
<meta name="theme-color" content="#FF7E79" />```
not all. it just depends if the site your linking has setup the meta tags (like theme color)
<title><%= page_title %></title>
<meta name="description" content="<%= page_description %>"/>
<meta name="url" content="<%= canonical_path %>"/>
<link rel="canonical" href="<%= canonical_path %>"/>
<!-- Google / Search Engine Tags -->
<meta itemprop="name" content="<%= page_title %>">
<meta itemprop="description" content="<%= page_description %>">
<meta itemprop="image" content="<%= page_image %>">
<!-- Discord / Facebook Meta Tags -->
<meta property="og:type" content="website"/>
<meta property="og:site_name" content="dekitarpg.com"/>
<meta property="og:title" content="<%= page_title %>"/>
<meta property="og:description" content="<%= page_description %>"/>
<meta property="og:image" content="<%= page_image %>"/>
<meta property="og:url" content="<%= canonical_path %>"/>
<!-- Twitter Meta Tags -->
<meta name="twitter:site" content="@dekitarpg">
<meta name="twitter:creator" content="@dekitarpg">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="<%= page_title %>">
<meta name="twitter:description" content="<%= page_description %>">
<meta name="twitter:image" content="<%= page_image %>">
<!-- Various OS Icons- credit: https://realfavicongenerator.net -->
<link rel="apple-touch-icon" sizes="180x180" href="/icons/apple-touch-icon.png?v=1.1">
<link rel="icon" type="image/png" sizes="32x32" href="/icons/favicon-32x32.png?v=1.1">
<link rel="icon" type="image/png" sizes="16x16" href="/icons/favicon-16x16.png?v=1.1">
<link rel="manifest" href="/icons/site.webmanifest?v=1.1">
<link rel="mask-icon" href="/icons/safari-pinned-tab.svg?v=1.1" color="#5bbad5">
<link rel="shortcut icon" href="/icons/favicon.ico?v=1.1">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="msapplication-config" content="/icons/browserconfig.xml?v=1.1">
<meta name="theme-color" content="#328cc1">
^ useful tags for embeds on various sites, and app icon customization for different devices
🤔 how do I make nginx ignore a requests cache control header
I feel like I tried that.
maybe I just have cache misconfigured.
apparently you need to use both proxy_ignore_headers and proxy_hide_header
hey guys, im unable to send a test webhook to my site, and it shows no errors, it worked with postman and a webhook test site
how are you trying to send the test to your site?
via post
im using webhook.site to test the recieved data
however
sending with postman to your site?
yes, that works fine
topgg doesnt even give an error here
or rather my logs dont
it would at least give the auth error you see above if there was no key
sounds like that hook isnt being sent
last time i setup a webhook with top.gg, was like 3 years ago. its probably a bit different now lol
oof
tbh, the interface looks like i remembered other than updated color scheme on the site 😄
your url and auth is set on the topgg site correct?
correct
whats your host?
i didnt wanna ask that 😂
are you using any accented characters in your url/auth? or any special characters
nope
i can share the auth for now since im testing and will change later anyway
UClXqJWQvGjS7WHIgYoy
is it potentially related to the ssl issue?
potentially, ive never seen someone try.
ah
does the webhook need to be sent as https?
nah, http works fine but its not ideal
ofc 😛
https is standard for a reason, but a lot of our users use http.
nubs b nubin... 
yep ssl was the issue
@tight scaffold idk how your infrastructure is setup, but you can use something like 'certbot' to automatically generate/renew ssl certificates for you, something like nginx to act as a reverse proxy (redirecting non https to https, settings ssl keys, etc)
i have a cloudflare cert
that i already use for other sites
i just need to tell asp.net to use it
ahh ok fair enough
Soyoustart seems kinda nice 👀
I recommend OneProvider who is owned by Online.net/Scaleway
And scaleway is epic
didnt you have a ton of complaints about scaleway last year 👀
Oh and I don’t recommend Nocix
Nah scaleway is great
Was a different company
I just can’t remember who 
is there someone experienced with css?
not at all but why
just post your question
Imagine if that was their actual question, like they just wanted to know if someone is experienced with css
💀
lol
i bet if you pet tim carefully he will write css for you
if you pet me with bank notes :^)
When a user logs in to my site how should I like secure him and let him stay logged in?
user -> login -> gets token (saved in cookies) Should I now just let the token expire if it doesn't get used and then he needs to login? Or like every use he gets a new one or how?? any tips welcome
what kind of actions can the user do?
does it fetch stuff from the discord api or only changes settings in your db?
it can CRUD data in my app
but does it need to interact with discord?
no it has nothing to do with discord
or is the oauth2 only for confirming/identifying the user?
it's all my own application
ah i thought this was about discord oauth2
nope
one of the most commonly used methods is to store tokens in your db, which could either never expire or expire like after a month
you can also make it expire after certain amount of inactivity
you're using regular sessions right? or are you using jwts?
yes but currently no jwts
so just do it the normal way
like giving the user a token which grant's him access to the pointing data and like expire it after a certain time of inactivity?
yeah
I mean I have time and possibility to do it with jwts. Should I?
the problem with jwts is that you cant expire them






