#development
1 messages · Page 156 of 1
it looks like its an issue, even on their github
anyone know any word around?
same
you should really avoid using raw queries
Im not, it’s just an exception but I’m making sure it’s sanitised correct , the query builder takes care of it
Anyway I’ve fixed it actually.
hello, im back to programming after like a year
and im struggling to send an object to my frontend in ejs
this is my dir so far
need to send object through express from index.js to base.ejs
cant use res.render('base'...) cuz it will probably error and if it doesnt its still not practical to put that in every get
@ me if i dont reply straight away
I don't quite understand the question.
You just want to do a api request?
no
I have object i want to send to front end
and the usual way is res.render('..', { object here })
but, the thing is base.ejs is a partial, shouldve clarified that. so basically in home.ejs and other website.com/....(forgot the word) i just do <%- include('./base.ejs') %>
you have to put it in the render function one way or another
since base is included, you put it in the render of the file that includes base
surely thats not right ? in every router ill have to put that
there has to b a middleware or something
it does exist i just forgot
maybe not a middleware but there is something
probably yeah, look for it in the ejs docs
yh cant find it
thank u a lot
Hi, I have a command that does set a channel for logs. When I do /set channel and choose the channel it does work and it is being put on the database ( mongodb ) but if I want to change channel I can’t because it’s already registered in the database. It’s there any way to like overwrite the new channel on the database?
databases have an update command
how did you save it as? like what is the structure/model/schema like?
I will attach the schema and the command!
Schema: https://srcb.in/OxbUwRz31g
Command: https://srcb.in/CaGtCwe6ed
it should be working, youre doing the correct command
the thing is your if
youre only updating if the guild id is not found in the database
because of the if(!result)
so you need to change that
What should I change that into?
you should be able to figure it out, like when do you want to allow the update to work? if you just remove that if it will always update. if you dont want to always update but only under certain conditions, then you need to put what those conditions are in the if
const bot = new Discord.Client({ autoReconnect:true, intents: [ Discord.Intents.FLAGS.GUILDS, Discord.Intents.FLAGS.GUILD_MESSAGES, Discord.Intents.FLAGS.GUILD_VOICE_STATES ]});
``` put my bot on another server that just had a new os installd and now nothing works because js updated a milion versions and now the code above no longer works. aparenly d.js "doesn't suport flags" anymore from what i have looked at. What is the new way of writing the code above so that it works again?
One message removed from a suspended account.
One message removed from a suspended account.
idk what ever one installed when i ran npm install discord.js
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
uuuuh originally v12 but I updated it to work with v13
One message removed from a suspended account.
One message removed from a suspended account.
I forgot you could do that to be honist
but also thats just gonna mean the code gets even more outdated and will be harder to fix next time
cuz if it wasnt for that I would still be using v12
also bruh windows screwed my clock up again
One message removed from a suspended account.
One message removed from a suspended account.
is that stable or just dev
One message removed from a suspended account.
One message removed from a suspended account.
ah are they back to using odd numbers as dev and even numbers as stable or is that out the window entirly now
One message removed from a suspended account.
bruh
One message removed from a suspended account.
One message removed from a suspended account.
I envy you
i mean don't get me wrong i like hosting bots and making them but god is it tedious when i have to run to stand still
I wish I wrote my bots in c# or something
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
i mean i wrote my bots during covid when I had alot of time but now Im not in collage anymore real life takes presidence
One message removed from a suspended account.
I just tinker with these things and thats about it these days
fair enough though i though that was just js but with different formatting or something
anyway thinking of real life I need to sleep cuz I didnt realise my clock was an hour behind
Got any decent starting resources on it?
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
c#
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
good to know
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
agreed
One message removed from a suspended account.
One message removed from a suspended account.
but i dont find any good use cases for it besides unity
One message removed from a suspended account.
what do you use C# for?
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Id like to spend some time playing around with the basics of a few languages, I've been using JS and TS for so long now
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
learning C#'s basics was a bit time consuming for me but it was a lot of fun
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
is it compiled or interpreted?
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
alright
One message removed from a suspended account.
good enough 
i already know the basics of C# thanks
but i haven't tried the newer versions
One message removed from a suspended account.
One message removed from a suspended account.
i believe i was using C# 4 or 5 when i started learning 2.5 years ago 
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
I have the 7.0
pretty much any distro is probably fine as long as you're not using the graphical version of it
Any in particular?
Most popular I'd say is ubuntu
How about rocky linux
If you want to use it
Why not just stick with debian/ubuntu
windows is a good distro

just found this gem of really bad advice on stack overflow for how to grow your open source project... needless to say this is bad, "build it and they will come" is bs and has never worked. you gotta PUT YOURSELF OUT THERE!
most of the time its a gamble for me
hi, sorry if i wrong channel, i want ask, how to get the server count?
do bots have to be verified?
main file:
let builder = new Builder(interaction);```
builder.js file:
```js
class Builder {
#interaction;
#ranking = {
Bronze: ":Bronze:",
Silver: ":Silver:",
Gold: ":Gold:",
Diamond: ":Diamond:",
Platinum: ":Platinum:",
Ace: ":Ace:",
Grandmaster: ":Grandmaster:",
Legend: ":Legend:",
};
constructor(interaction) {
this.#interaction = interaction;
console.log("builder has been created");
}
let me guess i should use export class? Currently giving error: builder not defined, yet it's shown in the vsc suggestion menu...
i thought that it had the same way of creating a class as in java
So if i understand it correctly, first export the class, import it in the main and then instiantate a new class.
I need help!
I don't know why it does that
It is super strange why it doesn't switch
async function startFight(chara, aimedChara) {
// let action_chara = new ActionAPI(chara._id, interaction.guildId);
// let action_aimedChara = new ActionAPI(
// aimedChara._id,
// interaction.guildId
// );
// let chara_speed = (await action_chara.getStat("speed")) || 0;
// let aimedChara_speed = (await action_aimedChara.getStat("speed")) || 0;
async function repeatCallback() {
if (!tour) {
await damage(aimedChara, chara, repeatCallback);
tour = 1;
return;
}
await damage(chara, aimedChara, repeatCallback);
tour = 0;
}
interaction.deleteReply();
async function damage(attacker, receiver, repeatCallback) {
let actionApi_attacker = new ActionAPI(
attacker._id,
interaction.guildId
);
let actionApi_receiver = new ActionAPI(
receiver._id,
interaction.guildId
);
let damage = await actionApi_attacker.getStat("damage");
let receiver_health = await actionApi_receiver.getStat("health");
let receiver_resistance =
(await actionApi_receiver.getStat("resistance")) || 0;
if (!damage || !receiver_health)
return interaction.editReply(
":x: Couldn't fight: No damage and health stats defined."
);
let crit_chance =
(await actionApi_attacker.getStat("crit_chance")) || 0;
let crit_perc = (await actionApi_attacker.getStat("crit_perc")) || 0;
let crit_value = 0;
if (crit_chance && crit_perc) {
if (Math.random() < crit_chance / 100) {
crit_value = (1 + crit_perc / 100) * damage;
}
}
let resist_val =
(crit_value ? crit_value : damage) - receiver_resistance;
resist_val = resist_val < 0 ? 0 : resist_val;
let final_health = receiver_health - resist_val;
final_health = final_health < 0 ? 0 : final_health;
await actionApi_receiver.setStat("health", final_health);
interaction.channel.send(
`**${attacker.name}** attacks **${receiver.name}** ${
crit_value ? `(EFFECTIVE!)` : ""
}, they loose :heart: ${resist_val} Health (Current health: ${final_health})`
);
if (final_health === 0) {
let max_health_receiver = await actionApi_receiver.getStat(
"max_health"
);
let max_health_attacker = await actionApi_attacker.getStat(
"max_health"
);
await actionApi_receiver.setStat("health", max_health_receiver);
await actionApi_attacker.setStat("health", max_health_attacker);
return interaction.channel.send(
`**${receiver.name}** has been defeated!`
);
}
await repeatCallback();
}
await damage(aimedChara, chara, repeatCallback);
}
the tour variabe is outside the startFight function, and inside it doesn't work too
Alright I found a fix, now, tour switches 1 to 0, 0 to 1 in the damage function
Idk what tour is supposed to be but if you’re using 1 and 0 as falsey variables it’s best to just use false and true
1 is faster to write and 0 too
tour is a french word, but don't know how to translate in english
Okay it's a round or turn
Ah so it switches turns basically?
yup
then why don't you make it recursive?
so in your damage function you do like:
function damage(dealer, receiver, ...) {
...
// Deal damage
if (receiver.health <= 0) {
// Do stuff when receiver died
} else damage(receiver, dealer, ...);
}
Uh
I didn't know how to switch parameters
Thank you
calculate the stats before the damage function because now you're calling the api like 20 times
when you only need to do so 2 times
It's what I'm doing
I just get damage, resistance, health first, then calculate, then just change the health stat
Yes because it changes
why not save it to the dealer and receiver object and then only save it after someone dies
this way if the bot crashes, the user's don't lose health
Aahh
and you save yourself api traffic
Alright I see
I mean it's fine how you're doing it
So i just create a local variable ?
or save it to the objects of the dealer and receiver
like dealer.currentHealth or something
No because dealer and receiver are instance of class using the db
mmmh well yeah you could make local variables
class ActionAPI {
constructor(chara_id, guild_id) {
this.chara_id = chara_id;
this.guild_id = guild_id;
}
static async leave(chara_id) {
charaStats.deleteOne({ chara: chara_id });
}
async updateStats() {
let charaapi = new CharactersAPI(null, this.guild_id);
let chara = await charaapi.getChara(this.chara_id);
let level = await charaapi.getLevel(this.chara_id);
let guildapi = new GuildAPI(this.guild_id);
let actionapi = new ActionAPI(this.chara_id, this.guild_id);
let stats = await guildapi.allStats();
for (let stat of stats) {
let doTheThing = async (starter_value) => {
if (!(await actionapi.getStat(stat.type)))
return this.giveStat(
stat.type,
starter_value + level * stat.multiplier
);
await this.setStat(
stat.type,
Math.ceil(starter_value + level * stat.multiplier)
);
};
let statsSpecies = stat.species;
if (!(stat.type === "health")) {
if (!statsSpecies) return doTheThing(stat.starter_value);
let statSpecies = statsSpecies.find((s) => s._id.equals(chara.species));
if (!statSpecies) return doTheThing(stat.starter_value);
doTheThing(statSpecies.starter_value);
}
}
}
async getBonusStat(type) {
let resultAll = await this.getAll();
let result = resultAll.find((r) => r.type === type);
return result ? result.bonus_value : undefined;
}
async setBonusStat(type, bonus_value) {
if (await this.getStat(type))
return charaStats.updateOne(
{ type, guild: this.guild_id, chara: this.chara_id },
{ $set: { bonus_value } }
);
}
async getStat(type) {
let result = await charaStats.findOne({ type, chara: this.chara_id });
return result ? result.value : undefined;
}
async giveStat(type, value) {
return await charaStats.insertOne({ type, value, chara: this.chara_id });
}
async setStat(type, value) {
return await charaStats.updateOne(
{ type, chara: this.chara_id },
{ $set: { value } }
);
}
async getAll() {
return await charaStats
.find({
chara: this.chara_id,
})
.toArray();
}
}
but when switching between receiver and dealer it might be hard
Nope
just chara1 and chara2 variables
yea you could do it like that
how I do it in my rpg bot is I call my db and then create a class like so:
let profileData = await db.get(...);
let profile = new profile(profileData);
class profile {
constructor(data) {
this.health = data.health
...
}
}
Well it's a bit more complicated
but you get the gist
this way I have class representations of the players
and can change them like this
then you can add a .save method to save the profile
but it's a suggestion right
because how you are doing it is also fine
it'll just introduce the need of extra local variables
how are you implementing it?
what does the _ after a variable name mean?
after, no clue, but if it's before it it usually means that the parameter isn't being used
No, it's just for mongodb
oh you're talking about the mongo
i've seen it used in many programs
like variable_ = ...
instead of do like: db.findOne({_id: id}), I'm just doing db.findOne({_id})
async function damage(attacker, receiver, repeatCallback) {
let actionApi_attacker = new ActionAPI(
attacker._id,
interaction.guildId
);
let actionApi_receiver = new ActionAPI(
receiver._id,
interaction.guildId
);
let damage = await actionApi_attacker.getStat("damage");
let receiver_health = await actionApi_receiver.getStat("health");
let receiver_resistance =
(await actionApi_receiver.getStat("resistance")) || 0;
if (!damage || !receiver_health)
return interaction.editReply(
":x: Couldn't fight: No damage and health stats defined."
);
let crit_chance =
(await actionApi_attacker.getStat("crit_chance")) || 0;
let crit_perc = (await actionApi_attacker.getStat("crit_perc")) || 0;
let crit_value = 0;
if (crit_chance && crit_perc) {
if (Math.random() < crit_chance / 100) {
crit_value = (1 + crit_perc / 100) * damage;
}
}
let resist_val =
(crit_value ? crit_value : damage) - receiver_resistance;
resist_val = resist_val < 0 ? 0 : resist_val;
let final_health = receiver_health - resist_val;
final_health = final_health < 0 ? 0 : final_health;
await actionApi_receiver.setStat("health", final_health);
interaction.channel.send(
`**${attacker.name}** attacks **${receiver.name}** ${
crit_value ? `(EFFECTIVE!)` : ""
}, they loose :heart: ${resist_val} Health (Current health: ${final_health})`
);
if (final_health === 0) {
let max_health_receiver = await actionApi_receiver.getStat(
"max_health"
);
let max_health_attacker = await actionApi_attacker.getStat(
"max_health"
);
await actionApi_receiver.setStat("health", max_health_receiver);
await actionApi_attacker.setStat("health", max_health_attacker);
return interaction.channel.send(
`**${receiver.name}** has been defeated!`
);
}
if (!tour) {
tour = 1;
await damage(receiver, attacker);
} else {
tour = 0;
await damage(attacker, receiver);
}
}
}```
what is repeat callback?
Using an underscore (_) in front of variable names is a convention often used in programming languages to indicate that a variable should be considered private or internal to a class, module, or function. It's not a strict rule enforced by the language itself, but rather a convention that developers follow to signal the intended visibility and usage of a variable.
Also you don't need to use the tour anymore
Oh it's right
like this
if (final_health === 0) {
let max_health_receiver = await actionApi_receiver.getStat(
"max_health"
);
let max_health_attacker = await actionApi_attacker.getStat(
"max_health"
);
await actionApi_receiver.setStat("health", max_health_receiver);
await actionApi_attacker.setStat("health", max_health_attacker);
return interaction.channel.send(
`**${receiver.name}** has been defeated!`
);
}
damage(aimedChara, chara);
I'm using clause guard
I'll try it
But I think damage function inside the damage function will be undefined
It wont be
in a recursive call?
It won't. It's inside its own scope.
thank you sir!
thank you sir!
np
But intellisense tells it's undefined
show code of what you've done rn cuz it shouldn't be.
Wait
I know why it was undefined the damage func inside the damage function
I had a variable called damage
@tulip ledge Actually, the idea I proposed for the health update is not valid
async function startFight(chara, aimedChara) {
let action_chara = new ActionAPI(chara._id, interaction.guildId);
let action_aimedChara = new ActionAPI(
aimedChara._id,
interaction.guildId
);
let attacker_damage = await action_aimedChara.getStat("damage");
let receiver_resistance = (await action_chara.getStat("resistance")) || 0;
let crit_chance = (await action_aimedChara.getStat("crit_chance")) || 0;
let crit_perc = (await action_aimedChara.getStat("crit_perc")) || 0;
// let chara_speed = (await action_chara.getStat("speed")) || 0;
// let aimedChara_speed = (await action_aimedChara.getStat("speed")) || 0;
interaction.deleteReply();
async function damage(attacker, receiver) {
let action_receiver = new ActionAPI(receiver._id, interaction.guildId);
let receiver_health = await action_receiver.getStat("health");
if (!attacker_damage || !receiver_health)
return interaction.editReply(
":x: Couldn't fight: No damage and health stats defined."
);
let crit_value = 0;
if (crit_chance && crit_perc) {
if (Math.random() < crit_chance / 100) {
crit_value = (1 + crit_perc / 100) * damage;
}
}
let resist_val =
(crit_value ? crit_value : attacker_damage) - receiver_resistance;
resist_val = resist_val < 0 ? 0 : resist_val;
let final_health = receiver_health - resist_val;
final_health = final_health < 0 ? 0 : final_health;
await actionApi_receiver.setStat("health", final_health);
interaction.channel.send(
`**${attacker.name}** attacks **${receiver.name}** ${
crit_value ? `(EFFECTIVE!)` : ""
}, they loose :heart: ${resist_val} Health (Current health: ${final_health})`
);
if (final_health === 0) {
let max_health_receiver = await actionApi_receiver.getStat(
"max_health"
);
let max_health_attacker = await actionApi_attacker.getStat(
"max_health"
);
await actionApi_receiver.setStat("health", max_health_receiver);
await actionApi_attacker.setStat("health", max_health_attacker);
return interaction.channel.send(
`**${receiver.name}** has been defeated!`
);
}
}
damage(aimedChara, chara);
}
Bruh it's not correct
async function startFight(chara, aimedChara) {
// let chara_speed = (await action_chara.getStat("speed")) || 0;
// let aimedChara_speed = (await action_aimedChara.getStat("speed")) || 0;
interaction.deleteReply();
async function damage(attacker, receiver) {
let action_receiver = new ActionAPI(receiver._id, interaction.guildId);
let action_attacker = new ActionAPI(attacker._id, interaction.guildId);
let receiver_health = await action_receiver.getStat("health");
let receiver_resistance =
(await action_receiver.getStat("resistance")) || 0;
let attacker_damage = await action_attacker.getStat("damage");
let crit_chance = (await action_attacker.getStat("crit_chance")) || 0;
let crit_perc = (await action_attacker.getStat("crit_perc")) || 0;
if (!attacker_damage || !receiver_health)
return interaction.editReply(
":x: Couldn't fight: No damage and health stats defined."
);
let crit_value = 0;
if (crit_chance && crit_perc) {
if (Math.random() < crit_chance / 100) {
crit_value = (1 + crit_perc / 100) * damage;
}
}
let resist_val =
(crit_value ? crit_value : attacker_damage) - receiver_resistance;
resist_val = resist_val < 0 ? 0 : resist_val;
let final_health = receiver_health - resist_val;
final_health = final_health < 0 ? 0 : final_health;
await action_receiver.setStat("health", final_health);
interaction.channel.send(
`**${attacker.name}** attacks **${receiver.name}** ${
crit_value ? `(EFFECTIVE!)` : ""
}, they loose :heart: ${resist_val} Health (Current health: ${final_health})`
);
if (final_health === 0) {
let max_health_receiver = await action_receiver.getStat("max_health");
let max_health_attacker = await action_attacker.getStat("max_health");
await action_receiver.setStat("health", max_health_receiver);
await action_attacker.setStat("health", max_health_attacker);
return interaction.channel.send(
`**${receiver.name}** has been defeated!`
);
}
}
damage(aimedChara, chara);
}
@eternal osprey
This one may be correct
This one is incorrect because, when parameters changes, action_chara and action_aimedChara don't
Also, in js it's not really common to use variable_name but camelCase: variableName.
okay mr convention
well in c you tend to use snake case
hence i use it in js too
(sometimes)
Same
I know, me too that's why i used it as well for a long time but apparently it's a js convention to use camelcase.
If it ain’t broke, don’t fix it xD
oke


