#development

1 messages · Page 2022 of 1

simple stump
#

Thank you! Where do I specify that?

#

is it an intent?

lament rock
#

On response create, where you specify your content

simple stump
lament rock
#

idk if it's allowed_mentions for discord.js
check the docs

#

also, it's not a boolean

simple stump
#

oh ic. okay ill check the djs docs. thx for your help!

restive barn
#

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

cinder patio
#

why are you using v12

#

that's gonna break soon

lament rock
#

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

earnest phoenix
restive barn
#

I will switch when it does break

#

Atm just let me learn

lament rock
#

were it so easy in Discord development. I wish Discord would stop updating so fucking fast. I'm overworked as a library dev amandacry

#

You'll be shitting bricks when "1 small thing" takes a long time for a rewrite

restive barn
#

Lol

compact pier
#

why the image is not displaying?

fickle arch
#

createinvite is not a function, what the name for it on djs 13

compact pier
fickle arch
compact pier
#

it is

#

<Channel>.createInvite()

#

sorry

fickle arch
#

I tried that before and it said it's not a function

cinder patio
#

Is the first channel a category? If it is then it won't work

fickle arch
#

gonna bookmark that

fickle arch
fathom sonnet
#

guys, how can I make bot to get mentioned role...ammm Something like message.mentions.channels.first() but jus for roles

sudden geyser
#

Use .roles instead of .channels

fathom sonnet
#

ahh mybe it could work

sudden geyser
#

I don't think roles are ordered in any particular way though, so .first() may not return the actual first role

lament rock
#

ordered by how the gateway returns them

dry imp
worn pasture
#

So

#

I actually need help with an error

austere surge
#

whats wrong

worn pasture
#

Look

#

I'm trying to pull an image

#

Like this

#

docker pull parrotsec/core

#

But then I get this

austere surge
worn pasture
#
Is the docker daemon running?```
austere surge
#

you on a linux system?

worn pasture
#

Yep

#

and after that I tried running dockerd

#

And I got this

austere surge
#

if using systemd you can sudo systemctl start dockerd or just sudo dockerd

worn pasture
#

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

worn pasture
#

Okay

#

And also

#

Here is the logs:

#

Discord ducked me

#

Give me a sec

pale oasis
austere surge
#

why not use unix

worn pasture
#

Anyways here are the logs

worn pasture
austere surge
#

dang

#

try seeing if containerd is a thing you can run

worn pasture
#

I can run it

exotic merlin
#

Ik this really aint devvin but like can someone make me a discord bot that Announces when twitch drops happen

worn pasture
#

@austere surge anything?

#

localhost:~# service docker status

  • status: started
    localhost:~# service containerd status
  • status: started
austere surge
#

whats the pull command saying now

exotic merlin
#

How do i install discord.js and a twitch api

austere surge
#

npm

worn pasture
exotic merlin
#

Anyone wanna make me a discord bot?

earnest phoenix
# exotic merlin How do i install discord.js and a twitch api

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

worn pasture
#

Wait wait

#

Now it says(when I run dockerd)
@austere surge
failed to start daemon: error while opening volume store metadata database: timeout

tulip cradle
#
Trinity-BOT-alpha\events\messageCreate.js:14
        .setColor(client.config.EMBED_THEME_COLOR)
                  ^

ReferenceError: client is not defined```
craggy pine
#

well it says what the problem is.

#

Client isn't defined in client.config.ect.ect

tulip cradle
#
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

craggy pine
#

It likely has something to do with the code in \events\messageCreate.js

slender wagon
#

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

pearl trail
#

unless you use replit or heroku, yes

fickle arch
#

It's said discordapi cannot send empty message, but this what I try to do.

fathom sonnet
#

here

#

can some1 explain me why I getting permissions error

slender wagon
#

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

earnest phoenix
fathom sonnet
#

aight, lemme try

fickle arch
#

on mine use ([ before and after the permissions.flags ])

#

basically the same I guess

fathom sonnet
#

nope still same, and when i remove if() for permissions, then i get an error undefined "channels"

fickle arch
#

