#development

1 messages · Page 39 of 1

earnest phoenix
#

The good ol' strings to the rescue

sharp geyser
#

idk how slow but its apparently slow enough to mention

earnest phoenix
#

Then strings are definitely the better option, I mean do you really need to store them as integers instead of just strings in your Rust structs as well?

sharp geyser
#

I mean there is no real benefit to it tbh

#

I could 100% go with using strings in my rust structs as well

earnest phoenix
#

Then that would be better, because no conversion would be needed after storing them as strings in PostgreSQL

sharp geyser
#

indeed

#

sorry for earlier btw voltrex

earnest phoenix
#

It's alright Misty

sharp geyser
#

been super stressed lately

#

work and school

#

😔

earnest phoenix
#

I understand, been there; stress does a lot of fucked up shit to people

sharp geyser
#

yea

#

learning a new programming language also stressful asf too :^)

#

Rust hurts my brain sometimes

#

had issues with a linker error for 2 hours and some obscure repo for the package solved it

earnest phoenix
#

Learning how to deal with Rust's borrow checker is just true pain

sharp geyser
#

fucking linker error was the issue

earnest phoenix
#

Damn

sharp geyser
#

diesel_cli required something from the postgres binaries called libpq.dll and libpq.lib to function

#

so I had to install the entire postgresql server thing and then add those to path and then get cargo to check those places

earnest phoenix
#

Also apparently Rust's type system is Turing-complete, you can literally implement a Turing-complete esolang inside Rust's type system alone

#

Like holy shit wtf

sharp geyser
#

I am nub

#

Also, for saving messages sent in a channel for a chat app. Should I even make a relation between the two tables

#

or should I just make a simple reference of the sender_id being the user who sent it

#

sender_id, message_id, channel_id

earnest phoenix
#

A reference is probably the better option

sharp geyser
#

Mmm yea

#
-- Your SQL goes here
CREATE TABLE IF NOT EXISTS users (
    id SERIAL PRIMARY KEY,
    user_id TEXT,
    email TEXT,
    avatar TEXT,
    username TEXT,
    password TEXT
)

this seems good enough to begin with 😎

#

I have yet to decide everything a user will have so basic stuff good enough yes yes

earnest phoenix
#

Wait so are you making an actual chat app?

#

If so is it like related to Discord or completely separate?

sharp geyser
#

So far I am enjoying the development of it (despite a few issues)

earnest phoenix
#

Glad that you're enjoying it at least

boreal iron
#

oof all text my gosh, you’re crazy

sharp geyser
#

I haven't written actual sql in so long

#

so I forgot the datatypes

#

so if there is something better lmk

uneven heath
#

Is there any way for me to send an interaction reply from an user message rather than a slash command interaction?

civic scroll
#

can't

#

as the name suggest, interaction reply requires an interaction to reply to
apparently user message is not one of that

uneven heath
#

smh -_-

green kestrel
#

I'm thinking of creating a D++ botjam. it would be like a gamejam but with bots instead of games.

just can't decide on a "topic". any ideas?

#

someone else wanted to just call it a Hackathon but that's more nebulous and kind of says people hack on the lib project not bots

sharp geyser
#

see who can make the best game bot with D++

green kestrel
#

hmm, interesting

sharp geyser
#

you made it sound like a gamejam so

green kestrel
#

yeah it kind of is like a gamejam

sharp geyser
#

Just see who can make the best game bot in D++

green kestrel
#

this may lure in game developers experienced in C++

sharp geyser
#

Indeed

#

but discord puts a limit on what you can do

radiant kraken
sharp geyser
#

so its still a nice little challenge to come up with an idea and use it

green kestrel
#

but if I do it then it's likely other libs may do so too

radiant kraken
#

true

green kestrel
#

just c++ and game dev fit well together

sharp geyser
#

indeed it does

radiant kraken
#

it'll be better to just make a normal discord bot game jam instead

#

instead of making it specific to a lib

green kestrel
#

not from my perspective lol

sharp geyser
#

I mean, is there any other decent C++ lib for discord

green kestrel
#

we would just end up with 5000 Py/js bots and I can't judge those

sharp geyser
#

the point is to draw more traffic towards D++ for those C++ devs

#

by the sounds of it anyway

green kestrel
radiant kraken
green kestrel
#

that is c only

sharp geyser
#

C

green kestrel
#

and doesn't support lots of modern stuff

sharp geyser
#

So someone actually made a lib in C

#

poor them

green kestrel
#

yes

radiant kraken
#

true

green kestrel
#

it's a fork of orca

sharp geyser
#

async exists in C? I thought it was only a pipe dream

radiant kraken
#

no

#

only threads

sharp geyser
#

gotcha

green kestrel
#

async is purely an interpreted thing

radiant kraken
#

async is just a thread wrapper

sharp geyser
#

using that lib looks like a chore in itself

radiant kraken
#

exactly

sharp geyser
#

who'd even wanna use it

green kestrel
#

D++ operates on a strict thread model, sleepy discord wtf does that even do, DiscordCoreAPI and Discord++ use a thread pool

radiant kraken
#

i dont see why people would make a discord library in C

sharp geyser
#

Didn't you say you would at one point

green kestrel
#

and as for orca and cogmasters iirc it's an event driven polling

#

no threads

radiant kraken
#

sounds hell

green kestrel
#

it doesn't even shard

radiant kraken
#

bruh

#

what about concord

green kestrel
#

sleepy discord does shard but one shard per process

#

concord sorry mixed that up and called it cogmasters

radiant kraken
#

LMAO

#

cogmasters sounds like a good discord library name

earnest phoenix
#

Sounds like a game name

radiant kraken
#

tbh i cant imagine async without threads

green kestrel
#

node doesn't actually use real threads

radiant kraken
#

i mean in low level

green kestrel
#

it's an event driven cooperative task system

#

it's doable at a low level too, one of my previous projects was an IRC server, could host 80,000 concurrent clients on one thread

#

fully non blocking

#

but you do have to be careful

#

in D++ we are constantly un teaching the concept of over use of wait_for

#

like discord is event driven you don't send a message and wait for input

radiant kraken
#

interesting

green kestrel
#

soon becomes not scalable as all these wait states and promises stack up internally

#

modern C++ does have coroutines

#

coroutines are like js async

radiant kraken
#

do they use threads under the hood

green kestrel
#

auto s = co_await bot.co_user_get(snowflake); // blocks but doesn't, async

#

this is experimental in dpp

#

the lib has to implement the async portion

radiant kraken
#

that looks so cursed

green kestrel
#

in dpp it goes to the REST queue like a promise

radiant kraken
#

what does the co_await macro do

eternal osprey
#

Hey, does anyone know how i could scrape the first displayed product on this site?

green kestrel
#

it pushes the state of the current execution onto the stack and calls the function then resumes it later when the called function co_returns

#

so basically behaves exactly like js await with an async function

eternal osprey
radiant kraken
#

C++ has evolved a lot in years

#

since when was this a thing

#

C++20? C++23?

green kestrel
#

this is c++20

sick agate
#

ooh

earnest phoenix
radiant kraken
earnest phoenix
#

Long URL moment

radiant kraken
civic scroll
#

tfw using $ as a varible

#

also that code can be optimised

radiant kraken
earnest phoenix
radiant kraken
#

ah so URl it is

#

thanks voltrex

earnest phoenix
#

What they've sent is a URL, and example of a URI is \⚱️isbn:0-284-56889-3

radiant kraken
#

no

#

it's a URl

earnest phoenix
#

What makes it a URI do you think?

radiant kraken
#

because you've just said so

earnest phoenix
#

I didn't? Did you even read what I sent?

radiant kraken
#

yes i did

civic scroll
#

to coincise this let's call it URl

radiant kraken
#

it's URl

civic scroll
#

L lowercased

radiant kraken
#

