#development
1 messages · Page 39 of 1
idk how slow but its apparently slow enough to mention
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?
I mean there is no real benefit to it tbh
I could 100% go with using strings in my rust structs as well
Then that would be better, because no conversion would be needed after storing them as strings in PostgreSQL
I understand, been there; stress does a lot of fucked up shit to people
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
Learning how to deal with Rust's borrow checker is just true pain
oh the borrow checker is lightwork rn
fucking linker error was the issue

Damn
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
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
No idea what this means
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
A reference is probably the better option
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
Wait so are you making an actual chat app?
If so is it like related to Discord or completely separate?
Indeed I am, and I have yet to decide the path I am taken as I was originally doing this for practice with websockets. I might just turn this into a real thing though
So far I am enjoying the development of it (despite a few issues)
Glad that you're enjoying it at least
oof all text my gosh, you’re crazy
I haven't written actual sql in so long
so I forgot the datatypes
so if there is something better lmk

Is there any way for me to send an interaction reply from an user message rather than a slash command interaction?
can't
as the name suggest, interaction reply requires an interaction to reply to
apparently user message is not one of that
smh -_-
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
see who can make the best game bot with D++
hmm, interesting
you made it sound like a gamejam so
yeah it kind of is like a gamejam
Just see who can make the best game bot in D++
this may lure in game developers experienced in C++
does the bots have to use D++
so its still a nice little challenge to come up with an idea and use it
that's the idea to draw awareness of D++ yes
but if I do it then it's likely other libs may do so too
true
just c++ and game dev fit well together
indeed it does
it'll be better to just make a normal discord bot game jam instead
instead of making it specific to a lib
not from my perspective lol
I mean, is there any other decent C++ lib for discord
we would just end up with 5000 Py/js bots and I can't judge those
the point is to draw more traffic towards D++ for those C++ devs
by the sounds of it anyway
there are 4, but only one other that's decent the rest are obsolete or not mainted or supported
that is c only
C
and doesn't support lots of modern stuff
yes
true
it's a fork of orca
async exists in C? I thought it was only a pipe dream
gotcha
async is purely an interpreted thing
async is just a thread wrapper
using that lib looks like a chore in itself
exactly
who'd even wanna use it
D++ operates on a strict thread model, sleepy discord wtf does that even do, DiscordCoreAPI and Discord++ use a thread pool
i dont see why people would make a discord library in C
Didn't you say you would at one point
sounds hell
it doesn't even shard
sleepy discord does shard but one shard per process
concord sorry mixed that up and called it cogmasters
Sounds like a game name
tbh i cant imagine async without threads
easy look at js
node doesn't actually use real threads
i mean in low level
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
interesting
soon becomes not scalable as all these wait states and promises stack up internally
modern C++ does have coroutines
coroutines are like js async
do they use threads under the hood
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
that looks so cursed
in dpp it goes to the REST queue like a promise
what does the co_await macro do
Hey, does anyone know how i could scrape the first displayed product on this site?
it's a keyword not a macro
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
All the data is there and i tried this: ```js
const axios = require('axios')
const cheerio = require('cheerio')
axios.get("https://www.hobbydb.com/marketplaces/hobbydb/catalog_items?filters[q][0]=Zombie He-Man Horde Pit")
.then(async response => {
data = response.data
let $ = cheerio.load(data);
let r = await $(".col-sm-9 col-md-12")
console.log(r)
})``` But it returns LoadedCheerio(0)
that's crazy
C++ has evolved a lot in years
since when was this a thing
C++20? C++23?
this is c++20
ooh
Cheerio doesn't return a promise so there's no need to use the await keyword there, and try this div[class="col-sm-9,col-md-12"]
I actually found out through the network tab that they have an api response
i can easily put my item keywords in the api link and it will return me the right promises