try
if(!message.member.permissions.has([Permissions.FLAGS.ADMINISTRATOR])

earnest phoenix
fickle arch
#

welp that's too long I guess

earnest phoenix
#

¯\_(ツ)_/¯

fickle arch
earnest phoenix
#

Then use pastebin or something like that

fickle arch
#

trying to reuse old code from previous project

earnest phoenix
#

imagine living in Turkey

fickle arch
#

lol

#

dunno if this readable

earnest phoenix
#

Like args.length

#

Also you don't need const channel = message.channel

#

You can use like const { channel } = message;

fickle arch
fathom sonnet
#

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

fickle arch
#
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.
fickle arch
#

djs 13

pearl trail
#

.send({embeds: [embed]})

earnest phoenix
fickle arch
#

so now for send embed is like that ?

#

alright then, noted.

compact pier
#

uhh why, the button is there tho

fickle arch
#

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

vivid fulcrum
#

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

rocky hearth
#

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?

sage bobcat
#

One message removed from a suspended account.

sudden geyser
#

well there's preventDefault on events

fickle arch
#

I can't find api for chatbot

rocky hearth
rocky hearth
fickle arch
#

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

lyric mountain
#

Just dont expect to flip a switch and now your bot is fluent in 60 languages

fickle arch
lyric mountain
#

Exactly

fickle arch
#

uh I don't know which to choose on their products page

lyric mountain
#

This one

#

Do note, chat bots require a huge amount of configuration

#

It isn't a plug 'n play thing

fickle arch
#

🤔

#

holy shit this looks more complex than I thought

earnest phoenix
quartz kindle
#

post the full error including the stack trace

#

what is welcomechannel.js line 11?

earnest phoenix
#

there is no such thing here lol

quartz kindle
#

lel

#

thats why reading the full error is important

fickle arch
rocky hearth
fickle arch
#

it's free

#

I just tried

cinder patio
#

max 150 calls

safe harness
#
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
wheat mesa
#

show your package.json

rocky hearth
#

why typeof null = "object"?

quartz kindle
#

who? what? where? how? when?

rocky hearth
#

plz tell

fickle arch
#

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

fickle arch
#

reworking it and now ended up with message.guild.fetchInvites is not a function

quartz kindle
#

v12 or v13?

#

there is no guild.fetchInvites on v13

safe harness
# wheat mesa show your package.json
  "name": "modmail-by-the-brogamer",
  "version": "1.0.0",
  "description": "![](https://img.shields.io/badge/Discord%20Bot-discord.js-9cf)",
  "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

boreal iron
#

So use node . to execute the file defined in main

safe harness
#

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```
wheat mesa
#

you didn't make a start script

safe harness
#

still a error

wheat mesa
safe harness
wheat mesa
#

I don't know, I don't use replit

earnest phoenix
boreal stream
#

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

safe harness
earnest phoenix
boreal iron
#

by using css media queries

safe harness
earnest phoenix
#

Yes

boreal iron
#

I wonder why you don't simply use node .

boreal stream
earnest phoenix
safe harness
#
    "node": "^16.14.2"
  },
  "scripts": {
    "start": "node ."
    "test": "echo \"Error: no test specified\" && exit 1"
  }```
earnest phoenix
#

You're missing the comma after the first script in the scripts field

#

Have a look at the documentation/guide I linked

quartz kindle
safe harness
#

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```
quartz kindle
real rose
boreal stream
safe harness
earnest phoenix
#

You haven't updated Node.js properly in ReplIt, read the guide I showed carefully on how to update

real rose
#

Discord latest which is v13?

#

^^

safe harness
#

its v13.6.0

safe harness
#

and node is v17

real rose
#

Yeah, so your Nodeversion is too low as Voltrex mentioned. Ah touche even have a doc linked

wheat mesa
#

your node version is not v17 if you're still getting that error

safe harness
#

im in packages and it says v17

earnest phoenix
#

And I recommend using v16 instead of v17 since v17 is not LTS and experimental

safe harness
#

packages says 17 and console says v12

#

whats the command for v16 cuz it doesnt show up in packager only v17 does

earnest phoenix
#

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

quartz kindle
#

or just use a nix template

safe harness
#

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?

earnest phoenix
#

Yeah, follow the steps as outlined, you can also use a Nix template as Tim said but that's up for your choosing

safe harness
#
+ 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

earnest phoenix
#

And now follow the next steps

safe harness
#

They just say run npm start and the script did those and ran it still a error

fickle arch
# earnest phoenix Can you show the code?
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
earnest phoenix
safe harness
#

Ye i have .replit already

fickle arch
safe harness
#

yes

earnest phoenix
# safe harness Ye i have .replit already

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

safe harness
#

Nix?

safe harness
fickle arch
earnest phoenix
quartz kindle
fickle arch
spark flint
#

how can i fetch a ban on guildBanAdd event to get reason? audit log scraping sucks ass

earnest phoenix
#

Getting the audit logs entries for it is your only option

safe harness
spark flint
#

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?

quartz kindle
earnest phoenix
spark flint
#

ok

quartz kindle
rich iron
#

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

spark flint
#

and i insert to db on all modloggable events because it prevents dupilicates

earnest phoenix
#

You can edit the extension in the URL

spark flint
#

oh lol

#

i didn't know that

safe harness
# quartz kindle what error
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```
fickle arch
#

npm i express

safe harness
#

ok ran it now waiting

#

now its discord js

quartz kindle
#

did you copy your package.json?

earnest phoenix
spark flint
#

it always returns the previous ban's reason and executor

quartz kindle
#

you can try adding a delay

#

or try fetching the ban: guild.bans.fetch(user)

safe harness
#

as soon as i hit run it instantly stops

quartz kindle
safe harness
#
      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```
earnest phoenix
#

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

quartz kindle
#

read the guide on how to use discord.js v13

spark flint
earnest phoenix
safe harness
#

idk what im supposed to look for

quartz kindle
#

lol

earnest phoenix
#

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

spark flint
#

okkkkkk so

#

tensorflowjs

#

won't run on ubuntu 20.04

#

no flaz

#

not skill issue

#

i literally have a windows vps because of this

feral aspen
#

What's the website for the Discord Experimental Build?

sudden geyser
#

As in canary?

feral aspen
#

No, canary is something else, I think.

#

Ah, it's canary, fair enough.

sick agate
#

yup

sudden geyser
#

Looks the same but it should download the canary version

feral aspen
#

I think it's this.

sudden geyser
#

That's public test build

#

Which is like canary but with less frequent updates

feral aspen
#

Ahh.

proven lantern
#

are guildIds, messageIds, userIds, etc uuids? can a guildId conflict with a messageId?

boreal iron
#

Snowflakes are unique

hot sage
#

Discord.py:
is there a way to not have my bot double ping when using role.mention without a weird workaround like purge

hot sage
#
async def test(ctx, amount=1):
    role = ctx.guild.get_role(964632024453353563)
    await ctx.send(role.mention)```
dry imp
#

<@{roleID}> doesnt work instead of role.mention?

hot sage
dry imp
#

also, could you print role

hot sage
#

wdym

spark flint
#

print(role)

hot sage
#

Ok

dry imp
#

ok

boreal iron
#

👋

true ravine
#

(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

spark flint
#

I have Sharding too

true ravine
#

Wdym?

spark flint
#

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");

true ravine
#

But what if they're not in cache of that shard?

#

What if they are in the cache of a different shard?

spark flint
#

I believe you can .fetch

#

2 secs

true ravine
#

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

spark flint
#

await client.users.fetch(userid)

#

That’s what I use

#

I use both fetch and get

quartz kindle
#

the rest api doesnt care about shards

spark flint
#

Yeah

quartz kindle
#

fetch works from any shard

spark flint
#

What tim said

#

Tim is good at explaining shit yesyesyes

quartz kindle
#

you will just end up with duplicated caches, the user will exist in both shards

#

but thats not an issue

true ravine
#

Bruh so I've been writing loads of broadcastevals for nothing notlikenoot

#

Well thanks guys x

quartz kindle
#

well, techincally broadcast eval is faster and helps with rate limits

#

but yeah

true ravine
#

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

quartz kindle
#

you can fetch from it as well if you want

true ravine
#

Ayo??

#

This is a revelation

quartz kindle
#

you dont need a client to fetch

#

you can fetch with any http lib

true ravine
#

Mind blown

#

Thanks again

split hazel
true ravine
#

Absolutely

sharp saddle
#

wrong chat moment

restive barn
#

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

fringe jewel
#

not here.

restive barn
#

Most people told me to go to devilment :(

fringe jewel
#

Oh.

earnest phoenix
#

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

restive barn
#

Oh

#

We will try to do that!

#

Ty

wheat mesa
fringe jewel
#

I still think it'd be best to go to the actual NPM's support server instead.

fringe jewel
#

How?

lyric mountain
#

npm support server would be way too offtopic

#

at least here we deal with bots

fringe jewel
#

So it'd be best to get support here about npms than the npm we are having an issue with's support server?

#

Mk..

lyric mountain
#

the question is about d.js tho

#

not a npm question

fringe jewel
#

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...

wheat mesa
#

djs support and npm support are shitshows

lyric mountain
wheat mesa
#

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

boreal iron
dry imp
#

tru

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

earnest phoenix
#

They're referring to the said NPM package's support server, not NPM itself

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

earnest phoenix
sage bobcat
#

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.

earnest phoenix
#

They also declared a variable called member under the Member one

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

You should maybe take a nap

restive barn
#

I am confuse

#

Im tryna make it so they can see what place there on the leaderboard

pearl trail
#

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)

lyric mountain
#

member is not actually a Member object but an User

fickle arch
#

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

pearl trail
#

what's the error

fickle arch
#

npm err
basically tried to download all the package, then it got deleted

pearl trail
#

AMgabbruh there are a lot of npm err, like visual studio is not installed, cannot find git etc, give the specific error

wheat mesa
#

ah yes "npm err" very specific

fickle arch
#

Eh hold on

#

it doesn't allow me to install the node modules required.

rocky hearth
#

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!

plucky imp
#

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

neat ingot
#

I'm honestly having way too much fun with rpc these days 😂

austere surge
#

rpc is great

#

i wanna make my own software customizable ||instead of hardcoded|| rpc client but i suck at ui

neat ingot
#

~ same 😂

austere surge
#

who was the one with the ui one

neat ingot
austere surge
#

oh you

neat ingot
#

😂

austere surge
#

that does look very good

#

not the best, but much better than i can do

neat ingot
#

thanks. the theme generator is fun to mess with 🙂

#

yea i really do suck at ui design lol

austere surge
#

is the sidebar a profile system?

neat ingot
#

different activities

austere surge
#

yeah

#

if theres enough profiles can you scroll down on the sidebar

neat ingot
#

yup

#

hmm, seems i have an overflow-x issue

#

that didnt used to be there 😄

austere surge
#

hm

neat ingot
#

i do recall making the sidebar a little thinner ~ guess thats why it was thicker to begin with 😄

cinder patio
#

What's with the Enabled / Disabled checkboxes?

neat ingot
#

Used to enable/disable images/buttons

#

like, you can enable no buttons, and only small image

#

or no images, 1 button, whatever

cinder patio
#

But why are there both enabled AND disabled checkboxes?

#

Shouldn't there be only one enabled checkbox?\

#

or one disabled checkbox

neat ingot
#

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 😛

cinder patio
#

ah

plucky imp
earnest phoenix
plucky imp
#

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

earnest phoenix
plucky imp
#

ahh

#

and how do i do the second option [optional]

#

wait isn't that just

#

required: false

#

or something

earnest phoenix
#

Yeah

plucky imp
#

kk

bright thorn
#

My bot ia using 80 percent cpu how can i know that why its using too much cpu

opaque seal
#

Can I use ctrl-key combinations in github actions?

novel snow
#

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

#

💀

quartz kindle
#

make it the exact size

#

not bigger

rocky hearth
#

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

pearl trail
#

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

spark flint
#

how can i get the first emoji in a message with discord.js

pale vessel
#

why not just parse the message content

spark flint
#

idk how OMG

pale vessel
#

regeks

rustic nova
#

(:[A-Za-z0-9_]:) is probably wrong

spark flint
#

i found a better way

rustic nova
#

The parameters for the start and end are missing, can't remember rn

rustic nova
spark flint
#

const parsedEmoji = Util.parseEmoji(rawEmoji) works really well

sudden geyser
#

discord.js provides a regex

#

yeah that

spark flint
#

was making an emoji stealer for my server kek

#

i didn't want to add carlbot so

woeful pike
sharp saddle
#

how i can fix this?

Info: Using react and a router libs

#

Info²: is redirecting to / in a loop

spark flint
#

What is the best way to detect username changes?

#

I'm trying to detect when an account becomes a discord impersonation account Hehe

sudden geyser
#

What library are you using?

#

Discord does have the USER_UPDATE event.

spark flint
#

DIscord.js

sudden geyser
#

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.

spark flint
#

and that fires when someone changes their username for example?

sudden geyser
#

Yeah

spark flint
#

I thought that was only when someone updates nickname etc OMG

sudden geyser
#

Nah, that'd be part of guildMemberUpdate

spark flint
#

ohhhh

#

and what intents do i need for that?

sudden geyser
#

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.

spark flint
#

I'll test with what I have atm

#

might have to request presence intents if not

sudden geyser
#

I don't think you need any.

spark flint
#

oh

sudden geyser
#

Or maybe just GUILD_MEMBERS

#

could experiment

spark flint
#

Yep going to

rocky hearth
# woeful pike it changes reactive code to non-reactive code. You usually only need it if you n...

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])
}