you've just explained the joke

#

good job

civic scroll
#

isn't it a locator

#

i'm confused

earnest phoenix
#

I don't think anybody would really get that joke, because I and l looks almost the exact same to the humans, good job

radiant kraken
#

no it's doesn't

#

they are different

earnest phoenix
#

The lowercase L (l) only looks a little taller than an uppercase i (I)

radiant kraken
#

exactly

earnest phoenix
#

And the human brain does not consider that while reading

civic scroll
#

cooperate ask you to find the difference between those pictures

earnest phoenix
#

It's like trying to spot a needle in a haystack, as you're reading through many words

civic scroll
#

no tense

#

calm down guys

earnest phoenix
#

Yeah because you're overly focused over picking those up, almost nobody focuses on reading that much to nitpick those

earnest phoenix
green kestrel
#

I would have chosen await too but maybe they thought people would assume wrongly about it

topaz bloom
#

can someone help me size my logo for my discord server

earnest phoenix
#

How do I make if someone voted for the bot, the bot sends it a private message?

boreal iron
#

You listen to the webhooks topgg can send you then take the user ID to do whatever you like to do

#

But randomly sending private messages isn’t the best idea anyways

#

Pinging somebody in your server after checking if he’s actually a member of it might be a better idea

earnest phoenix
#

Ok

earnest phoenix
#

should i have this as a oauth2 invite permission thing? or does it do it automatically?

bright thorn
#

umm

#

when slash command is in getFocused();

#

and nothing is selected

rustic nova
#

choice 6 has an empty name

bright thorn
solemn latch
#

Don't choices still need a name?

#

The value can be empty, but not the name I think.

earnest phoenix
#

@solemn latch

#

How do I make if someone voted for the bot, the bot sends it a private message?

#

what permissions would my createpoll command have to use?

#

How do I make if someone voted for the bot, the bot sends it a private message?

picture costume :

solemn latch
#

youll need to have webhooks setup

earnest phoenix
#

My bot is hosted by Repilit

#

@solemn latch

solemn latch
#

did you fill in your bot id?

earnest phoenix
#

where

solemn latch
#

:your-bot-id

graceful trench
#

one question

#

like this

boreal iron
#

Using HTML and CSS in the bot description

#

That seems to be an iframe

graceful trench
#

I tried

#

iframes dont work

#

for me

#

I was trying

ancient nova
graceful trench
#

it´s

ancient nova
#

top.gg will show a blank page if your website isn't secure

graceful trench
#

I know

#

that´s isn´t happening

#

the thing is

boreal iron
#

What’s the result when you say it doesn’t work?

graceful trench
#

that iframes replace all webiste

graceful trench
#

<iframe src="your domain" style="position:fixed; top:0px; left:0px; bottom:0px; right:0px; width:100%; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;"></iframe>

#

I use that iframe

#

something to change?

boreal iron
#

Dude

graceful trench
#

src

boreal iron
#

Position fixed top, left, bottom 0

#

smh

graceful trench
#

I delete it

#

no?

last tapir
#

hi how can i make a promise function that has an argument cause im having difficulties with that

boreal iron
#

That will place your iFrame on top of everything taking the entire screen

graceful trench
#

Ik

#

so

#

I change it

boreal iron
#

To what?

graceful trench
#

wait 2 secs

#

<iframe src="yourdomain"></iframe>

#

like that

boreal iron
#

You need to choose a relative position which takes the parent (content description box) as reference

graceful trench
#

only?

boreal iron
#

At least this will not cover the entire site

#

Gimme one second

#

If I can find something

graceful trench
#

do you have the positions of each border

#

?

#

if yes, pls send me to me

boreal iron
#

Well nope can’t find it on mobile sorry

#

Maybe you can

graceful trench
#

i´m searching

#

thnks

#

bro

boreal iron
#

Search for something by me, search for: "position: relative"

#

Should have iframe as selector

graceful trench
#

wait

#

I think i find the solution

#
<style>
  #iframe-website
  {
    border: 0;
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    height: 400px;
    max-height: 400px;
    position: relative;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: auto;
    z-index: 1;
  }
</style>

<iframe id="iframe-website" src="website"></iframe>```
#

this?

#

ready

#

tnks

boreal iron
#

Yes

graceful trench
#

question

boreal iron
#

Dunno why searching on mobile hasn’t the same results like on web

graceful trench
#

height: for 1080 is 1080

#

no?

boreal iron
#

No no

#

You don’t wanna extend the content further than needed

graceful trench
#

ready

lyric mountain
#

W-why did u set min width to 100%?

boreal iron
#

Because the mobile version of topgg will fuck it up

lyric mountain
#

Just set the width itself

boreal iron
#

Because topgg will fuck everything up

#

You can change the height like you want to of course, but the iframe extending the site height is just eww

graceful trench
#

I put 800px for height

#

that was what

#

i was wanting

boreal iron
#

Just play around with it a bit

graceful trench
#

thanks bro

boreal iron
#

Np

graceful trench
#

okno

boreal iron
#

No

#

No

#

No

graceful trench
#

i know

#

well, bye

#

tnks

boreal iron
hasty mulch
#

How can I edit this in d.py 1.7.3 to add another line of text?

lyric mountain
hasty mulch
lyric mountain
#

the same way u sent that message to begin with

#

it's virtually the same code, except for the edit part

hasty mulch
#

But, I don't have the object

lyric mountain
#

how did u sent that message?

hasty mulch
#

Ctx.send

lyric mountain
#

to edit it u just need to fetch the message

#

or use the onReaction event

hasty mulch
lyric mountain
#

no

hasty mulch
#

Huh?

lyric mountain
#

idk the exact code for d.py, but all u need is to retrieve the message

#

ctx.channel will get u the channel not the message

wheat mesa
#

Copy the message ID from discord, fetch said ID, then edit the message

hasty mulch
lyric mountain
#

yes

hasty mulch
#

K

green kestrel
#

ooo trivia ping

feral aspen
#
app.post('/search-word', async (req, res) => {
    const word = req.body.word;

    const results = await search(word);

    for (let result of results) {
        for (let index of result) {
            res.send(index);
        };
    };

    res.send(results);
});
Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
#

So, I have 0 idea what this means. It's also coming from res.send(index);.

quartz kindle
#

you cant use res.send() more than once

feral aspen
#

Oh.

#

I have a question, so let's say result in the code of for (let result of results) console.log(result); returns:

[
  Row {
    word: '(N.) Meow',
    definition: 'The characteristic crying sound of a cat.',
    synonym: 'Cry',
    antonym: 'No Antonyms',
    derivatives: 'No Derivatives',
    examples: 'With a meow the brown kitten jumped down.',
    translation: 'مواء'
  },
  'You can check out the pronunciation of the word at here:\n' +
    'https://audio.oxforddictionaries.com/en/mp3/meow__us_1.mp3 (American English)\n' +
    '-----\n'
]

How can I loop through the properties and make it return something like:

word: (N.) Meow
definition: The characteristic crying sound of a cat.

.. and etc.
#

Since you said .send() can't be used more than once, and I'm lost on how I can return the above in like html or text format.

quartz kindle
#

you want to return text?

#

or a json object?

feral aspen
#

Text.

#

Or HTML, any is fine.

quartz kindle
#

then just build a string

#
let text = "";
for(...) {
  text += something
  text += "\n"
}
send(text)
feral aspen
#

OH.

#

Wait, how is it that I retrieve the property and the value in an object, again?
Figured it out, Object.keys() and Object.values().

earnest phoenix
feral aspen
#

Oh, yup, and that.

#

With a for loop. 👍

quartz kindle
#

why not?

feral aspen
#

I'm not sure.

#
app.post('/search-word', async (req, res) => {
    const word = req.body.word;

    const results = await search(word);

    let output = "";

    for (let result of results) {
        for (const [key, value] of Object.entries(result[0])) {
            output += `${capitalise(key)}: ${value}`;
            output += "\n"
        };
    };

    res.send(output);
});
#

Did I do something wrong here?

quartz kindle
#

what is the output?

feral aspen
#

All in one line.

#

OH, wait.

#

The source code shows it in multiple line but the website browser doesn't.

quartz kindle
#

for browsers it should be <br> instead of \n

feral aspen
#

Lemme try.

#

Oh, yes. Now it works.

quasi depot
#
client.on("ready", () => {
    client.user.setPresence({
        activities: [{ 
          name: "my code",
          type: "WATCHING"
        }],
        status: "idle"
    })
})
``` Trying to implement this code into this code. 