terrible mindset
promotes resistance to change and advancement

It just makes sure you don’t break anything that isn’t broke xD
in js we only have classes, hence only support extends right?
no interfaces nor implements?
is typescript hard to learn?
Thats weird because both variables are tied to the parameters
So if the parameters switch so should these variables
Hard to learn no, hard to master definitely
Oh it's because I redefine the parameters in the damage function
it's because the parameters are defined in the async startFight
but when you call a new damage, it's undefined the 2nd time as you do not call the startFight again.
Try passing these parameters explicitly to the damage and try again. That should work.
What no
He calls it in the damage function
So they are defined
Personally i don't think it has access to the parameters in the outer function but i could be wrong... trying can never hurt right.
Yeah
typescript is literally so cursed
you worry more about types than actual programming
because its a messy layer over javascript
i think so anyways after using it
you still have to use the any type in a lot of instances
bc some js features that make things easier or faster arent very strictly typed
also annoying to get a project up and running since you have to fiddle with a tsconfig which beginners likely would struggle with
If ur not good at ts yeah I rarely use any
what are you saying 😠
I never use any in ts
Use like :
function name<T>(param:T) {
return param
}
name("string") // return type= "string"
so you will get the type of the passed parameter
replace the any type by that
This applies to almost all prog langs
But I do agree ts has a weird syntax
i guess but in languages like c and c++ it feels more integrated and kinda more seamless i guess
since everything has to be typed anyways
well c++ is questionable in that regard considering their weird std types but in general
i dont use like 99% of the modern c++ functions and features
i would use c if it wasnt for the lack of classes and some helpful algorithms
if im stepping into that territory id rather use a higher level language like javascript
Isn't unknown supposed to be used, not any?
I mean, both can be used.
But in most cases any is used unknown is typically 'more' correct. Right?
ik it's been forever but i wanna look into this host
how like lengthy is the verification process
wdym verification
oh
like, when you buy a server don't you have to verify your identity? send your passport or other form of identification? anything like that
no
so you just buy the server and you get it?
yes
how long would you say you have to wait
30s
mine was instant
lmao
i just paid and it is up within 15s
yes
actually nevermind about that i'll just get a different one
which one aside from epyc would you recommend
what are you planning to host
lmao just a bot and a db
the sale servers are fine then
I hope so