woeful pike
#

oh uhh.. you could probably just use listener directly here

#

or at least I don't see it at a glance

bright thorn
#

My bot ia using 80 percent cpu how can i know that why its using too much cpu

neat ingot
#

by understanding what your bot is doing? 😛

bright thorn
#

Music

neat ingot
#

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

pale vessel
#

what discord.js version are u running?

#

it needs to be v13+ as far as i know

spark flint
#

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

pale vessel
#

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)

pearl trail
#

LMFAO

lyric mountain
#

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

old cliff
#

Upgrading to v14 looks even easier

pearl trail
#

^ obv, you dont want to rewrite again from v13 to v14

#

there are a lot of major breaking

old cliff
#

I upgraded to v14... the more changes were introduced

spark flint
#

I’m gonna upgrade soon

old cliff
#

Now I'm too lazy and I'll wait for a release

stable eagle
#

What does this error mean?

wheat mesa
#

Something in node is binding to native code that was compiled for the wrong platform from what I can tell

stable eagle
#

Oh, is there a way to fix it?

wheat mesa
#

Did you copy your node_modules folder from somewhere?

#

Or did you install them all properly with npm

stable eagle
wheat mesa
#

Did it clone the node_modules folder as well?

stable eagle
#

Yes

wheat mesa
#

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