```js
const { prefix } = require("../../config.js");
const { Activity } = require("discord.js");

module.exports ={
name: "ready",
run: async (client) => {
    client.manager.init(client.user.id);
    client.logger.log(`${client.user.username} online!`, "ready");
    client.logger.log(`Ready on ${client.guilds.cache.size} servers, for a total of ${client.guilds.cache.reduce((a, g) => a + g.memberCount, 0)} users`, "ready");

    //Game
    let statuses = ['/help', `Prefix ${prefix}`];
    setInterval(function() {
          let status = statuses[Math.floor(Math.random()*statuses.length)];
          client.user.setActivity(status, {type: Activity.Playing});
      }, 10000)
 }
}
quartz kindle
quasi depot
#

Changed the status but no activity.

#

also no errors.

#
const { prefix } = require("../../config.js");
const { Activity } = require("discord.js");

module.exports ={
name: "ready",
run: async (client) => {
    client.manager.init(client.user.id);
    client.logger.log(`${client.user.username} online!`, "ready");
    client.logger.log(`Ready on ${client.guilds.cache.size} servers, for a total of ${client.guilds.cache.reduce((a, g) => a + g.memberCount, 0)} users`, "ready");

    //Game
    let statuses = ['/help', `Prefix ${prefix}`];
    setInterval(function() {
          let status = statuses[Math.floor(Math.random()*statuses.length)];
          client.user.setPresence({
            activities: [{ 
              name: "Rutr Runs",
              type: "WATCHING"
            }],
            status: "idle"
        })
      }, 10000)
 }
}
quartz kindle
#

whats your djs version?

quasi depot
#

14

earnest phoenix
#

You need to use the enum for the type option, strings for such fields are no longer supported

#

Such as Activity.Watching

quartz kindle
#

or "Watching" instead of "WATCHING"

#

or 3

earnest phoenix
#

Strings are generally just not supported, so changing it won't do anything

quasi depot
#
const { prefix } = require("../../config.js");
const { Activity } = require("discord.js");

module.exports ={
name: "ready",
run: async (client) => {
    client.manager.init(client.user.id);
    client.logger.log(`${client.user.username} online!`, "ready");
    client.logger.log(`Ready on ${client.guilds.cache.size} servers, for a total of ${client.guilds.cache.reduce((a, g) => a + g.memberCount, 0)} users`, "ready");

    //Game
    let statuses = ['/help', `Prefix ${prefix}`];
    setInterval(function() {
          let status = statuses[Math.floor(Math.random()*statuses.length)];
          client.user.setActivity(status, {type: Activity.Playing});
      }, 10000)
 }
}
earnest phoenix
#

Also discord.js docs are apparently having a stroke

quasi depot
#

it was like that, Me changing the playing to watching or anything else doesn't work

ancient nova
#

not quite sure if that's the case for you, though

quartz kindle
quasi depot
#
const { prefix } = require("../../config.js");
const { Activity } = require("discord.js");

module.exports ={
name: "ready",
run: async (client) => {
    client.manager.init(client.user.id);
    client.logger.log(`${client.user.username} online!`, "ready");
    client.logger.log(`Ready on ${client.guilds.cache.size} servers, for a total of ${client.guilds.cache.reduce((a, g) => a + g.memberCount, 0)} users`, "ready");

    //Game
    let statuses = ['/help', `Prefix ${prefix}`];
    setInterval(function() {
          let status = statuses[Math.floor(Math.random()*statuses.length)];
          client.user.setPresence({ activities: [{ name: 'test' }], status: 'idle' });
      })
 }
}
ancient nova
quartz kindle
#

under the hood they are the same

#

but presence lets you set both activty and status

#

activity only sets activity

#

and status only sets status

quasi depot
#

that seem to work, But yet to get the bot to change it status like dnd, online.

earnest phoenix
quartz kindle
#

what do you want to set it to?

ancient nova
earnest phoenix
#

You'll get ratelimited if you're not careful

quartz kindle
#

ye you cant remove this

quasi depot
#
const { prefix } = require("../../config.js");
const { Activity } = require("discord.js");

module.exports ={
name: "ready",
run: async (client) => {
    client.manager.init(client.user.id);
    client.logger.log(`${client.user.username} online!`, "ready");
    client.logger.log(`Ready on ${client.guilds.cache.size} servers, for a total of ${client.guilds.cache.reduce((a, g) => a + g.memberCount, 0)} users`, "ready");

    //Game
    let statuses = ['/help', `Prefix ${prefix}`];
    setInterval(function() {
          let status = statuses[Math.floor(Math.random()*statuses.length)];
          client.user.setPresence({ activities: [{ name: 'Rutr Runs' }], status: 'dnd' });
      }, 1000)
 }
}
earnest phoenix
#

Setting the presence every second will also get you ratelimited

quartz kindle
#

yeah 1000 is bad lol

quasi depot
#

forgot to add another 0

#

well now its online but still can;t find a way to change that, as well has the activity Watching, Streaming and such

earnest phoenix
#

Other than that you can put objects into the statuses array and define the activity and status to use it in the setPresence() method randomly

quartz kindle
#

for type you can use the numbers instead

#

so type: 3 for watching

quasi depot
#

there is no type...

quartz kindle
#

?

quasi depot
#

oh wait

quartz kindle
#

name: 'Rutr Runs', type: 3

quasi depot
#

type is status nv

quartz kindle
#

no status is status (online, idle, dnd, etcc)

ancient nova
#

: o

quartz kindle
#

custom statuses

#

bots cant use it

quasi depot
#

nope, Still is set to playing.

ancient nova
#

they hating on bots

quartz kindle
quasi depot
#
const { prefix } = require("../../config.js");
const { Activity } = require("discord.js");

module.exports ={
name: "ready",
run: async (client) => {
    client.manager.init(client.user.id);
    client.logger.log(`${client.user.username} online!`, "ready");
    client.logger.log(`Ready on ${client.guilds.cache.size} servers, for a total of ${client.guilds.cache.reduce((a, g) => a + g.memberCount, 0)} users`, "ready");

    //Game
    let statuses = ['/help', `Prefix ${prefix}`];
    setInterval(function() {
          let status = statuses[Math.floor(Math.random()*statuses.length)];
          client.user.setPresence({ activities: [{ name: 'Rutr Runs' }], status: '3' });
      }, 10000)
 }
}
quartz kindle
#

i told you

#

status is status

#

online/ide/etc

earnest phoenix
#

For example

// Declare the statuses.
const statuses = [
  {
    activity: 'Foo',
    status: 'online',
    type: Activity.Playing
  },
  {
    activity: 'Bar',
    status: 'idle',
    type: Activity.Watching
  }
];

...

// Get random status.
const status = statuses[Math.floor(Math.random() * statuses.length)];

// Set the presence.
client.user.setPresence({
  activities: [
    {
      name: status.activity,
      type: status.type
    }
  ],
  status: status.status
});
quartz kindle
#

type is not status

#

type is activity type

quasi depot
#

I already told you, Status isnt working.

quartz kindle
#

what do you want to set it to?

quasi depot
#

dnd

ancient nova
#

does anyone have any feature ideas or game ideas or program ideas or any ideas at all?

ancient nova
quartz kindle
#

"dnd" should work then

quasi depot
#
const { prefix } = require("../../config.js");
const { Activity } = require("discord.js");

module.exports ={
name: "ready",
run: async (client) => {
    client.manager.init(client.user.id);
    client.logger.log(`${client.user.username} online!`, "ready");
    client.logger.log(`Ready on ${client.guilds.cache.size} servers, for a total of ${client.guilds.cache.reduce((a, g) => a + g.memberCount, 0)} users`, "ready");

    //Game
    let statuses = ['/help', `Prefix ${prefix}`];
    setInterval(function() {
          let status = statuses[Math.floor(Math.random()*statuses.length)];
          client.user.setPresence({ activities: [{ name: 'Rutr Runs' }], status: 'dnd' });
      }, 10000)
 }
}
quartz kindle
#

that should work for do not disturb

earnest phoenix
quasi depot
wheat mesa
#

Also please don’t set your presence every 10 seconds

earnest phoenix
#

Declare the statuses outside the interval, get a random status in the interval, and set them as presence

quartz kindle
#

also, discord statuses randomly dont work

#

i've seen that happen many times

earnest phoenix
#

IIRC setting the status has some kind of time limit to it, an unusually long one

quasi depot
#

Alright, It changed to dnd, after a long time.

quartz kindle
#

yeah

earnest phoenix
#

Unsure if that's even intentional, maybe Discord haven't noticed it

wheat mesa
#

Might I suggest changing your timeout to something more like 1-2 minutes per status, discord generally doesn’t like requests deemed as unnecessarily spammy

#

Plus every 10 seconds is excessive anyways

#

People are barely going to have enough time to read each status lol

quasi depot
#

It doesn't repeat.

#

the first part of the code doesn't work.

earnest phoenix
#

"first part"?

quasi depot
earnest phoenix
#

That's because you're setting the presence to something constant, you aren't even using the random status you're getting

#

For example

// Get random status.
const status = statuses[Math.floor(Math.random() * statuses.length)];

// Set it as presence.
client.user.setPresence({
  activities: [
    {
      name: status
    }
  ],
  status: 'dnd'
});
quasi depot
#

I would remove that code, But too lazy to re edit the code

quartz kindle
#

name: status instead of name: 'Rutr Runs'

quasi depot
#

?

#
client.user.setPresence({
  activities: [
    {
      name: status
    }
  ],
  status: 'dnd'
  type: 'watching'
});
fallen holly
#

i'm trying to send a message to my alt account but it's not sending

#

do i need to turn on a setting ?

quasi depot
#

sending as of?

quartz kindle
#

....

#

dude

#

type: 'watching' doesnt work

#

it has to be type: 3

ancient nova
quartz kindle
#

and type has to be INSIDE the activity

#

together with name

ancient nova
#

is it users or members

#

members for sure

fallen holly
quartz kindle
#

you have to send before the kick

quasi depot
fallen holly
quasi depot
#
const { prefix } = require("../../config.js");
const { Activity } = require("discord.js");

module.exports ={
name: "ready",
run: async (client) => {
    client.manager.init(client.user.id);
    client.logger.log(`${client.user.username} online!`, "ready");
    client.logger.log(`Ready on ${client.guilds.cache.size} servers, for a total of ${client.guilds.cache.reduce((a, g) => a + g.memberCount, 0)} users`, "ready");

    setInterval(function() {
          client.user.setPresence({ activities: [{ name: 'Rutr Runs', type: 3 }], status: 'dnd'});
      }, 10000)
 }
}
#

is there a need for interval?, Status isnt repeated?

sudden geyser
#

the interval is pretty useless in that context

#

since it's not actually changing

quartz kindle
#

if you removed the changing statuses then yeah you can remove the interval

quasi depot
#
const { prefix } = require("../../config.js");
const { Activity } = require("discord.js");

module.exports ={
name: "ready",
run: async (client) => {
    client.manager.init(client.user.id);
    client.logger.log(`${client.user.username} online!`, "ready");
    client.logger.log(`Ready on ${client.guilds.cache.size} servers, for a total of ${client.guilds.cache.reduce((a, g) => a + g.memberCount, 0)} users`, "ready");
    client.user.setPresence({ activities: [{ name: 'Rutr Runs', type: 3 }], status: 'dnd'});
 }
}

Final code.

quartz kindle
#

you can also remove the async since youre not awaiting anything, otherwise looks good

ancient nova
sudden geyser
#

I don't remember if or why it does.

ancient nova
#

me neither, but I have to have an interval otherwise my status will disappear

sudden geyser
#

If it's the case, the interval should still be higher (say, a day).

ancient nova
#

it disappears once every couple hours

quartz kindle
#

the status can disappear during disconnects and reconnects

ancient nova
#

I set my interval to 6 hours if I remember correctly

quartz kindle
#

to fix that you can set the status in the client

#

so its sent with every login

sudden geyser
#

So on the connect event

ancient nova
#

you can do that?

quartz kindle
#

you set it in the client options

#

when you create tje client

ancient nova
ancient nova
quartz kindle
#

it wont autoupdate tho

#

if you want to update it you still need the interval

ancient nova
#

so I can do both

#

that way I can remove the interval

quartz kindle
#

do it on shardReady then

#

tuen yoi dont need client nor interval

earnest phoenix
#

tuen yoi

ancient nova
quartz kindle
earnest phoenix
#

Ben ten

quartz kindle
#

aka ben dez/deis (in portuguese)

ancient nova
#

anyone know how to remove the pink highlght on functions with VSC? really annoying

#

(), {} and [] is pink

sudden geyser
#

You mean the rainbow coloring?

ancient nova
sudden geyser
#

Check if this setting does it

ancient nova
#

an example

sudden geyser
#

If you want all the brackets (i.e. (), {}, and []) to not differ in color, then yes, disabling the option will do.

wheat mesa
#

Pretty sure that’s your theme

ancient nova
sudden geyser
#

Since VSC added built-in rainbow brackets

wheat mesa
#

Also ew why are you using VSC for C# 🤮

ancient nova
ancient nova
wheat mesa
#

VSC is terrible for C#, pretty much any C# user I’ve ever talked to has said that

#

VS and Rider are the ultimate C# IDEs

ancient nova
#

that's the biggest cap I've ever heard

quasi depot
#

Need a little help.

const {
  EmbedBuilder,
  version,
  CommandInteraction,
  Client,
} = require("discord.js");
const moment = require("moment");
require("moment-duration-format");
const os = require("os");
const si = require("systeminformation");

module.exports = {
  name: "status",
  description: "Displays bot status.",
  run: async (client, interaction) => {
    await interaction.deferReply({
      ephemeral: false,
    });

    const duration1 = moment
      .duration(interaction.client.uptime)
      .format(" d [days], h [hrs], m [mins], s [secs]");
    const cpu = await si.cpu();
    const about = interaction.client.emoji.about;
    let guildsCounts = await client.shard.fetchClientValues(
      "guilds.cache.size"
    );
    let userCounts = await client.shard.fetchClientValues("users.cache.size");

    const embed = new EmbedBuilder()
      .setColor("#ff5500")
      .setThumbnail(interaction.client.user.displayAvatarURL())
      .setDescription(`${about} **Status**
                **= STATISTICS =**
                **• Servers** : ${guildsCounts.reduce(
                  (x, count) => x + count,
                  0
                )}
                  **• Users** : ${userCounts.reduce((x, count) => x + count, 0)}
                **• Discord.js** : v${version}
                **• Node** : ${process.version}
                **= SYSTEM =**
                **• Platfrom** : ${os.type}
                **• Uptime** : ${duration1}
                **• CPU** :
                > **• Cores** : ${cpu.cores}
                > **• Model** : ${os.cpus()[0].model} 
                > **• Speed** : ${os.cpus()[0].speed} MHz
                **• MEMORY** :
                > **• Total Memory** : ${(os.totalmem() / 1024 / 1024).toFixed(
                  2
                )}mb
                > **• Free Memory** : ${(os.freemem() / 1024 / 1024).toFixed(
                  2
                )}mb
                > **• Heap Total** : ${(
                  process.memoryUsage().heapTotal /
                  1024 /
                  1024
                ).toFixed(2)}mb
                > **• Heap Usage** : ${(
                  process.memoryUsage().heapUsed /
                  1024 /
                  1024
                ).toFixed(2)}mb
            `);
    interaction.followUp({ embeds: [embed] });
  },
};
TypeError: Cannot read properties of null (reading 'fetchClientValues')
    at Object.run (C:\Users\rudei\lavamusic-2\src\slashCommands\Information\status.js:25:43)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.run (C:\Users\rudei\lavamusic-2\src\events\Client\interactionCreate.js:88:17)
``` Error.
ancient nova
#