Long URL moment
isn't it URI?
use ඞ as a variable 
What they've sent is a URL, and example of a URI is \⚱️isbn:0-284-56889-3
What makes it a URI do you think?
because you've just said so
I didn't? Did you even read what I sent?
yes i did
to coincise this let's call it URl
it's URl
L lowercased
I don't think anybody would really get that joke, because I and l looks almost the exact same to the humans, good job
The lowercase L (l) only looks a little taller than an uppercase i (I)
exactly
And the human brain does not consider that while reading
cooperate ask you to find the difference between those pictures
i do
It's like trying to spot a needle in a haystack, as you're reading through many words
it seems easy
Yeah because you're overly focused over picking those up, almost nobody focuses on reading that much to nitpick those
Heh alright
because co, coroutines
I would have chosen await too but maybe they thought people would assume wrongly about it
can someone help me size my logo for my discord server
How do I make if someone voted for the bot, the bot sends it a private message?
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
Ok
should i have this as a oauth2 invite permission thing? or does it do it automatically?
choice 6 has an empty name
but nothing is selected
@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 :
did you fill in your bot id?
where
:your-bot-id
make sure your website is secure first
it´s
What’s the result when you say it doesn’t work?
that iframes replace all webiste
now I send screenshot
<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?
Dude
src
hi how can i make a promise function that has an argument cause im having difficulties with that
That will place your iFrame on top of everything taking the entire screen
To what?
You need to choose a relative position which takes the parent (content description box) as reference
only?
ok
thnks
At least this will not cover the entire site
Gimme one second
If I can find something
Search for something by me, search for: "position: relative"
Should have iframe as selector
going
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
Yes
question
Dunno why searching on mobile hasn’t the same results like on web
ready
W-why did u set min width to 100%?
Because the mobile version of topgg will fuck it up
Just set the width itself
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
Just play around with it a bit
thanks bro
Np

edit the message itself
I know that, but idk the code part, lol
the same way u sent that message to begin with
it's virtually the same code, except for the edit part
But, I don't have the object
how did u sent that message?
Ctx.send
So, ctx.channel?
no
Huh?
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
Copy the message ID from discord, fetch said ID, then edit the message
Lemme rephrase: ctx.channel.fetch_message
yes
K
ooo trivia ping
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);.
you cant use res.send() more than once
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.
then just build a string
let text = "";
for(...) {
text += something
text += "\n"
}
send(text)
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().
You can also use the Object.entries() method to get both
I can't use \n.
why not?
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?
what is the output?
All in one line.
OH, wait.
The source code shows it in multiple line but the website browser doesn't.
for browsers it should be <br> instead of \n
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)
}
}
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)
}
}
whats your djs version?
14
You need to use the enum for the type option, strings for such fields are no longer supported
Such as Activity.Watching
Strings are generally just not supported, so changing it won't do anything
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)
}
}
Also discord.js docs are apparently having a stroke
it was like that, Me changing the playing to watching or anything else doesn't work
I have a interval function in my ready event, it only starts the second time the interval function executes not the first one
not quite sure if that's the case for you, though
try without type: client.user.setPresence({ activities: [{ name: 'test' }], status: 'idle' });
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' });
})
}
}
what's the difference between setActivity and setPresence
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
that seem to work, But yet to get the bot to change it status like dnd, online.
Doing that will make it set the presence repeatedly because you're not providing milliseconds to wait for in the setInterval() function
what do you want to set it to?
just change the idle to whatever status u want
You'll get ratelimited if you're not careful
oof didn't even notice that
ye you cant remove this
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)
}
}
Setting the presence every second will also get you ratelimited
yeah 1000 is bad lol
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
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
there is no type...
?
oh wait
name: 'Rutr Runs', type: 3
type is status nv
no status is status (online, idle, dnd, etcc)
nope, Still is set to playing.
show code
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)
}
}
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
});
I already told you, Status isnt working.
what do you want to set it to?
dnd
does anyone have any feature ideas or game ideas or program ideas or any ideas at all?
I can copy this right?