stable eagle
#

Ok

neat ingot
#

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)

wanton finch
#

i trying send webhook to my guild channel but webhook url returns error "Invalid webhook token" from top.gg

earnest phoenix
wanton finch
marble juniper
#
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

wheat mesa
#

checking for True is redundant

sudden geyser
#

You could keep the await ps_websocket_client.send_message(battle.battle_tag, ...) and use ternary or a function call in place of ...

wheat mesa
slender thistle
#

You're correct Waffle

marble juniper
#

lol

#

I don't usually code in python so no idea

slender thistle
sudden geyser
#

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))
marble juniper
#

spoon feed me daddy

#

jk

slender thistle
#

There you go

sudden geyser
#

Or even OzenSmile

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])
slender thistle
#

Just

#

No

#

Negative

#

Unacceptable

spark flint
#

I'm doing .then and .catch on my Axios request, but none of them log anything

true ravine
#

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

quartz kindle
#

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

true ravine
#

That's big brain

#

Thank you

true ravine
#

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

plucky imp
#


@zinc fable

austere surge
#

omg

zinc fable
#

and lmaoo

plucky imp
#

OH

#

BruH i told this was memes and media pls ignore everyone else

spark flint
#

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?

earnest phoenix
spark flint
#

ty iara2_heart

#

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