it's their fault if they don't have an indentator or intelisense

wheat mesa
#

Doing any sort of debugging work with VSC and C# is dogshit

earnest phoenix
wheat mesa
#

That’s why VS and Rider are easily objectively superior for C#

ancient nova
earnest phoenix
#

Sharding is also only required if your bot has reached 2,500 servers

quasi depot
#

remove the line of code?

ancient nova
#

what is the best theme for VSC?

ancient nova
wheat mesa
#

One dark pro with Intellij Mono font

sudden geyser
earnest phoenix
ancient nova
ancient nova
#

actually nvm I used the dark version of gruvbox

sudden geyser
#

If you use regular Gruvbox and don't make it dark, yes it does.

pale vessel
#

Dracula Soft with Fira Code

wheat mesa
ancient nova
#

whenever I work with unity and VSC I make sure to pair them, any errors are found in realtime and show up in the console

quartz kindle
#

he means an actual debugger with breakpoints and all that crap

wheat mesa
#

^^

sudden geyser
#

real debuggers are too complicated

#

console.log will always be bae

wheat mesa
#

Debugging is really easy with Rider

#

Just set a breakpoint and inspect everything

#

Super simple

quasi depot
quartz kindle
#

a real debugger can pause your code on specific points and let you inspect the value of each variable then execute the code step by step pausing on every line and let you analyze your code while its running