Well I mean they are both fine but unknown makes you recast it before allowing you to do something with it so it makes it safer I guess
i read that too quickly and for a second i thought it said "unknown makes you racist"

what is "correctly"?
On the middle of the right box
you mean both on the middle?
Yes all the stats that load
wrap them in a single div and margin: auto auto
It's already in a div
I mean both in a div so they're moved as a single element
.box-2 {
display: flex;
flex-direction: row;
flex-wrap: wrap;
margin: auto auto;
gap: 5px;
width: 30%;
}
.box-2 p {
border: 1px solid #ebd4cb;
padding: 7px;
height: 30px;
}
It doesn't work
u need to wrap them in a div
that div cannot be the box itself
actually
do padding: auto auto on it
on the .box-2 ?
It doesn't move
try justify-content: center
Wait I removed wrap and it works
weird
so align-items for vertical and justify-content for horizontal
Okay
the inverse for flex column
yw
Code:
const { EmbedBuilder } = require('discord.js');
module.exports = {
name: 'avatar',
aliases: ['av'],
async execute(message, bot, args) {
let user = null;
if (args.length > 0) {
let userID = args[0];
try {
user = await bot.users.fetch(userID);
} catch (error) {
user = message.mentions.users.first();
}
} else user = message.mentions.users.first() || message.author;
if (!user) return await message.reply({
content: ":Smike_x_mark: Please mention a valid user or provide a valid user ID!",
allowedMentions: {
replied_user: false
}
});
let member = await message.guild.members.cache.get(user.id);
if (!member) return await message.reply({
content: ":Smike_x_mark: The user mentioned is no longer within the server!",
allowedMentions: {
replied_user: false
}
});
let avatar = user.displayAvatarURL({ size: 2048, dynamic: true });
let embed = new EmbedBuilder()
.setTitle(`${user.username}'s avatar`)
.setURL(avatar)
.setImage(avatar)
.setColor('#00008b');
await message.reply({
embeds: [embed],
allowedMentions: {
replied_user: false
}
});
},
};```
Can anyone pls tell why my bot respond with `:Smike_x_mark: The user mentioned is no longer within the server!` when I provide a user ID?
Pls tell me how to fix
let member = await message.guild.members.cache.get(user.id);
why is it async ?
.get is not async
let member = await message.guild.members.fetch(user.id);
Here:
use .parsedUsers instead of .users
It works every times, message.mentions.users.first() never works for me
Here:
User may not have already started a DM
so use await message.guild.users.fetch(userID)
@jaunty basalt
the, user and member variables are the same thing, then use one of them. And as it returns a GuildMember instance, to get avatar url is: member.user.displayAvatarURL()
Haha 😬
User and member are completely different, member is a guild member it contains properties like joined at and nickname and permissions while user contains properties of the discord account like username, avatar, created at etc
I know but no need of the getting an user with bot.users, it never works except if the bot DMed the user, the user will be in the cache
member.user.id
is the same thing as user.id
and member is cached, member.user too
Yeah but you said member and user were the same variable
Ah I see, but they created a member variable just to get the user
the verification of if the user exists is triggered twice
Ahh I see, it's to not get a user off the guild
Me when discord.js users has no idea about message.mentions.members to get the member version of the mentioned user
wouldn't a message mension be <@UID>
@desert verge where do you see the guild id
?
(message|interaction).guild.id
Okay but this is not a mention
for a mention you can do the same as well
wat
since, technically a mention is a message that has a pointer to other message that it responds to
await message.guild.members.fetch(message.mentions.parsedUsers.first().id)
discord.js provides a way to get the mentioned user as a member through message.mentions.members instead of having to get the user first and then to get the member version of them yourself
Discord.js is a powerful node.js module that allows you to interact with the Discord API very easily. It takes a much more object-oriented approach than most other JS Discord libraries, making your bot's code significantly tidier and easier to comprehend.
wat⅔
why would you fetch if the user object is already there
Ah then use .get
message.mentions is a separate class that holds all mentions that exist in the parent message
message.mentions has users, members, channels, everything
Yeah
you dont need to separately parse any of that because it has already been done for you
I ned to parse it for my @bot-mention to send the help command
Because it did not parse
Also parsedUsers is the same as users except that the order of the parsed users in the collection are as they appear, instead of how the API returns it
do you have caching disabled or limited or something?
Nope, but is caching disabled by default ?
no
.has() takes a key btw, not a predicate
ye mb
.has() is same as .get(), .has() it's like adding !! before to make it falsy then make this true
console.log(message.mentions)
then mention your bot
Okay
!!message.guild.members.get(userid) = message.guild.members.has(userid)
Not exactly the same, .has() only checks the key which is way more efficient when you just want to check for that, .get() not only checks the key but also gets the value, and you coercing it to a boolean like that is just wasteful
.get returns the result, .has doesnt return it, so its technically more performant
ye
yup it is wasteful I know lol
I was just saying
wtf was I just reading
I have no idea
old man
Does it look good on mobile?
why the red
Idk I chose red
what is the better color for roleplay ?
green ?
Like plants?
I'll change the logo, so maybe change the color
how to convert text to an hexadecimal color (@ me)
Did you search for that on stackoverflow ?
Im sorry what
text?
example?
maybe a string
string containing hexadecimal
Well I think, no need to convert
context ?
Only thing I can even think of is having a db of colors and their hex value and then when someone says “blue” it goes and grabs the hex.
oh ok
colors go brrr
There are too many to even make your own database of colors
and something like that will highly likely end up being a paid api or a shitty api with shit rate limits anywhere else
I mean very true, but just thinking of the basic colors, a simple json db or hell even defining them within the js file itself would be fine. No library needed. But i guess for convenience sake chroma-js probably does the job fine.
Could probably go buy one of those giant paint swatches with like every single color ever in them and manually type them out lmao
Or use computer vision to automate the process
you want to make customizable the embed color ?
You can still put the name of the color
and hex
yes, but for french people too so i need to translate english to french if i use a module
Oh it's not convenient if we need an api key
sorry
A ever did a deepl lib using puppeteer, but don't know if it works
how do i override a method in js?
Look into i18n libraries for translations
<obj>.method = () => {}
thx all
Or if you’re talking built in you like string.replace you do so with string.prototype.replace for example
I meant oop.
Like i have a class that inherits a super class, but want to change one of the inherited methods
You just implement the method in the subclass that inherits the other class
class parent {
foo() {
return “bar”;
}
class child extends parent {
foo() {
return “hello”;
}
}
Sorry for bad formatting am on phone
Oowh i see!
I was thinking with java where we must use @override
so i thought there would be a method in js as well
you don't actually have to use @override in java, hence why it's an annotation and not a language keyword
It's required yes, but even if u don't include it it's inferred
it's best practice to use it because the compiler can tell that fooo isn't a method on the parent class
so it'll know that you done fucked up
Yes, it's not required to write it, cuz the compiler can infer it
Just like semicolons in js
the compiler isn't "inferring" the annotation exists
I mean the override itself, not specifically the annotation
Yes
because java doesn't have a keyword to explicitly override a method (unlike say C# which does)
I somewhat like the annotation approach
class A {
public virtual void Foo() {}
}
class B : A {
public void Foo() {}
}
``` in C# for example you'd get a warning here
(also in C# you have to explicitly mark stuff that can be overridden with virtual forgot about that)
Another thing that's pretty neat is the @Contract annot
but the warning tells you to either override it or to mark it as shadowing the A.Foo() method with new
class A {
public virtual void Foo() {}
}
class B : A {
public override void Foo() {}
}
class C : A {
public new void Foo() {}
}```
i quite like that approach
huh those look neat
yep, reeeeeally nice to flag possible nullability or immutable methods
there are a bunch of jetbrains annotations too for documentation
like @Range
the compiler takes them into account too
Where can I find https://discord.js.org/#/docs/discord.js/main/typedef/BaseMessageOptions in the Discord object hierachy?
I want to use it for jsdoc param type
How do I access it from jsdoc type though?
anyone know why boostrap nav hamburger doesnt work? First i throught it was my code then i codied it exact but nothing happens when i press it
on computer it works fine, but when u go on mobile view -> press hamburger nothing happens
my code is exact same so im not sure if im missing something, using cdn
everything else on boostrap is working fine so far
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
I have the feeling you need JS
One message removed from a suspended account.
One message removed from a suspended account.
is that going to solve my problem ?
Is it normal to have had this message for more than 5 days?
Buy a server. 🤷
You'll eventually need a server
No like, really, there's an upper cap you'll hit regarding host capacity, no matter how efficient your code is
Replit ceiling is really low
I mean, there are hosts for like $7
But yeah, 13 is too early
Btw, I noticed u have a green name, I'd be wary about getting too many servers too fast
Else you might get capped at 100 due to inorganic growth
I wish I had that problem tho lol
If ur under 100, u definitely dont
Theres a high chance of being declined during verification
No, not much u can do now
Just dont advertise it
And pray people don't notice it too much
At least until discord verification
Are u developing ur bot by yourself or following a tutorial/template?
You'll need to fill a form at 76 servers, make sure u pay attention to what you code
Especially regarding stored data
Privacy reasons
You'll need to justify what and why you're storing
Like username or messages
Or general activity
I'd shouldn't matter much, as it's anonymous enough
But you'll still need to explain what u use it for regardless
you dont have to disclose IDs iirc since theyre not personal info
yeah message content is something to consider
Discord will give u some (superficial) info on what u need to answer when the time comes
If you're storing it for a reason and a user consents to storing it then you can store it as long as it's encrypted during transit and rest
Not too complicated, but people who blindly follow tutorials/guides often get stuck at it
Cuz they can't answer what they didn't develop
If ur coding yourself you'll be fine
Encryption is a really general term tho as long as ur using https and have a password on ur db you should be fine
If it's stored locally dw about it
Please learn a database
Just make sure non-devs of your bot cant access it
It’s better
DB scales more and is generally better though
Json is very prone to corruption, and heavily bottlenecks your I/O throughput
It's fine for read-only data, but a nono for read/write
You don't technically need a db at 13 servers but it's good to have, plus corruption
I got 49 servers, all of it is in MongoDB
Also I bet discord won't accept a "I use json as a database" answer in the form
They dont rly care how you store it as long as its secure
Sqlite is a very beginner-friendly database
Little setup, little data types to worry about
Veeeeery simplified queries
Mine is, it’s under my bed
Exactly
also im school nerd so no one will anyways
But MongoDB is easy and secure database anyone can use.
I'm attempting to remove channel permissions from a discord user. Right after removal it seems to be given immediately back. The channel dissapears from the user's perspective and immediately comes back. It doesn't seem to be giving the permissions back anywhere. Is there some setting i'm missing?
Code to remove permission:
VoiceChannelManager manager = voiceChannel.getManager();
for (SummonerInfo summoner : replacedSummoners) {
manager.putMemberPermissionOverride(summoner.getDiscordId(), null, permissions).queue();
}
I advocate for sqlite, as it can be easily ported to postgres once you get enough data flow
Make sure you're not running 2 instances
SQLite also stores data in a file doesnt it
And that there's no other bot to intervene
if my bot gets bigger i will make sqlite database but until then im using MongoDB
Well, all databases do
Well yeah but sqlite stores it in 1 file
No no, if it gets bigger u go straight to postgres
Sqlite isn't enough for big data
Any will do, what I mean is that all databases boil down to a file holding data
Mongo is different to sql databases, kinda like 2 sides of a coin
nah it’s just like 2 face from batman
Both are fine, it's just a different flavor
A thing to take into account, is that mongo is terrible if you're dealing with relationships
As mongo isn't meant for that
I'm only running one instance.
Then check if any other bot is interfering
Some bots have a similar feature, to prevent griefing
ty for the suggestion. I'm running in an empty server, no other bots
Where are those? Are you just talking about logging I've put into the bot?
And reset the token, just to be sure there's no ghost instance running around
Server settings -> audit logs
ty
:root {
background-color: black;
}``` is in /public/base.css https://pastebin.com/pjzjaKs3
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
any idea why my css doesnt show?
^ booststrap is overriding my css for some reason still looking for fix
body {
background-color: black;
}
Try this
And show me the code of where you are serving the public folder
@covert ingot
Hello I need help!
bot.better-roleplay.xyz redirects to my ip:port of my bot server which have a webserver for requests
What can I use to allow the connection ? I'm using express
Well, I have different message
Can a sub command have sub commands in terms of slash commands?
I don't think so
Of course, if I understand the documentation correctly and what you want to do
Anyone knows how to remove the effect that framer-motion (shakes when the animation finishes)
I know it's a default thing
Sub commands cannot have other sub commands
if you make it a subgroup it should no?
command -> subgroup -> subcommand
i love how running "npm i ffmpeg-static" has now made literally every command of my bot not load anymore
Because you're using require for esm modules. You MUST use import
idfk. The whole CJS vs ESM thing is so dumb and some modules only support ESM because it's supposedly better, but actually divides the node ecosystem more
wait is this cuz npm updated the chalk package on my system
Some npm modules only supports use of import
you can use the import statement in CJS
been battling that for years. I just copy paste an older version of chalk and use that
lemmy just revert it and see if that fixes it since everything in my bot uses it
yeah its chalk being useless
lets just delete it cba to use 20 mb of dependencies just to make my cli coloured
i can just use ANSI
cheers for the help tho
got this error
I ran npm i sodium
and then got this error
what does any of that mean
since its not understanding make Im guessing that there is a compiler missing somewhere
but thats about all i can make out
Alright just making sure, didn't wanna not support a feature in my framework

I have a bot which when I enter the token and execute the code sends an error and when I try the token from another bot it works perfectly.
Then your token is invalid
and the strangest thing is that it is only with one code, when I put the token in a different code it works fine.
can discord block the connection directly to a specific code?
what happened to me is that precisely because of that code they sent me this message
"It appears your bot, has connected to Discord more than 1000 times within a short time period. Since this kind of behavior is usually a result of a bug we have gone ahead and reset your bot's token."
And as I said, only with that code it sends me an error when trying to connect with the bot, but with other codes the bot works perfectly.
It doesn't make much sense. Apparently in this code your token is not changed because the token has nothing to do with the bot code
It's just a string that tells discord what bot wants to access the api
They can't access your bot's code via a token, and they can't "ban" your bot code
If you could send the error, it would probably be easier to locate the problem
ooh ok
at new Guild (/home/runner/whatai2/node_modules/eris/lib/structures/Guild.js:110:78)
at Collection.add (/home/runner/whatai2/node_modules/eris/lib/util/Collection.js:41:19)
at Shard.createGuild (/home/runner/whatai2/node_modules/eris/lib/gateway/Shard.js:1445:40)
at Shard.wsEvent (/home/runner/whatai2/node_modules/eris/lib/gateway/Shard.js:650:38)
at Shard.onWSMessage (/home/runner/whatai2/node_modules/eris/lib/gateway/Shard.js:1721:26)
at ws.onmessage (/home/runner/whatai2/node_modules/eris/lib/gateway/Shard.js:1598:33)
at WebSocket.onMessage (/home/runner/whatai2/node_modules/ws/lib/event-target.js:120:16)
at WebSocket.emit (node:events:513:28)
at WebSocket.emit (node:domain:489:12)
Emitted 'error' event on Client instance at:
at Shard.emit (/home/runner/whatai2/node_modules/eris/lib/gateway/Shard.js:1882:26)
at ws.onmessage (/home/runner/whatai2/node_modules/eris/lib/gateway/Shard.js:1601:22)
at WebSocket.onMessage (/home/runner/whatai2/node_modules/ws/lib/event-target.js:120:16)
at WebSocket.emit (node:events:513:28)
at WebSocket.emit (node:domain:489:12)
at Receiver.receiverOnMessage (/home/runner/whatai2/node_modules/ws/lib/websocket.js:720:20)
at Receiver.emit (node:events:513:28)
at Receiver.emit (node:domain:489:12)
at Receiver.dataMessage (/home/runner/whatai2/node_modules/ws/lib/receiver.js:414:14)```
and exactly the same code only with the token of another bot
Ready!```
then something is going wrong with your code
if it has reconnected over 1,000 times in a short space of time, that means there is an issue in your code that is causing it to repeatedly restart iself
my bot had that when i used discord.js on a next.js site, it kept reconnecting and caused it to auto reset token
It says it right there:
npm ERR! /bin/sh: line 1: make: command not found
You simply don't have Make installed
You can run sudo apt install make to install it if you're using a Linux distribution that uses the APT package manager (like Ubuntu or Debian), or install it with the package manager of the other Linux distributions
If you're using Ubuntu or Debian (or anything that's based on them) I'd recommend installing the build-essential package using the APT package manager, which will install everything needed for proper compilation and stuff
that has nothing to do with the token
it appears there's a bug when trying to cache a guild, where the cache itself is missing
did u modify anything related to cache?
for those using contabo, is contabo steal still a problem or am i stuck in 2020
i find their network slow
My node was offline for 9 hours while engineers and the panel said everything is ok, yet another node in the same datacenter worked okay
Not been an issue since infrastructure change
At least not for me
Does discord allow a slash command to autocomplete based on which option within the command you chose? Example:
options: [
{
name: "category",
description: "Get a list of commands within a category",
type: 3,
required: false,
autocomplete: true
},
{
name: "command",
description: "The command you need additional help for | Max 25 show at once, type to filter",
type: 3,
required: false,
autocomplete: true
},
],
//missing code here to shorten the chat spam
autoComplete: async (client, interaction) => {
switch (interaction.options._hoistedOptions[0].name) {
//._hoistedOptions[0] is the closest thing I can figure out but leads to weird issue if category is selected then command. Command shows the autocomplete of category.
},
There is an options Array, so it's up to you to return suggestions based off other options present
Ah. You're using a wrapper
You may want to consider using raw representations or alternatively, logging the interaction
But I'm sure wrappers find cheeky ways to obscure info from you with getters and the likes
Yeah, the code atleast the structure isn't mine but a slash template if you will. So compared to how others do their slash commands mine looks more like...
module.exports = {
name: "ping",
category: "General",
description: "Replies with bot ping!",
usage: [`/ping`],
example: [`/ping`],
type: 1,
options: [],
permissions: {
DEFAULT_MEMBER_PERMISSIONS: "SendMessages"
},
run: async (client, interaction, config, db) => {
//stuff
};
Are localizations in things like names and descriptions limited to only what discord supports or can you use stuff like i18n to determine this kind of things?
Only what discord supports in user settings > language
but thats already a lot of languages
smh
Indeed, but discord still lacks support for a small number of them
I guess its enough for now
yeah true
i mean if it supported custom languages how would it know which one to show you
Honestly discord should let localization be handled by the dev
It kinda can
It's fine if its a client side thing, but I feel some control should be left to the developer, as a lot of communities that would benefit from a localized bot would wanna set the language to be for them.
British english doesn't have to be British english in the code side
it can be lol catz
lmao
I mean guild commands exists
but registering ones for each server it joins is kinda a hassle
Loading commands for a specific guild each time is api spammy
yea
which is why i18n should be left up to the developer to handle in some cases. If anything allow there to be an option where a dev could integrate their own system if they wanted. Which mind you is a very difficult thing understandably
Hold up im in phone lemme browse my github how I did it
let focusedOption = payload.options.getFocused(true)
Then you can compare the focusedOption based on the option
If you want subcommands you do payload.options.getSubcommand()
If you want a specific option you can use payload.options.get(“option”).value
@craggy pine
any idea why bootstrap is overriding my css ? https://paste.gg/p/anonymous/d6d1b353ec8f4ae6b5e6d0a7f1b7c960
what's :root supposed to be?
also ur html structure is wrong
I suppose that's supposed to be for your bot's long description yeah?
no not for a bot, n wym my html structure wrong. :root is root ? when i uncomment bootstrap link style background goes back
for a bot? a site u mean?
ok, but is it for a site?
yh
then your html is very wrong
<html>
<head>
...
</head>
<body>
...
</body>
</html>
this is the correct html structure
what?
my html is right now, was structure the only thing that was wrong? if so i fixed it, thats just the base file, so i include that at the top of every file. its ejs
but still, bootstrap is overriding my css n i have no idea why
maybe, idk how your actual html looks like
styles must always be inside head
elements inside body
and idk what :root is supposed to be
ok but WHAT is root?
either way, it works the way it does. ive used it before n it works perfectly well for me that way im doing, but this is my first time using bootstrap
bootstrap is usually used with html, not ejs
not sure if they work together as ejs has its own generator
why do you need boot?
for the styles?
yeah
Someone know a bot which has an api for making addons ?
explain what you mean by addons
dev api to add functionalities to the bot
so, you mean a bot where you can develop addons for?
that'd be a security risk I think
and I mean, discord uses an api to make bots??
isn't that what you want?
I know, but... like we need a key to use the api, and no full access to the db, just like, only guild, a key would be assigned to a guild
To verify the user, just use discord oauth2
well, no access to the db would be hard to do as you can literally access anything on their vps/pc using the eval function
So you mean something like shared hosting but using bot
I think that if it exists, it would have very very limited access
Well no because the value of the eval must be a function, and there will be a special npm lib for doing requests
because iirc theres a limit on how many slash commands a bot could have
It will be a thing like that:
/addon [addon_name] [parameters]
It will just look like a command using message.content
I don't think I'm getting what you want
Me too
This is to execute an addon
so you want to develop a command for a bot that's not yours?
then you still need a function no?
Noo!
and in that function you can put an eval command
If people want to add more functionalities to my bot
Can't they just contact you so you can add it to your bot?
pfff, yeah I'm trying to do without eval
I mean what you could do is create your own addons and allow users to enable/disable them
if that's what you want
No
because if you give anyone the freedom to add anything to your bot, you will get people who can and will abuse it
I want to let people create their own addons on my bot
why do you think that you can't upload a bot to top.gg if your eval command is not admin locked?
Yea, they gonna abuse it
I will not use eval
but
people will be able to put eval in their code
when they create their own addons
that's what I'm trying to tell you
you know you don't need to type a function name to execute the function right?
....
You don't know how it will look like
The addon will be hosted
The bot will retrieve the content of the file
Parse it
Use the special npm lib
So you are gonna make file for every addon?
I'm trying to tell you that it's a huge security risk
A file ?
No the file is hosted on their own server
In the db there will be the list of addon urls
I know
I'm thinking
the reason I chose to develop on dc is so I don't have to worry about security risks
and now you're planning on introducing one yourself
It's a very strange concept
yeah
the npm lib, is just doing http request to my bot, so they won't have access to my client class
so how are you planning on replying to interactions then?
what will people be able to do with it then?
if they can't access any data
They will have access
they won't have access to my client class
To what they really need
like what
Well i don't know how to expain but I can show a demo code
to what will look like the addon
let Addon = require("brp-addon");
let addon = new Addon(api_key, "avatar");
addon.on("execute", async ({interaction, api, user, params})=> {
let chara = await interaction.awaitCharacter(user.id);
interaction.send(chara.avatar);
})
Finally, I think, the addon don't need to be hosted
Just need to register
you're giving them access to the db
Okey so you can access interaction.client no?
No because interaction is my own class
I put the methods I want
Dude....
Who want to put the true interaction class ?
nope, not really
it is the wrapper api of the bot
so you want to make a sub-api basically
you receive event, check registered addons, send event to addon, which resides in the users pc or host, the user runs logic and responds to you, and you respond to discord?
why are you calling that db ;-;
YES EXACTLY
doable
but
you will be responsible for what the user responds
so for example if they send slurs and shit, you might be affected
Well, the addons would have to be approved to be global
you dont need to give them access to yiur db
they can run their own db on their end
Yep but my bot is a roleplay bot, so they can register characters, stats, etc
They need access to that
ah
in my bio there is the link
so yeah youll need a layer of abstraction for that
yup
let Addon = require("brp-addon");
let addon = new Addon(api_key, "avatar");
addon.on("execute", async ({interaction, api, user, params})=> {
let chara = await interaction.awaitCharacter(user.id);
interaction.send(chara.avatar);
// Use api like:
let charas = await api.getCharas(user.id) // There is no confidential informations in a chara object.
// params
if(params[0]) {
let user_id = parseMention(params[0]);
// etc.
}
})
I would rather stick with the good old database and the /register-character command or something like that
how do I get the blue developer badge ?
not possible anymore
Yup I just googled it
export abstract class Command {
name: string;
description: string;
nameLocalizations: LocalizationMap | null;
descriptionLocalizations: LocalizationMap | null;
options: Array<ApplicationCommandOptions>;
nsfw?: boolean;
constructor(options: ICommandOptions) {
this.name = options.name;
this.description = options.description;
this.nameLocalizations = options.name_localizations;
this.descriptionLocalizations = options.description_localizations;
this.options = options.options;
this.nsfw = options.nsfw;
}
abstract run(interaction: Interaction): void;
}
Should I actually be making it abstract sense I don't want it to be instantiated by itself but rather extended but the run method, is it something they should be overriding themselves or nah?
I do something pretty similar in my framework
You’re gonna need a run method, having it abstract is perfectly okay
Doesn’t necessarily HAVE to be optional, can just be an empty array
true, but its typescript we are talking about here
so if I don't make it optional i'll likely get the "Hey, I am getting error it saying it required but I don't need options for this command"
rather just negate that
I think discord.js automatically puts in a empty array anyway if its not supplied
if not discord itself just allows it to be absent
What does abstract class do again and what is it used for?
abstract classes are a way of outlining what you want a child class to look like, its sort of like a blueprint, they are not meant to be initalized themselves but rather to be extended on.
so with that class above I would do
class SomeCommand extends Command {
constructor(){
super({
name: 'basdas',
description: 'asdasdads'
})
}
run(interaction: Interaction) {
interaction.reply('asdasd') //dk if this is how you do it anymore but ye examples
}
}
So trying to do let cmd = new Command() would give an error
its a basic abstract class, there are some that get more complex im sure
ofc it is
I'll never match detritus but I want to give people the same feeling
I dont even bother giving them the client
as discord.js naturally has the client attached to everything 
All my code is subject to change
rn I don't have any idea in mind for sub commands
I might make different command classes like you and have one for CommandGroups
and another just for normal Commands which would be Command
Does your CommandGroup extend BaseCommandOption?
I assume it does and just sets the type to be a subcommand thingy
Anyone tried to make a Discord.js api wrapper with Decorators like what does Nextjs ?
nope
that's the thing I didn't copy from detritus
the complicated and fancy magic generics
lmao
CommandGroup is super simple
Also waffle how the fuck do I add the git repository to my shit
I forgor how to add an origin
Most of the magic is handled by my command manager and startup script
idk I haven't done that in 3 months
lol
But yeah the most "magic" I have is when loading slash commands atm ```ts
async function loadSlashCommands(client: PaperClient, options: { directory: string; excludeFiles: string[] }) {
try {
const files = fs
.readdirSync(path.resolve(__dirname, options.directory), { withFileTypes: true })
.filter(
file =>
(['js', 'ts'].some(e => file.name.endsWith(e)) && !file.name.endsWith('.d.ts')) ||
file.isDirectory(),
);
for (const file of files) {
console.log(file);
if (options.excludeFiles.some(f => f === file.name)) {
continue;
}
if (file.isDirectory()) {
loadSlashCommands(client, {
directory: `${options.directory}/${file.name}`,
excludeFiles: options.excludeFiles,
});
} else {
const ret = (await import(`file:///${path.resolve(__dirname, `${options.directory}/${file.name}`)}`))
.default;
if (ret.default instanceof Command) {
client.commandManager.addCommand(ret.default);
console.log(`Loaded command ${ret.default.name}`);
} else if (ret.default instanceof CommandGroup) {
client.commandManager.addCommandGroup(ret.default.name, ret.default);
console.log(`Loaded command group ${ret.default.name}`);
}
}
}
} catch (e) {
console.log(`Error occurred whilst loading commands: ${e}`);
}
}
This was still a work in progress when I originally worked on it, so I haven't handled comparing the differences between currently uploaded slash commands and what I have client side to avoid ratelimit issues
git remote add <name> <URL>
wtf
I have not programmed in months
so I dont understand that anymore
Does your client use the api of Discord? Or it uses the discord.js lib?

it uses the discord.js lib most likely
I doubt waffle made his own for this 
Honestly I might go back to doing my own lib and just build a wrapper around it
we'll see how this goes
https://github.com/Mistyerious/shensuo also not a plug but waffle this is what i'm currently doing
there is nothing
there is?
it is empty
i know
Yea cause I haven't done any of that yet
but the code
:C
I been working on the command/event classes themselves rn
I aint even done with Event class yet but decided to push to github before I forgor and accidentally lose progress somehow
:)
Ah nice, cheers! I didn't realise that make was its own program. I'm using fedora server and its a minimal install so makes since that its not installed. Thanks for the help!
anyone use https://datalix.eu as their host? feels wrong to bother the same guy over and over
Datalix offers a range of hosting solutions from shared hosting to dedicated servers.
djs
I didn't feel like implementing gateway shit or caching, this was just written for a bot I was writing a while back
Okayyy