earnest phoenix
#

For Python?

spark flint
#

Yes

earnest phoenix
#

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

spark flint
#

I know requests well

#

so I'd probably stick with that

earnest phoenix
#

Oh well, good luck on that; here to help if you run into any issues

spark flint
#

tyty ❤️

pale vessel
spark flint
#

I looked into that

#

wasn't sure

pale vessel
#

fun fact, the only dependency of discord.py is aiohttp

earnest phoenix
#

Oh yeah aiohttp is awesome as well, completely forgot about it

spark flint
#

this is my very basic code

#

is it worth rewriting to use Aiohttp?

earnest phoenix
#

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

spark flint
#

alrighty

pale vessel
spark flint
#

I mean

magic vapor
#

me use repl not VSC but i know whats VSC weirdsip

spark flint
#

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

pale vessel
#

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

spark flint
#

Alrighty

pale vessel
#

and the module shouldn't associate itself with the bot client

#

is it specifically for discord bots?

spark flint
#

Yeah

pale vessel
#

i see

spark flint
#

AFAIK, the API is for Phishing links and IP loggers

pale vessel
#

that's fine i suppose, guessing you're planning on adding some features that require reference to the client

spark flint
#

Not sure yet

#

At the moment it is just meant to simplify how people use the API

pale vessel
#