earnest phoenix
quartz kindle
#

with that said, i also dont use debuggers

ancient nova
#

wot the helllll

quartz kindle
#

:^)

wheat mesa
#

While I appreciate the value of using console.log for quick things, when you encounter a real problem it’s a lot easier to just set breakpoints

sudden geyser
quartz kindle
wheat mesa
#

I find that knowing how to debug is a valuable skill

#

I didn’t like it at first either

quasi depot
#

that was dumb to ask

#

thanks.

wheat mesa
#

But after I got the hang of it, it’s a godsend

ancient nova
#

gruvbox pale looks nice

#

didn't even have to change anything

wheat mesa
#

Especially when you need to know the value of lots of things

sudden geyser
#

If your program is so complex you need a debugger to debug it I'd look at simplifying it.

wheat mesa
#

Sometimes there can be many problems

earnest phoenix
#

Ahem, debugging Node.js and LLVM internals

wheat mesa
#

I’ve encountered a lot of things I needed to use a debugger for with recursive descent parsing, there’s a lot of moving parts that rely on each other in that scenario

ancient nova
#

is my c# syntax better than my js syntax?

quasi depot
#
**• Servers** : ${guildsCounts.reduce(
                  (x, count) => x + count,


TypeError: guildsCounts.reduce is not a function
    at Object.run (C:\Users\rudei\lavamusic-2\src\slashCommands\Information\status.js:34:48)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.run (C:\Users\rudei\lavamusic-2\src\events\Client\interactionCreate.js:88:17)
earnest phoenix
wheat mesa
sudden geyser
#

oh this isn't about gruvbox anymore

#

sad

ancient nova
wheat mesa
#

Curly brackets have their own newline

ancient nova
#

oh that

#

I actually hate that it's the default format lmfao

wheat mesa
#

And it’s usually suggested to let the compiler infer types by using var

ancient nova
#

first thing I turned off in my custom indentator

quasi depot
ancient nova
#

is this bad?

wheat mesa
#

Not at all

#

Though I dislike typing out the entire type for things so I usually like using var instead

earnest phoenix
ancient nova
#

which is pretty weird

quasi depot
#

better

ancient nova
#

never had issues with typing out the type

earnest phoenix
wheat mesa
#

I don’t like it because it makes you import the namespace that the type resides in

quasi depot
#

forgot

earnest phoenix
#

Type inferring is a really good thing to use in languages like C#

wheat mesa
#

Type inference is goated for statically typed languages

#

Can’t change my mind

earnest phoenix
#

Especially in languages like Rust

wheat mesa
#

Yeah

#

Rust has really advanced type inference in my experience

wheat mesa
#

Whenever I make a vector without specifying the type, I can add something to it a long time later and it’ll infer the type of the vector based on what I’ve added to it

earnest phoenix
#

Also Waffle, did you know that Rust's type system is Turing-complete?

ancient nova
wheat mesa
#

I wouldn’t doubt it

lyric mountain
ancient nova
#

I had so much trouble with that if statement

lyric mountain
#

tf did I miss??

wheat mesa
lyric mountain
#

ah, unity ai

ancient nova
earnest phoenix
wheat mesa
#

Lmfao

#

Rust has a truly amazing type system

ancient nova
#

anyways.. I had trouble with that if statement

#

I had to make tons of conditions because it would keep playing sounds non stop

wheat mesa
#

Btw, that’s just a small set of conditions that cause an output, that’s not an AI

ancient nova
wheat mesa
#

I’m sure depending on your definition you could call it that but not really what I’ve got in mind when you say AI

earnest phoenix
# ancient nova

Isn't that the backrooms game you wanted me to test out a while ago?

ancient nova
#

what else would call it if it isn't

wheat mesa
ancient nova
#

there is way more into it

earnest phoenix
#

Man that shit was the laggiest thing I've ever ran in a PC

ancient nova
#

weren't you the one who used Wine?

earnest phoenix
#

Wine can handle way more than what you think of, it can handle the heaviest games known to date

#

So it's not an issue with Wine

ancient nova
#

no, it runs fine on my PC, and the dude who used Wine like a couple months ago send me screenshots of how incredibly messed up the game looked

wheat mesa
#

It might possibly be an issue relating to lack of skill

ancient nova
#

I can show you a gameplay video of the game if you want

wheat mesa
#

Somewhat of a “skill issue” if I may

earnest phoenix
#

It's just a skill issue

ancient nova
#

what's your PC specs

wheat mesa
#

Of a major variety

ancient nova
#

mine are medium at best and it runs smooth

earnest phoenix
#

Good enough to run a heavy game at a smooth rate

#

So not a specs issues nor Wine

eternal osprey
#

Hey will editing 2 embeds each 10s give me a ratelimit?

wheat mesa
#

No but I wouldn’t recommend doing it continuously

earnest phoenix
#

@ancient nova you can also give me a copy of your game to test again if you want, but later since I'm not at my PC

ancient nova
fallen holly
#

if i'm making a website for my bot does it have to be in the same folder as my bot or i can do it separate

ancient nova
#

found a picture of the level I never finished

#

it was hard making it procedurally generate without models being stuck to each other

earnest phoenix
ancient nova
boreal iron
#

Bae doing something else than weird code?

ancient nova
#

omg I found the screenshot

#

alright I feel motivated

#

I'll start working on the game

ancient nova
#

:]

tribal crow
#

Hey, may i ask why i get an error saying "rcard1.replace is not a function"?

#

here is the code

ancient nova
#

you can try doing .toString() before doing .replace

tribal crow
#

isnt it tho?

ancient nova
#

no idea, javascript is weird

#

to make sure they're strings you can also log both of these variables

tribal crow
#

"TypeError: "Cards:" is not a function"

#

"Cards:" is a part of the embed

#

ah ik why

ancient nova
tribal crow
#

ik

boreal iron
#

You may wanna think about what you’ve done

#

card1 and 2 are both numbers

#

Not a string

tribal crow
#

ik

#

rcard1 and 2 are supposed to be strings

ancient nova
tribal crow
#

card1n and 2n are supposed to be numbers

boreal iron
#

You know? Then why do try to call replace on numbers?

ancient nova
#

lol

tribal crow
boreal iron
#

card1 and 2 are just numbers not a random item if your array

#

What it should be I guess

#

What is card1 and 2 supposed to be and what card1n and 2n?

deft rock
#

how can I make a command for say server-info an global command? (Discord.js V14)

tribal crow
boreal iron
tribal crow
#

card1n and card2n are supposed to be the value that the cards has

ancient nova
#

opening this for the first time in 3 months

boreal iron
tribal crow
#

i did

#

and that works

#

but

#

my problem is

boreal iron
#

Calling that already returns the value

tribal crow
#

when i log rcard1 and rcard2 it gives me ![2card](https://cdn.discordapp.com/emojis/938817112523304981.webp?size=128 "2card"), but when using the same variables in an embed i only get :2card:

boreal iron
#

Does the bot even have access to your custom emojis?

tribal crow
#

uhm

#

no

#

that may be a problem

#

silly me

boreal iron
#

iirc bots can’t use emojis they don’t have access to

tribal crow
#

lovely

#

ty

ancient nova
#

does this look good?

#

I'm going to try adding story to this update, I think everything I wanted to do is already finished besides improving the generation script a bit to generate random structurures

tribal crow
#

could sets work as a "temporary" database?

#

like instead of saving every game of blackjack in a database could i instead make a new set?

ancient nova
#

and add to it

tribal crow
#

ik

ancient nova
#

unless u need to store money score or other stuff like that use a database

#

because collection resets or reboot

#

I know a good database if u want to try it

tribal crow
#

all i need to save is the cards the users have, the bet they put and what cards the dealer has

#
  • guild and user id
ancient nova
#

yeah I would probably use a DB for that

tribal crow
#

nvm

lyric mountain
lyric mountain
hasty mulch
boreal iron
#

Means the message you referring to doesn’t exist (anymore)

hasty mulch
#

Error changed to :x: | AttributeError: 'str' object has no attribute 'to_dict'

ancient nova
#

anyone up for helping me with the game's story?

tribal crow
#

May i get some help please?

#

I've made a button

#

but i get an error when trying to send it

boreal iron
#

A button has to be wrapped inside an action row.

#

Max 5 buttons per row, max 5 rows

tribal crow
#

it has to?

#

didnt know that

#

ty

boreal iron
#

An action row is required, yes

fallen holly
#

if i'm making a website for my bot does it have to be in the same folder as my bot or i can do it separate

#

i want to display how many server my bot is in on a web page

drifting cairn
#

you can put your bot in the same folder but i wouldnt recommend it

fallen holly
#

I already have made the web page

#

I just want to

drifting cairn
#

you can integrate an api into your bot to make requests back and forth s_duck_shrug

quasi depot
#
DiscordAPIError[50005]: Cannot edit a message authored by another user
    at SequentialHandler.runRequest (C:\Users\rudei\lavamusic-2\node_modules\@discordjs\rest\dist\lib\handlers\SequentialHandler.cjs:293:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async SequentialHandler.queueRequest (C:\Users\rudei\lavamusic-2\node_modules\@discordjs\rest\dist\lib\handlers\SequentialHandler.cjs:99:14)
    at async REST.request (C:\Users\rudei\lavamusic-2\node_modules\@discordjs\rest\dist\lib\REST.cjs:52:22)
    at async MessageManager.edit (C:\Users\rudei\lavamusic-2\node_modules\discord.js\src\managers\MessageManager.js:166:15)
    at async trackStartEventHandler (C:\Users\rudei\lavamusic-2\src\utils\functions.js:154:13)
    at async module.exports (C:\Users\rudei\lavamusic-2\src\events\Lavalink\trackStart.js:19:7) {
  rawError: {
    message: 'Cannot edit a message authored by another user',
    code: 50005
  },
  code: 50005,
  status: 403,
  method: 'PATCH',
  url: 'https://discord.com/api/v10/channels/1013528164867244083/messages/1013528167484498002',
  requestBody: {
    files: [],
    json: {
      content: '__**Join a voice channel and queue songs by name/url.**__\n',
      tts: false,
      nonce: undefined,
      embeds: [Array],
      components: undefined,
      username: undefined,
      avatar_url: undefined,
      allowed_mentions: [Object],
      flags: 0,
      message_reference: undefined,
      attachments: undefined,
      sticker_ids: undefined
    }
  }
}
drifting cairn
#

read the error

quasi depot
#

it can't edit the message.

drifting cairn
#

yeah, read the error

quasi depot
#

Discord Api Error...

drifting cairn
#

"Cannot edit a message authored by another user"

tribal crow
#

is it possible to make a button clickable by one person only?

drifting cairn
#

yes and no in a sense

#

everyone can click the button but you can filter it so only one person can access it

tribal crow
#

may i ask how?

fallen holly
drifting cairn
drifting cairn
# tribal crow may i ask how?

when they click the button just check if their id is equal to the id of the person you want to be able to access it

quasi depot
#

How can I fix the bot from disconnecting?

#
await message.edit({
        content: "__**Join a voice channel and queue songs by name/url**__\n\n",
        embeds: [embed1],
        components: [row1]
    });

}
drifting cairn
quasi depot
#

No clue, Doesn't really give me a error.

#
[03-09-2022 07:57:49]: [ERROR] Error when loading song! Track is stuck in [1013525707919478784]
[03-09-2022 07:57:50]: [LOG] Player has been destroyed in 1013525707919478784
DiscordAPIError[50005]: Cannot edit a message authored by another user
    at SequentialHandler.runRequest (C:\Users\rudei\lavamusic-2\node_modules\@discordjs\rest\dist\lib\handlers\SequentialHandler.cjs:293:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async SequentialHandler.queueRequest (C:\Users\rudei\lavamusic-2\node_modules\@discordjs\rest\dist\lib\handlers\SequentialHandler.cjs:99:14)
    at async REST.request (C:\Users\rudei\lavamusic-2\node_modules\@discordjs\rest\dist\lib\REST.cjs:52:22)
    at async MessageManager.edit (C:\Users\rudei\lavamusic-2\node_modules\discord.js\src\managers\MessageManager.js:166:15)
    at async module.exports (C:\Users\rudei\lavamusic-2\src\events\Lavalink\playerDestroy.js:41:2) {
  rawError: {
    message: 'Cannot edit a message authored by another user',
    code: 50005
  },
  code: 50005,
  status: 403,
  method: 'PATCH',
  url: 'https://discord.com/api/v10/channels/1013528164867244083/messages/1013528167484498002',
  requestBody: {
    files: [],
    json: {
      content: '__**Join a voice channel and queue songs by name/url**__\n\n',
      tts: false,
      nonce: undefined,
      embeds: [Array],
      components: [Array],
      username: undefined,
      avatar_url: undefined,
      allowed_mentions: [Object],
      flags: 0,
      message_reference: undefined,
      attachments: undefined,
      sticker_ids: undefined
    }
  }
} Promise {
  <rejected> DiscordAPIError[50005]: Cannot edit a message authored by another user
      at SequentialHandler.runRequest (C:\Users\rudei\lavamusic-2\node_modules\@discordjs\rest\dist\lib\handlers\SequentialHandler.cjs:293:15)
      at processTicksAndRejections (node:internal/process/task_queues:96:5)
      at async SequentialHandler.queueRequest (C:\Users\rudei\lavamusic-2\node_modules\@discordjs\rest\dist\lib\handlers\SequentialHandler.cjs:99:14)
      at async REST.request (C:\Users\rudei\lavamusic-2\node_modules\@discordjs\rest\dist\lib\REST.cjs:52:22)
      at async MessageManager.edit (C:\Users\rudei\lavamusic-2\node_modules\discord.js\src\managers\MessageManager.js:166:15)
      at async module.exports (C:\Users\rudei\lavamusic-2\src\events\Lavalink\playerDestroy.js:41:2) {
    rawError: {
      message: 'Cannot edit a message authored by another user',
      code: 50005
    },
    code: 50005,
    status: 403,
    method: 'PATCH',
    url: 'https://discord.com/api/v10/channels/1013528164867244083/messages/1013528167484498002',
    requestBody: { files: [], json: [Object] }
  }
}
drifting cairn
#

😐

#

read what i said before

#

read the error message.

quasi depot
#

Thats what I am asking you, I am not getting a error for when the bots get destroyed.

drifting cairn
#

yes but you've sent whats causing the error so im sure you know how to solve it now that you've narrowed it down to the root cause.

quasi depot
#

I am guessing removing the await will fix it.

drifting cairn
#

no

quasi depot
#

.,.

drifting cairn
#

read the error message

#

"Cannot edit a message authored by another user"

#

like i said before

quasi depot
#

...

#

That still doesn't give me a sense of why the bot is disconnecting

drifting cairn
#

disconnecting in what sense, turning off or leaving a voice channel?

quasi depot
#

just disconnects from the VC.

#
[03-09-2022 07:57:49]: [ERROR] Error when loading song! Track is stuck in [1013525707919478784]
[03-09-2022 07:57:50]: [LOG] Player has been destroyed in 1013525707919478784
drifting cairn
#

the track got stuck, since there wasnt another song in the queue im guessing it just left

#

what lib are you using to handle your music

quasi depot
#

tslib

drifting cairn
#

I dont mean what runtime lib, i mean the lib your using to handle the requests from what im assuming is lavalink or something

quasi depot
#

oh yes

#

lavalink.

drifting cairn
#

yes, which wrapper are you using though

lyric mountain
#

I'll guess, erela.js?

drifting cairn
#

ig

quasi depot
drifting cairn
fallen holly
drifting cairn
quasi depot
#

that is something I don't want to do ah.

drifting cairn
#

you dont want to listen to player events blob_think

quasi depot
#

Don't really know how that works.

drifting cairn
quasi depot
#

Well makes no sense how it was working fine and just stops working.

drifting cairn
#

because some tracks get stuck and some dont, thats why you need to handle the events

quasi depot
#

Where would I need to handle them?

drifting cairn
#

where ever you defined your player

#

and i'd recommend reading the docs

quasi depot
drifting cairn
#

thats the event which is causing the player to disconnect yes

quasi depot
#

now it works.

drifting cairn
quasi depot
#

but isnt there a way I can fix the error?

#

'Cannot edit a message authored by another user'

drifting cairn
#

read it

quartz kindle
#

what about that error dont you understand???

wheat mesa
#

I think that’s a fairly clear error

quasi depot
#
TypeError: Cannot read properties of undefined (reading 'queue')
    at Object.run (C:\Users\rudei\lavamusic-2\src\slashCommands\Music\queue.js:27:22)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.run (C:\Users\rudei\lavamusic-2\src\events\Client\interactionCreate.js:88:17)
         if (!player.queue.current)
fallen holly
quartz kindle
#

and make your website send a request to it

ancient nova
#

integrated doors into my interaction system

fallen holly
quasi depot
#

question is how do I make it defined.

drifting cairn
lyric mountain
wheat mesa
#

Foggy windows are creepier

radiant kraken
#

good

wheat mesa
#

Yes that’s good

lyric mountain
#

ye, the less you see, the better the ambience

#

oh and ALWAYS remember: use too much jumpscare and it stops being scary

fallen holly
#
client.guilds.cache.reduce((a, b) => a + b.memberCount,0)
#

this is giving me NAN

lyric mountain
#

,0?

sudden geyser
#

that's the initial value

#

The code looks correct. Could you show more of it?

fallen holly
#
client.on("ready", async () => {
  const statsArray = [
    {
      type: "PLAYING",
      content: "with discord.js",
      status: "online",
    },
    {
      type: "WATCHING",
      content: `over ${client.guilds.cache.size} server`,
      status: "online",
    },
    {
      type: "LISTENING",
      content: `commands`,
      status: "online",
    },
    {
      type: "PLAYING",
      content: `!help`,
      status: "online",
    },
    {
      type: "LISTENING",
      content: `commands from ${client.guilds.cache.reduce((a, b) => a + b.memberCount,0)} users`,
      status: "online",
    },
  ];

  async function pickPresence() {
    const option = Math.floor(Math.random() * statsArray.length);

    try {
      await client.user.setPresence({
        activities: [
          {
            name: statsArray[option].content,
            type: statsArray[option].type,
          },
        ],
        status: statsArray[option].status,
      });
    } catch (error) {
      console.log(error);
    }
  }
  setInterval(pickPresence, 8 * 1000);

  console.log(`${client.user.tag} logged in`);
fallen holly
#

huh

lyric mountain
#

is membercount always not-null?

fallen holly
#

now it's showing nothing

lyric mountain
#

try printing each step

#
.reduce((a, b) => {
  console.log(a);
  return a + b.membercount;
}, 0)
fallen holly
lyric mountain
#

well, then the first b.membercount returned either null or undefined

fallen holly
#

it use to work

lyric mountain
#

now it doesn't

fallen holly
#

yep

#

it was woking 30 mins ago

lyric mountain
#

when you rely on cache it's just like this

#

now you see me, now you dont

earnest phoenix
#

How do I do this

lyric mountain
#

do you have the guild members intent btw?

fallen holly
wheat mesa
fallen holly
#

lol

earnest phoenix
wheat mesa
#

Then you did it wrong. It wasn't code, it was basic logic

#
  1. Wait for a POST request from top.gg when a user votes for your bot
  2. Give rewards to the user
earnest phoenix
#

😐

wheat mesa
#

Optionally send a message in a reserved channel afterwards

fallen holly
earnest phoenix
#

I want him to send a message in a specific channel when someone says vote just tell me how to do it

wheat mesa
#

Fetch the channel/get it from cache
Send the message

#

You have to set up your bot to receive POST requests from top.gg whenever someone votes for your bot

#

To do that you can read the pinned messages in #topgg-api

lyric mountain
earnest phoenix
#

See what I write here

wheat mesa
#

Then URL to your webhook endpoint

earnest phoenix
#

this??

wheat mesa
#

No

earnest phoenix
#

How ?

wheat mesa
#

You have to set up a webserver of some sort (Like express.js) for your bot

#

Then the URL to the endpoint you set up there is what you put in that box

ancient nova
#

but ya I'll make them a little bit less translucent

sacred aurora
#

is there any update regarding discord bot?
i just tried to make a bot and it didn't see the message content

wheat mesa
#

Message content intent

sacred aurora
#

ah i see, ty

earnest phoenix
#

what would be the right permisson to use for a ticket command (that creates a ticket)

im guessing manage_channels?

#

Hello, I'm making an emojirole system. But I got such error. Could you help?

const data = require("../models/Guild")
module.exports = {
    name: 'messageReactionAdd',
    async run(client, user, reaction) {
if(client.user.id === user.id) return;
let emoji = reaction.emoji?.toString() || ''
let config = data.findOne({GuildID: reaction.message.guild.id, message: reaction.message.id, emoji: emoji})
if(!config) return
if(config) {
    let member = reaction.message.guild.members.cache.get(user.id)
    if(reaction.message.guild.roles.cache.get(config.role)) {
        if(!member.roles.cache.has(config.role)) member.roles.add(config.role)
    }
}
    }
}
earnest phoenix
#

When I log the reaction to the console it throws this.

sharp geyser
#

thats cause what you think is reaction is actually the user

#

I bet if you log user you'd get the reaction

earnest phoenix
sharp geyser
#

Swap the names

wooden ember
#

bruh i found more cursed stuff on github looking at discord bots

#

theres 81 options in that randomiser

radiant kraken
wooden ember
#

true ive seen worse

radiant kraken
#

like my bot

wooden ember
#

like that time i saw an entire pokimon game trading bot thing in one file

#

it was 30k lines

#

kinda sad i never saved the link for that cuz i cant find it anymore

radiant kraken
surreal sage
#

What's the typeof a function?

radiant kraken
#

function

surreal sage
#

yup ty LUL

wooden ember
#

i think the most i got upto was only a couple thousand before i got bored and made a command and event handler

eternal osprey
#

Hey guys i am stupid and need some help

#

so i have 3 numbers

#
let number11 = number.split('d')
    let number12 = number11[1].split('m')
    let number13 = number12[1].split('s')```
#

number11 is the amount of days, lets say 1. Number12 the amount of minutes, lets say 1 as well, and eventually number11 seconds; 1 as well.

wooden ember
#

bruh why are you doing it one after the other

eternal osprey
#

what

wooden ember
#

im guessing you have somthing like 3d5m7s right?

eternal osprey
#

yeah

#

anyways, how would i send out an alert that's applicable to the given time?

wooden ember
#

so you do split at dmeaning everything after d is gone

eternal osprey
#

If i for example took off 10 minutes from each input, it would eventually give problems if someone would input 0d5m0s. So how would i create a number that's not static, according to the input that will be taken off the total ms count

wooden ember
#

meaning number11 = 3

#

then you try to get number12 by splitting at m when the value is 3

earnest phoenix
#

Just use something like https://npmjs.com/package/ms to get that input in milliseconds

#

And so you can do whatever you want with it

eternal osprey
earnest phoenix
eternal osprey
#

and i am running against the issue that i must find a number that's applicable to their inputs.

#

If i for example took off 10 minutes from each input, it would eventually give problems if someone would input 0d5m0s

wooden ember
#

if(m<'10') return

#

somthing liek that

earnest phoenix
#

This just needs basic conditions, just return if the milliseconds is less than 10 minutes

wooden ember
#

yeah

#

cuz theres no point in reminding early on such a short timer

feral aspen
#

Is there a break; for .forEach()?

cinder patio
#

no

feral aspen
#

What's the alternative, then?

cinder patio
#

Use a for loop

feral aspen
#

👍

tribal crow
#

Hello hello

#

In a button event, how could i find the user who used the slashcommand where the button was "attached" in the reply?

#

For example, if someone uses the "Hit" button, how would i be able to check if the user who clicks the button is the same user who used the slashcommand?

vivid fulcrum
#

use a cache

#

since this is a game you might want to consider some kind of a game manager class which pumps out game instances

#

game instances would link the user id to the blackjack game (blackjack message id, buttons, etc.)

tribal crow
#

could all of that be stored in the button?

surreal sage
#

Get date in 4 weeks?

wooden ember
#

get the data now in miliseconds and add however many miliseconds a week is and add it

#

then convert it to normal data

surreal sage
#

new Date().getTime() correct?

vivid fulcrum
surreal sage
surreal sage
wooden ember
surreal sage
#

Gotchu

#

And seeing if a date (in milisecs) has passed the current date?

tribal crow
wooden ember
#

idk how to convert it from ms to human readable dates though but i bet its easy

surreal sage
#

I want to see if a date has passed the current date

#

(date.now() ?? milisecs) > new Date().now()?

wooden ember
#

it would be somthing like date.now() > new Date(date you are checking here) i think

surreal sage
#

Yeah that works too

wooden ember
#

nice

surreal sage
#

It's the same

feral aspen
#

The above code works with a .html file but not an .ejs file.

feral aspen
#

Yeah, I can't seem to load CSS into .ejs files. :/

#

Oh, figured it out. 👍

craggy crane
#

how I send a dm to a user through slash commands

#
interaction.user.send(embed).catch(e => {
                       ^

TypeError: Cannot read properties of undefined (reading 'send')

i tried this

boreal iron
#

which interaction do you recieve? the user should always be a property

#

share the code with us

craggy crane
#
SlashCommand: {
  run: async (client, interaction, args) => {
    const guild = client.guilds.cache.get(interaction.guild_id);
    const user = client.users.cache.get(interaction.member.user.id);
    const member = guild.members.cache.get(interaction.member.user.id);
    let player = await client.Manager.get(interaction.guild_id);
    if (!player) return client.sendTime(interaction, "❌ | **Nothing is playing right now...**");
    if (!player.playing) return client.sendTime(interaction, "❌ | **Nothing is playing right now...**")
    if (!member.voice.channel) return client.sendTime(interaction, "❌ | **You must be in a voice channel to use this command.**");
    if (guild.me.voice.channel && !guild.me.voice.channel.equals(member.voice.channel)) return client.sendTime(interaction, ":x: | **You must be in the same voice channel as me to use this command!**");
    let embed = new MessageEmbed()
      .setAuthor(`Song saved: `, client.user.displayAvatarURL())
      .setThumbnail(`https://img.youtube.com/vi/${player.queue.current.identifier}/mqdefault.jpg`)
      .setURL(player.queue.current.uri)
      .setColor(client.botconfig.EmbedColor)
      .setTimestamp()
      .setTitle(`**${player.queue.current.title}**`)
      .addField(`⌛ Duration: `, `\`${prettyMilliseconds(player.queue.current.duration, {colonNotation: true})}\``, true)
      .addField(`🎵 Author: `, `\`${player.queue.current.author}\``, true)
      .addField(`▶ Play it:`, `\`milplay ${player.queue.current.uri}\``)
      .addField(`🔎 Saved in:`, `<#${interaction.channel_id}>`)
      .setFooter(`Requested by: ${player.queue.current.requester.tag}`, player.queue.current.requester.displayAvatarURL({
        dynamic: true
      }))
        user.send(embed).catch(e => {
        client.sendTime(interaction, "**:x: Your DMs are disabled**")
         }) 

    client.sendTime(interaction, "✅ | **Check your DMs!**")
  },
  },
};
wheat mesa
boreal iron
#

your first 3 constants are wrong and/or nonsense

#

let's begin with guild

#

No property guild_id exists in the interaction object except for raw request data

#

the constant user is nonsense...

#

interaction.user is your user object

#

no need to create a useless var

#

also what makes it even more useless is the fact you're accessing the member property (which is only available in guilds) then user then select the property id

#

which obviously isn't an user object but just an ID

#

same goes for your member constant

#

which also ends up being the user ID

#

interaction.member.user.id

craggy crane
#

k thanks

boreal iron
#

so... in your case interaction.user.send(...) would be your solution

tribal crow
boreal iron
#

The button interaction holds a message property

#

Which is the message the button was attached to

#

This however holds the interaction property

#

You can access to get the user who executed the slash command

tribal crow
#

in code that translates to...?

tribal crow
#

so to get the user who executed the slashcommand i could do interaction.message.interaction.user.id?

boreal iron
#

yeah, should be correct

tribal crow
#

yep, works

#

tysm

fervent moss
boreal iron
#

await your promises when fetching an user

fervent moss
#

I had already tried it.
My vote event already is in async manner

drifting cairn
boreal iron
#

webhook.listener(vote => { ... isn't async

#

also