"dnd" should work then
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)
}
}
that should work for do not disturb
Technically yes (ignoring the ...), but try to integrate it to your code, not just copy it
Nope.
Also please don’t set your presence every 10 seconds
Declare the statuses outside the interval, get a random status in the interval, and set them as presence
IIRC setting the status has some kind of time limit to it, an unusually long one
Alright, It changed to dnd, after a long time.
yeah
Unsure if that's even intentional, maybe Discord haven't noticed it
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
"first part"?
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'
});
I would remove that code, But too lazy to re edit the code
name: status instead of name: 'Rutr Runs'
?
client.user.setPresence({
activities: [
{
name: status
}
],
status: 'dnd'
type: 'watching'
});
i'm trying to send a message to my alt account but it's not sending
do i need to turn on a setting ?
sending as of?
const member = client.users.fetch("id");
member.send("message");
``` make sure the alt is in at least one server your bot is in, if you're sending from the same server you can use `message.guild.members.cache.get`
making a kick cmd when a mod kicks the member it is not send a message to that user that they have been kicked
you have to send before the kick
👍
thx
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?
if you removed the changing statuses then yeah you can remove the interval
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.
you can also remove the async since youre not awaiting anything, otherwise looks good
wdym the status disappears every couple hours
I don't remember if or why it does.
me neither, but I have to have an interval otherwise my status will disappear
If it's the case, the interval should still be higher (say, a day).
it disappears once every couple hours
the status can disappear during disconnects and reconnects
I set my interval to 6 hours if I remember correctly
So on the connect event
you can do that?
no way
I mean, you only need to update on shardUpdate I think
so I can do both
that way I can remove the interval
tuen yoi
what if a new guild joins? a new shard doesn't get created, an existing gets updated, I think?
ten yen
Ben ten
aka ben dez/deis (in portuguese)
anyone know how to remove the pink highlght on functions with VSC? really annoying
(), {} and [] is pink
You mean the rainbow coloring?
if that's what it's called , then yes
Check if this setting does it
If you want all the brackets (i.e. (), {}, and []) to not differ in color, then yes, disabling the option will do.
Pretty sure that’s your theme
it does that on any theme
Since VSC added built-in rainbow brackets
Also ew why are you using VSC for C# 🤮
bruh wot, VSC is great for c#
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
that's the biggest cap I've ever heard
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.
it's their fault if they don't have an indentator or intelisense
Doing any sort of debugging work with VSC and C# is dogshit
The client.shard property is null if you're not sharding yet, you should remove that until you actually shard
That’s why VS and Rider are easily objectively superior for C#
omg I love you
Sharding is also only required if your bot has reached 2,500 servers
remove the line of code?
what is the best theme for VSC?
never had any problems with debugging, and I use the default console
One dark pro with Intellij Mono font
I use Gruvbox Material
Just use client.guilds.cache.size to get the guild count
I think I have it installed
gruvbox looks shit for me
actually nvm I used the dark version of gruvbox
If you use regular Gruvbox and don't make it dark, yes it does.
Dracula Soft with Fira Code
Have.. you ever actually used the debugger though? It’s a terrible experience in VSC with C#
what exactly do you mean by debugger, I've used console debugging to find errors and I had no issues so far
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
he means an actual debugger with breakpoints and all that crap
^^
I see
Debugging is really easy with Rider
Just set a breakpoint and inspect everything
Super simple
what about the users?
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
What the hell don't let console.log be Bae, the code will be too bloated
with that said, i also dont use debuggers
wot the helllll
:^)
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
as it should be
same thing, just with users instead of guilds
I find that knowing how to debug is a valuable skill
I didn’t like it at first either
But after I got the hang of it, it’s a godsend
Especially when you need to know the value of lots of things
If your program is so complex you need a debugger to debug it I'd look at simplifying it.
Sometimes there can be many problems
Ahem, debugging Node.js and LLVM internals
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
is my c# syntax better than my js syntax?
**• 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)
The value of your guildCounts variable is already a number, no need to reduce it to one
Yes and no, you’re not following the official C# suggested format, but you’re not making it insanely unreadable like you do with js
try with this
oh this isn't about gruvbox anymore
sad
gonna try in a sec
what is the "suggested" format?
Curly brackets have their own newline
And it’s usually suggested to let the compiler infer types by using var
first thing I turned off in my custom indentator
removed .reduce, Now guild Counts is not a function.
Not at all
Though I dislike typing out the entire type for things so I usually like using var instead
Remove the () and the arguments inside it, a number isn't a function as you're trying to call it.
I never use var in c#
which is pretty weird
better
never had issues with typing out the type
... remove .reduce
I don’t like it because it makes you import the namespace that the type resides in
forgot
Type inferring is a really good thing to use in languages like C#
Especially in languages like Rust
wanna rate the code of my AI?
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
Also Waffle, did you know that Rust's type system is Turing-complete?
I wouldn’t doubt it
AI??? YOU????
I had so much trouble with that if statement
tf did I miss??
Hate to break it to you but that is NOT an AI
ah, unity ai
damn relax wot the hell
They implemented a fucking esolang in just the type system
https://sdleffler.github.io/RustTypeSystemTuringComplete/
(N.B. The word “fuck” appears multiple times in this post. I recommend that
the reader temporarily not consider “fuck” as profanity, as it isn’t used that
way here.)
anyways.. I had trouble with that if statement
I had to make tons of conditions because it would keep playing sounds non stop
Btw, that’s just a small set of conditions that cause an output, that’s not an AI
if it's something that moves in my game and behaves depending on what you throw at it, it indeed is an AI, not an actual AI but by definition in games it is an AI
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
Isn't that the backrooms game you wanted me to test out a while ago?
what else would call it if it isn't
An if statement…
yeah
Man that shit was the laggiest thing I've ever ran in a PC
weren't you the one who used Wine?
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
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
It might possibly be an issue relating to lack of skill
I can show you a gameplay video of the game if you want
Somewhat of a “skill issue” if I may
I've ran the games of your type many times, none of them ever had such issues
It's just a skill issue
what's your PC specs
Of a major variety
mine are medium at best and it runs smooth
Hey will editing 2 embeds each 10s give me a ratelimit?
No but I wouldn’t recommend doing it continuously
@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
sure, I'm looking for that stupid video to send I can't find it though
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
found a picture of the level I never finished
it was hard making it procedurally generate without models being stuck to each other
Although don't try to put anything sketchy in there because you already know it's not gonna work

also found a video of one of the VIP features
I wouldn't 
omg I found the screenshot
alright I feel motivated
I'll start working on the game
Hey, may i ask why i get an error saying "rcard1.replace is not a function"?
here is the code
make sure rcard1 is a string
you can try doing .toString() before doing .replace
isnt it tho?
no idea, javascript is weird
to make sure they're strings you can also log both of these variables
I don't see any embeds in the source
ik
You may wanna think about what you’ve done
card1 and 2 are both numbers
Not a string
lmfao I just noticed
card1n and 2n are supposed to be numbers
You know? Then why do try to call replace on numbers?
yeah you need to do
let rcard1 = cards[Math.floor(Math.random() * cards.length)];
let rcard2 = cards[Math.floor(Math.random() * cards.length)];
lol
i want the number first number in the <:1card:...> thing
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?
how can I make a command for say server-info an global command? (Discord.js V14)
card1 and 2 are supposed to be 2 random elements in the "cards" array
You create register the global command once and specify its command options, for example a string with you text
card1n and card2n are supposed to be the value that the cards has
opening this for the first time in 3 months
Ok then take a look at Bae‘s example
Calling that already returns the value
when i log rcard1 and rcard2 it gives me , but when using the same variables in an embed i only get :2card:
Does the bot even have access to your custom emojis?
iirc bots can’t use emojis they don’t have access to
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
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?
just use a collection
and add to it
ik
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
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
yeah I would probably use a DB for that
sets no, but maybe maps
always
So, I got a 404 Unknown Message error @wheat mesa
Means the message you referring to doesn’t exist (anymore)
Error changed to :x: | AttributeError: 'str' object has no attribute 'to_dict'
anyone up for helping me with the game's story?
May i get some help please?
I've made a button
but i get an error when trying to send it
An action row is required, yes
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
theres multiple ways you can do it
you can put your bot in the same folder but i wouldnt recommend it
What is the other way
I already have made the web page
I just want to
you can integrate an api into your bot to make requests back and forth 
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
}
}
}
read the error
it can't edit the message.
yeah, read the error
Discord Api Error...
"Cannot edit a message authored by another user"
is it possible to make a button clickable by one person only?
yes and no in a sense
everyone can click the button but you can filter it so only one person can access it
may i ask how?
Tbh i have no clue how to do that. 😞
you can use express.js
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
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]
});
}
whys it disconnecting
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] }
}
}
Thats what I am asking you, I am not getting a error for when the bots get destroyed.
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.
^
I am guessing removing the await will fix it.
no
.,.
read the error message
"Cannot edit a message authored by another user"
like i said before
disconnecting in what sense, turning off or leaving a voice channel?
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
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
tslib

I dont mean what runtime lib, i mean the lib your using to handle the requests from what im assuming is lavalink or something
yes, which wrapper are you using though
I'll guess, erela.js?
ig
right.
if you are using erela.js just make use of this event, because that's what is being fired before the player gets destroyed so you can handle it how ever you want.
https://erelajs-docs.netlify.app/docs/typedefs/TrackStuckEvent.html
Documentation for the interface TrackStuckEvent.
Ik how to use express exactly how to use it
just listen for request from your websites backend and send what its requesting e.g. server count etc...
that is something I don't want to do ah.
wdym?
you dont want to listen to player events 
Don't really know how that works.
read the docs then 
Well makes no sense how it was working fine and just stops working.
because some tracks get stuck and some dont, thats why you need to handle the events
Where would I need to handle them?
Documentation for the interface TrackStuckEvent.
thats the event which is causing the player to disconnect yes
read this aswell https://erelajs-docs.netlify.app/docs/gettingstarted.html
Official documentation for the Lavalink client of Erela.JS
now it works.

but isnt there a way I can fix the error?
'Cannot edit a message authored by another user'
read it
what about that error dont you understand???
I think that’s a fairly clear error
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)
i don't have a back-end i'm using replit and it is one page
put a webserver inside your bot
and make your website send a request to it
player is undefined
integrated doors into my interaction system
aight
question is how do I make it defined.
you should really learn the basics of js before you continue development no offense
tip, make the glass less transparent
Foggy windows are creepier
good
Yes that’s good
ye, the less you see, the better the ambience
oh and ALWAYS remember: use too much jumpscare and it stops being scary
,0?
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`);
?
ah, nvm
huh
is membercount always not-null?
now it's showing nothing
try printing each step
.reduce((a, b) => {
console.log(a);
return a + b.membercount;
}, 0)
well, then the first b.membercount returned either null or undefined
it use to work
now it doesn't
do you have the guild members intent btw?
is there another options
Dude, we told you like 5 times
lol
The method did not work
Then you did it wrong. It wasn't code, it was basic logic
- Wait for a POST request from top.gg when a user votes for your bot
- Give rewards to the user
😐
Optionally send a message in a reserved channel afterwards
any one
I want him to send a message in a specific channel when someone says vote just tell me how to do it
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
do you REALLY need to show member count?
Then URL to your webhook endpoint
No
How ?
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
they look better with post processing on
but ya I'll make them a little bit less translucent
is there any update regarding discord bot?
i just tried to make a bot and it didn't see the message content
Message content intent
ah i see, ty
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)
}
}
}
}
reaction.emoji is undefined
When I log the reaction to the console it throws this.
thats cause what you think is reaction is actually the user
I bet if you log user you'd get the reaction
What should I do?
Swap the names
bruh i found more cursed stuff on github looking at discord bots
theres 81 options in that randomiser
at least it's using a switch statement
true ive seen worse
like my bot
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
my bot used to be in one file and it had 2675 lines of code with billions of if statements
What's the typeof a function?
function
yup ty 
oh god
i think the most i got upto was only a couple thousand before i got bored and made a command and event handler
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.
bruh why are you doing it one after the other
what
im guessing you have somthing like 3d5m7s right?
so you do split at dmeaning everything after d is gone
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
meaning number11 = 3
then you try to get number12 by splitting at m when the value is 3
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
This system i made already works well with my ms calculations. However i am trying to ping users before their timer runs off

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
This just needs basic conditions, just return if the milliseconds is less than 10 minutes
Is there a break; for .forEach()?
no
What's the alternative, then?
Use a for loop
👍
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?
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.)
could all of that be stored in the button?
Get date in 4 weeks?
get the data now in miliseconds and add however many miliseconds a week is and add it
then convert it to normal data
new Date().getTime() correct?
i actually think it could, i haven't been using the discord api for quite a while so im not sure what the limit is on the button ids. but storing data in buttons is a totally valid way too
You can do new Date('27th September 2022') and it'd return it
But?
to get the time in miliseconds would be date.now
https://sourceb.in/Yd54k7KLNQ so something like that could work? And then in the button event i just check the id of the button?
idk how to convert it from ms to human readable dates though but i bet its easy
Not my issue
I want to see if a date has passed the current date
(date.now() ?? milisecs) > new Date().now()?
it would be somthing like date.now() > new Date(date you are checking here) i think
Yeah that works too
nice
It's the same
Apparently, CSS isn't loading and the paths are correct: https://srcb.in/HS22dsufzR .
The above code works with a .html file but not an .ejs file.
Yeah, I can't seem to load CSS into .ejs files. :/
This is my current server.js file: https://cdn.hamoodihajjiri.com/xtWe55YnQn .
Oh, figured it out. 👍
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
which interaction do you recieve? the user should always be a property
share the code with us
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!**")
},
},
};
Why are you getting the user from the cache if you already have the user via the Interaction object?
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
k thanks
so... in your case interaction.user.send(...) would be your solution
Hey! Could someone try to help me with this? #development message
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
in code that translates to...?
so to get the user who executed the slashcommand i could do interaction.message.interaction.user.id?
yeah, should be correct
await your promises when fetching an user
I had already tried it.
My vote event already is in async manner
await can only be used inside of an asynchronous scope