if u don't, then don't require users to provide a client. that way other applications could also use the library

spark flint
#

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

pale vessel
#

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

spark flint
#

I pinged them in the API server (quite a small server)

#

It is only really for Discord bots

pale vessel
#

icic

#

then it should be async

spark flint
pale vessel
#

don't want to block other stuff from running just because the library is doing some requests

spark flint
#

Yep

#

so now we wait

quartz kindle
pale vessel
#

yeah

quartz kindle
#

cool

pale vessel
#

they use it along with Asyncio

simple stump
#

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
}
neat ingot
#

'readdirsync'

#

with that many files/dirs, you for sure dont want to do it syncronously

sharp geyser
#

Doesn't readdirsync impose a limit at some point?

#

It would freeze trying to do all those files/folders

earnest phoenix
#

It depends on the hardware and the memory of the machine at it's disposal

neat ingot
sharp geyser
#

ic

neat ingot
#

you can use the getFiles function from that file shown there, to asyncronously get all files in directories recursively

earnest phoenix
#

Imagine if Discord was doing everything synchronously troll

neat ingot
#

im sure your use case is different, but hopefully it helps some 🙂

sharp geyser
#

I wouldn't put it past em

rigid jacinth
quartz kindle
#

also why async function if everything is sync lol

neat ingot
#

be nice if they mentioned you cant upload 80 assets at once 😂

#

just had to wait a minute. but still...

old cliff
#

Are you living under a rock?

simple stump
raw nest
#

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?

quartz kindle
#
        if (folder.endsWith(".rar")) {
            return;
        }
quartz kindle
simple stump
raw nest
sharp geyser
#

@quartz kindle So my hdd completely broke :^)

rocky hearth
#

I hv installed react with version 17.
Does it implies latest version of react@17?

pale vessel
#

surely it said something after u tried running npm publish?

sacred dagger
#

Sa

lament rock
#

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
earnest phoenix
#

It doesn't have to be, that's just an example

earnest phoenix
#

If you have a node_modules directory in your project, remove it and run npm update --save, and then run npm cache verify

#

Yes

feral aspen
#
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.

earnest phoenix
royal herald
#

just wait lol

feral aspen
#

Hmm.. what about the exterior array?

royal herald
#

it happens to me as well,you just have to wait lil bit

earnest phoenix
#

What exactly are you trying to do?

feral aspen
royal herald
#

it should

earnest phoenix
# feral aspen

And what exactly are you trying to accomplish? That's an input, and now what exact output are you expecting from that?

feral aspen
#

An array of all the IDs like messageDelete, messageUpdate, etc.

royal herald
#

try publishing it via uhh sudo or somethin

earnest phoenix
#

Wait a second, don't tell me you're also publishing the node_modules directory

royal herald
#

💀

#

could i see your .gitignore file

#

.........

earnest phoenix
#

Can you show me your project files/file structure?

royal herald
earnest phoenix
#

Doesn't seem to be

#

Hmm, are those the only files in your SAMSUNG directory?

royal herald
#

its his users direcotry

#

OH THATS FUCKIN WHY

#

ITS TRYING TO PUBLISH THE ENTIRE USER DIRECTORY

earnest phoenix
#

My guy, you're publishing your whole user drive

royal herald
#

put it onto another dir

earnest phoenix
#

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?

royal herald
#

hes on Windows

earnest phoenix
#

Oh yeah, I didn't notice the path separators

royal herald
#

i mean there is no letter drives on linux KEKW

earnest phoenix
#

Show us your terminal

#

Stop the publishing process first

#

Ctrl+C

royal herald
#

via ctrl c-

#

or meta + c

earnest phoenix
#

Now show us the terminal

royal herald
#

try cd

earnest phoenix
#

cd path\to\your\project\directory

royal herald
#

^

#

to the directory yes

#

cloud you ls

#

use ls

#

oki good

#

your good to publish

earnest phoenix
#

Imagine if they didn't stop the publishing process, using NPM as drive backup

royal herald
#

all of your personal info

#

boom

earnest phoenix
#

Well don't worry, none of it has been published so you're good

royal herald
#

could you send you package.json?

earnest phoenix
#

You're trying to publish a private scoped package, which are a paid feature of the NPM registry

#

Note the @baconkral/

royal herald
#

eaisierç

#

dostum ç yi unutmuşssun

earnest phoenix
#

Nope

#

You don't need a scope

spark flint
#

remove the @baconkral and it will not be a private scoped package

#

ezpz

royal herald
#

^

#

yus

#

remove @baconkral/

earnest phoenix
#

Now you should be able to publish it if there's not a package with the same name

royal herald
#

WOOO

earnest phoenix
#

Congrats on your first NPM package

royal herald
#

congrats 🎉

#

dangeorus publishes?

earnest phoenix
#

Dangerous publishes?

#

That won't be published, since you cancelled the operation

#

You don't have to

royal herald
earnest phoenix
#

Once you close the terminal, it'll terminate the publishing process

royal herald
#

^

earnest phoenix
#

My guy was about to do a full self-doxx

royal herald
earnest phoenix
#

Including the homework folders

royal herald
#

good ^^

earnest phoenix
#

Mine says 3, but those are extremely old breaches

royal herald
earnest phoenix
#

Then just add one, it's pretty easy to work with Markdown

royal herald
#

@earnest phoenix could u send the npm url to me via dms owo

#

yu

split hazel
#

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

feral aspen
#

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.

earnest phoenix
feral aspen
#

Fair enough.

split hazel
woeful pike
#
const arr = modLogs.flatMap(x => x.events)
split hazel
#

apparently it's not syntactical sugar

woeful pike
#

oh wait you need the id

#
const arr = modLogs.flatMap(x => x.events.map(y => y.id) )
woeful pike
split hazel
#

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

woeful pike
#

it definitely does not have a huge impact

#

huge relative to itself maybe, but not relative to other code in your program

spark flint
earnest phoenix
# split hazel isn't for of slower than for i

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

woeful pike
#

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

split hazel
#

I'll still prefer the old fashioned for i technique instead of readability because I stick by my benchmarks

split hazel
woeful pike
#

you're joking but I think the two are comparable

spark flint
#

i hate tensorflowjs

#

probably unrelated but i hate it with a passion

woeful pike
#

they've done incredible work on the JIT compilation and optimizations

split hazel
#

yeah I guess you can get a completely different output with different code as context

split hazel
#

very very steep

spark flint
#

i mean i use it

#

but on a windows vps

#

because it doesn't like telling me what the installation error is on ubuntu

woeful pike
#

I keep linking this here when someone brings up benchmarking but it's so important lol

split hazel
#

I'll check that out

split hazel
spark flint
#

i hate installing it lol

split hazel
#

you need some mandatory cpu instruction sets, otherwise you'll have to compile from source

spark flint
#

oh

split hazel
#

one of them is avx

spark flint
#

how do i know if mine is compatable

split hazel
#

I asked galaxygate to give me a vps with that instruction set enabled and they did

#

one sec

spark flint
#

i have a dedi with Intel(R) Atom(TM) CPU C2750 @ 2.40GHz 8core

split hazel
#

Linux or Ubuntu?

spark flint
#

ubuntu 20.04

split hazel
#

what a stupid question

#

meant to say windows

spark flint
#

lol

#

i'm using a separate windows vps from contabo with it on

split hazel
#

run this cat /proc/cpuinfo

#

and send the output of the Features line

spark flint
#

i only see flags

#

not features

split hazel
#

yeah that's the same

spark flint
#

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

split hazel
#

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

spark flint
#

yeah

#

well uh

#

how do i get that

split hazel
#

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

spark flint
#

this is on my oneprovider dedi i'm using

split hazel
#

or if you're using tfjs you can also not use the binary package

#

which is slower but works

split hazel
#

not an expert tho idk

spark flint
#

Ah

#

I’ll try that

split hazel
#

self=client, message=message ?

spark flint
slender thistle
#

x = antifish(...) and then x.client

spark flint
#

Alrighty

#

There’s no way to do it as I have atm?

quartz kindle
#

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

spark flint
#

Ah ok

stiff lynx
#

how can I make my bot leave a guild by ID?

discord.js v13

quartz kindle
#

client.guilds.cache.get(id).leave()

gusty forge
#

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

quartz kindle
#

you mean this?

gusty forge
#

general html question

quartz kindle
gusty forge
#

yeah

quartz kindle
gusty forge
#

ok

#

thx

sharp saddle
#
<meta name="theme-color" content="#FF7E79" />```
neat ingot
#
    <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

solemn latch
#

🤔 how do I make nginx ignore a requests cache control header

neat ingot
#

could always just overwrite it

solemn latch
neat ingot
#

apparently you need to use both proxy_ignore_headers and proxy_hide_header

tight scaffold
#

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

neat ingot
#

how are you trying to send the test to your site?

tight scaffold
#

im using webhook.site to test the recieved data

#

however

neat ingot
#

sending with postman to your site?

tight scaffold
#

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

neat ingot
#

sounds like that hook isnt being sent

tight scaffold
#

yeah

#

postman connects just fine

neat ingot
#

last time i setup a webhook with top.gg, was like 3 years ago. its probably a bit different now lol

tight scaffold
#

oof

neat ingot
#

tbh, the interface looks like i remembered other than updated color scheme on the site 😄

solemn latch
tight scaffold
#

correct

solemn latch
#

whats your host?

neat ingot
#

i didnt wanna ask that 😂

tight scaffold
#

soyoustart, my host is not the issue as postman works

#

soyoustart/ovh

solemn latch
#

are you using any accented characters in your url/auth? or any special characters

tight scaffold
#

nope

#

i can share the auth for now since im testing and will change later anyway

#

UClXqJWQvGjS7WHIgYoy

solemn latch
#

is it potentially related to the ssl issue?

tight scaffold
#

it could be Thonking

#

does topgg not send a webhook if it returns an ssl error?

solemn latch
#

potentially, ive never seen someone try.

tight scaffold
#

ah

neat ingot
#

does the webhook need to be sent as https?

solemn latch
#

nah, http works fine but its not ideal

neat ingot
#

ofc 😛

solemn latch
#

https is standard for a reason, but a lot of our users use http.

neat ingot
#

nubs b nubin... KEKW

tight scaffold
#

yep ssl was the issue

neat ingot
#

@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)

tight scaffold
#

i need to figure out how to specify a ssl cert in asp.net

tight scaffold
#

that i already use for other sites

#

i just need to tell asp.net to use it

neat ingot
#

ahh ok fair enough

solemn latch
#

Soyoustart seems kinda nice 👀

tight scaffold
#

it is

#

gazelle recently switched to it from my recommendation

spark flint
#

And scaleway is epic

solemn latch
#

didnt you have a ton of complaints about scaleway last year 👀

spark flint
#

Oh and I don’t recommend Nocix

spark flint
#

Was a different company

#

I just can’t remember who KEKW

vocal trellis
#

is there someone experienced with css?

pale vessel
#

not at all but why

quartz kindle
#

just post your question

hybrid cargo
#

Imagine if that was their actual question, like they just wanted to know if someone is experienced with css

#

💀

spark flint
#

lol

split hazel
#

i bet if you pet tim carefully he will write css for you

quartz kindle
hybrid cargo
#

dank memer player alert

raw nest
#

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

quartz kindle
#

what kind of actions can the user do?

#

does it fetch stuff from the discord api or only changes settings in your db?

raw nest
#

it can CRUD data in my app

quartz kindle
#

but does it need to interact with discord?

raw nest
#

no it has nothing to do with discord

quartz kindle
#

or is the oauth2 only for confirming/identifying the user?

raw nest
#

it's all my own application

quartz kindle
#

ah i thought this was about discord oauth2

raw nest
#

nope

quartz kindle
#

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?

raw nest
quartz kindle
#

so just do it the normal way

raw nest
#

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?

quartz kindle
#

yeah

raw nest
#

I mean I have time and possibility to do it with jwts. Should I?

quartz kindle
#

the problem with jwts is that you cant expire them