#development
1 messages · Page 1665 of 1
if (args[0] === suggest.names.en) {
return message.channel.send(embed);
}
message.channel.send(embed);``` Im trying to connect args with a string so that it will do something like this
But ofcourse that doesnt work any ideas??
Why do I get this every 5 minutes
Tho I don't have such a guild id in the json file
And that KeyError: Numbers are random every time
stop using json as your db
Bruh
that's exactly why it errored
That was not the question
?
when someone sends a message on a guild which its id isn't in the json, it'll raise that error.
Agreed. You shouldn't use json as a database.
Ik
@umbral zealot when i try changing the prefix of my server, i get this error
The key "820395515698085950" does not exist in the enmap "settings"
``` do you need the code?
literally using a JSON as a database.
I don't say its good, ok?
IK
I said I am using
Just to make the prefix change command
you're missing an ensure() or set()
Yeah ok but when you lose your entire file and all your prefixes, that'll be your fault
Ok
what do i need to ensure
Take a look at https://enmap.evie.dev/complete-examples/per-server-settings
@vivid fulcrum managed to snoop something out of that mess?
bot.settings.set(message.guild.id, value.join(" "), prefix) i already have the set()
haha yeah this is what im using
Ok but you must have forgotten something
because the error is saying you aren't using ensure() before using that set()
im not
nope, the stacktraces of MSBuild erroring out don't give any info
i dont see the ensure() in the guide though?
i can see if the full debug shows it
yeah
can you tell me what version of enmap you're using? npm ls enmap
How do i connect a args with a string ```js
if (args[0] === suggest.names.en) {
return message.channel.send(embed);
}
message.channel.send(embed);``` i want to make something like this
Can someone help
god damn, embeding links for users should be removed

u did not type this right
this is not a command
be more specific what you wanna do
oh wait nvm
npm ls enmap in your project folder will tell you what version of enmap is currently intalled
i thought it was 1s not ls
ls for list
yeah its 5.8.4
lol the thing i sent is legit the same shit
hmm
without downgrading node, can i even force it to use the older version instead/
Autoensure not working is... weird.
bot.settings.ensure(message.guild.id, {
prefix: "g.",
welcomeChannel: "welcome",
welcomeMessage: "Grelle Sutcliff greets {{user}}, welcome to the server!"
})
basically
but autoEnsure not working is very strange.
oh
@umbral zealot now i get this warning WARNING: Saving "820395515698085950" autoEnsure value was provided for this enmap but a default value has also been provided. The defaultValue will be ignored, autoEnsure value is used instead. along with the same error as before
ok I'm really confused now 
maybe i didnt put it in the right spot
Are you sure you only have one enmap?
yes
then that's real weird, it means autoEnsure is working but at the same time now
I'll have to take a look at this as a bug but unfortunately I'm at work right now and don't have time to look at such a complex problem
are you sure there cant be any other reason?
also i want to make sure, did i do this right? const [prefix, value] = args;
@umbral zealot
that looks right, yes
okay what about this, are there any errors here? ``` if(command === "setprefix" && message.member.hasPermission("ADMINISTRATOR")) {
const [prefix, value] = args;
if(!bot.settings.has(message.guild.id, prefix)) {
message.channel.send("You have no prefix for this server.");
return;
}
bot.settings.set(message.guild.id, value.join(" "), prefix)
.catch(console.error);
message.channel.send(`The prefix for this server has been changed to \`${value.join(" ")}\``);
return;
}```
@umbral zealot
I don't see how this can even possibly cause the error you had.
hmm.
hold on can you try to remove this completely ```js
if(!bot.settings.has(message.guild.id, prefix)) {
message.channel.send("You have no prefix for this server.");
return;
}
somehow I don't even think you should have that at all, tbh.
you aren't providing nearly enough context for me to answer that question
what else should I provide
(node:42040) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'join' of undefined
Uh... why do you think you need to do any "database stuff" on a different thread? Are you experiencing performance issues due to very complex or intensive database queries like complicated multiple joins, or extremely large data sets?
can you show the full error stack on that
no, my friend told me it'd be good as I'd use less ram
that's... wrong
bot.settings.set(message.guild.id, value.join(" "), prefix) do you mean this?
no I meant the full stack, but clearly value is undefined here
You won't be using less ram by threading your process. You'll be using more.
const [prefix, value] = args;
bot.settings.set(message.guild.id, value.join(" "), prefix)
.catch(console.error);
message.channel.send(`The prefix for this server has been changed to \`${value.join(" ")}\``);
return;
}```
well, this means you only provided one argument.
so why is threading a good thing then?
threading in js
Threading is only good if you actually need to use the power from multiple CPUs, because your single thread is taking the entire CPU and you need to take advantage of multiple cores. That's usually not necessary for small-ish projects, even medium sized ones.
if you were doing image processing for example, you might consider that. Or extremely large mathematical or data analysis.
But, like, an unsharded bot with a database? Nobody needs threading for that.
alright tyvm
g.setprefix - thats what i sent, how is that only one argument
well ok so why are you expecting value to be a thing then
prefix is "-" but value is undefined.
I think maybe you're a little confused.
the command itself doesnt count as an argument?
it doesn't, no.
oh
set(key, value, path) , path should be a string, btw. not prefix but 'prefix'
since you want to change the prefix path
So, set(message.guild.id, "%", "prefix") for example, would modify the prefix for that guild to "%"
im stressing over something that could be a easy fix but me being me is blinded to it my avatar line doesn't display the img just the URL how do i get it to show the IMG instead of the URL? ive tried removing URL from the call but it goesd "displayAvatar is not a function"
let av = member.user.displayAvatarURL({ format: "png"})
let memberCount = member.guild.members.cache.filter(member => !member.user.bot).size;
let rules = "800870206427627541" //Channel ID Here
const welcomeEmbed = new Discord.MessageEmbed()
welcomeEmbed.setColor('GREEN')
welcomeEmbed.setAuthor(av)
well, i want the command to change prefix for that guild, so i cant have the value be fixed like that, right?
your "value" is prefix in this case, the variable
or, args[0], basically
think about const [ prefix ] = args; as doing const prefix = args[0]; or in this case, say, const prefix = "%";
So prefix, the variable, contains a string that is your prefix value.
you don't need any other variable for this to work, that one is sufficient.
you want to change the prefix, don't you?
no
ok look
const settings = {
prefix: "$",
welcomeMessage: "Hi, welcome",
}
This is an object
prefix: "$" is a key in that object
embed.setThumbnail?
yeah
ok, so, your path is "prefix"
your value is the new prefix you want to set
and that new prefix is in the variable called prefix
let's change your code to be a bit clearer. ```js
if(command === "setprefix" && message.member.hasPermission("ADMINISTRATOR")) {
const newPrefix = args[0];
bot.settings.set(message.guild.id, newPrefix , "prefix");
message.channel.send(`The prefix for this server has been changed to \`${prefix}\``);
return;
}
does that make more sense now?
const [prefix, value] = args;
bot.settings.set(message.guild.id, prefix, "prefix");
message.channel.send(`The prefix for this server has been changed to \`${prefix}\``);
return;
}``` this should work, no?
yes, but value is still undefined here so it's not useful to have it at all
no, you only need 1 argument, wich is the new prefix
tht worked... i was to focused on why it wouldnt img to try tht
ok so i have this json list with animes that looks like this js { "id": 138, "names": { "en": "Beyond the Boundary", "jp": "境界の彼方", "ep": "12" }, "from": { "link": "https://anilist.co/anime/18153/Beyond-the-Boundary/", "type": "Anime", "time": "24 mins" }, "url": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx18153-oDqA9zQzQPOq.png" } and i have 140 different of these and i want it to make that if i type $anime {anime name} that it sends the embed message with that anime but its all string related
glad it worked 🙂
still think message.member.hasPermission("ADMINISTRATOR") is outdated
should be message.member.permissions.has("ADMINISTRATOR") now
@umbral zealot
well, you need to build the embed out of those strings
already did
is this an array or object?
object
no but like
array i believe
array with objects if im correct
btw, why are you manually collecting anime data?
Can anyone tell me the command for discord bot which tells the server name??
now we need to see your message event to see how you're getting that prefix.
bold of yall to assume he's using d.js
yeah
Ohw because i want to manualy control what people will see
or can see
wrong reply
but like
why?
you'll never be able to be on par with anime releases
let alone with 1% listed anime
Guess you could do:
let name = args[0];
let index = animeList.filter(anime => {
Object.values(anime.names).includes(name)
})
let anime = animeList[index];
// Build your embed
@dusky lagoon
holy hell no
hu
just use an object of objects instead of an array
but wasn't he using an array
probably
const guildConfig = bot.settings.get(message.guild.id);
if(message.content.indexOf(guildConfig.prefix) !== 0) {
return;
}```
but change it to object asap
looks good. Can you maybe log guildConfig and make sure you get the right prefix? that could help debug the issue
having to lookup an array for a specific anime everytime is unnecessary
C:\Users\Dev\GrellBot>node .
Grelle Sutcliff has just connected to Discord's API at Mon, 22 Mar 2021 14:44:12 GMT
{
prefix: [ '-' ],
welcomeChannel: 'welcome',
welcomeMessage: 'Grelle Sutcliff greets {{user}}, welcome to {{server}}!',
leaveChannel: 'welcome',
leaveMessage: 'Grelle Sutcliff is sad to say that {{user}} has left us here in {{server}}'
}

I'm starting to see a bit of a pattern here, which is a very unfortunate one.
I suggest you read <#development message> before you proceed.
what is it
I bet you got then from your clipboard
read what I linked, you'll see.
Yes, that's exceedingly clear.
Your way to learn coding is to be a help vampire and get everyone else to code for you?

but you don't actually learn to code by asking others how it works, you need to know the basics almost to understand more complex structures
actually, learning coding by making bots is extremely hard
You won't learn a language by listening to others speaking it.. you need to actually read into what everything means
it's like going uphill by the cliff side instead of the road
Actually it's like learning to cook while trying to make a Beef Wellington and having never used a stove, a mixer, or a knife.
ew, rare steak
or like learn to drive a vehicle without ever touching a vehicle... imagine all the dead dogs and cats being stuck in your vehicle grill
yeah i admit, its probably one of the worst ways to get into coding but i still learn a lot and believe it or not but a majority of the coding i do i figure out myself, its just in instances like these where theres a complete new set of structures that i havent really worked with before i get help, take in the information, then in the future i minimize my mistakes and i can handle more on my own
Now, in all those scenarios, it's possible to get through with proper training... Which, usually, requires you to pay the trainer
ok so "take in the information" from proper online classes
we're here to guide you and help you, not handhold you every step of the way.
And right now, you need to be guided to an appropriate online course so you learn the basics.
I feel I've heard that "I figure out myself" before
yeah right now you're not figuring out anything yourself. you're literally asking us to figure everything out for you
you're not self-learning, you're not handling things yourself, you're relying on us every minute to do things for you. That's not learning. That's being a help vampire. don't be that.
I need two servers running on my repl, one is the Hardhat Network local blockchain, the other is the actual server for my app. The problem is, I only have one node instance so running server code for one server blocks the other one and vice versa. I'm trying to use child_process to fix this but it ain't working:
const express = require("express");
const app = express();
const path = require("path");
const ethers = require("ethers");
const { execSync } = require("child_process");
app.use(express.static(path.join(__dirname, "frontend")));
const listener = app.listen(process.env.PORT, () => {
console.log(`Listening on port ${listener.address().port}`);
console.log(`Starting hardhat network on port 8585`);
execSync("npm start");
console.log(`Deploying contract Box.sol`);
execSync("npm run deploy");
});
Is there a way to run two node processes alongside each other so one doesn't block the other?
yes
Why not just use two repl instances
it's not like you're limited to one
¯_(ツ)_/¯
that's the fundation of try and see lmao

only problem i have now is that repl is confused between which server to take me to when i go to smartcontracttest.code913.repl.co
is there a way to see who mentioned your name and where on the browser version like on mobile?
you mean on repl talk?
or discord?
lol discord
got pingen somewhere in general and cant find it
WTF
there's no @ tab on the browser version
that's why I'm asking
how are you using browser on the mobile version
isnt there the drawer on the top Right in the browser version next to the search field?
that's my secret... but I'm actually talking about a PC browser
anyways if you wanna see your mentions goto the channel and search from:weeb#6969
there is, but he said mobile
yeah know about the search field but wanna know if there's a feature like on mobile actually shows all the mentions
probably not I guess
yes if you open the side tab there is a @ at the bottom,
on app: yes
on pc app: yes
on web: yes for pc havent tested mobile
there is NO side tab in the browser version
wait where are you rn
only the user list
how are you even using the browser version on mobile. for me the css is soooo bad i cant do anything besides see the server tab
browser on mobile?
is there a way to see who mentioned your name and where on the browser version like on mobile?
that means I am on the browser
send screenshot of your phone
Little drawer icon near the search field
Literally
oh also let me remind you about something semi related, discord promised they're working on allowing bots to use the message search endpoint two and a half years ago
DAMN a PC BROWSER
Then click mentions

i guess the Browser version for Mobile is a bit fucked
But I always use pc browser
I bet you're all trolling
patience 
it is
cant do anything
Dude
I am on a P C B R O W S E R
click
da
drawer
besides the search box
The inbox icon?
yep
Yes
yes
me first
Then select mentions
cry what are you typing for so long
desktop sucks ass because it's electron
browser sucks ass because it can't do half the things desktop can and font rendering is ugly
and mobile is just mobile, the devs are incompetent so the app is basically unusable
Oh there we go
lmao... why is that part hidden in inbox wtf
It's not
hover over the icon, say INBOX
weeb version doesn't sucks ass because weeb
They literally had a notification pop-up for about 1 month when they changed
that's just client modding 
I wonder why there's no icon like on mobile
Like a mailing system
Because mobile is outdated af
nvm ... ty actually know where it is right now
even if the road to get this knowledge was complicated

One message removed from a suspended account.
One message removed from a suspended account.
Writing a super long-winded explanation trying to justify why they don't want to go actually learn shit
lmao
And prefer relying on us fixing everything for them
i think there you need the news @sage bobcat
i dont get why repl redirects to the wrong port even tho i used process.env.PORT which is supposed to be the default port
One message removed from a suspended account.
One message removed from a suspended account.
ok well i figured it out
like new string[] {...}, new string[][] {...}
One message removed from a suspended account.
One message removed from a suspended account.
Oh you mean when we stop permitting you to suck us dry, you actually think for yourself and can actually achieve things independently? strange how that works
One message removed from a suspended account.
One message removed from a suspended account.
That was a weird way to put things
{ new string[] {...}, new string[] {...}, ...}
One message removed from a suspended account.
hm
listening on port 80 throws error
Port 80 is http
bc the repl site is listening for that port already
and any other port works but repl doesnt redirect to that
it still goes to the hardhat server at 8585
on that port, for that port... what ever is correct
look at this any way you want but im just thankful you taught me how to do it and i always just sit for a moment to read all the new code ive written to figure out what everything means, i just needed this help so i'll be able to work with databases in this way in the future, so thank you :)
if you want an example, from this i can figure out how to create an economy system without too much trouble or with an exceeding amount of help
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
faith.smart = false;
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
say that again
One message removed from a suspended account.
One message removed from a suspended account.
same
helpme
no help me
Why
why
Code
we use actual programming software
code with a capital C means visual studio code
IDEs
Ohno
google for a tutorial
visual studio code is just a way to write code and do other stuff, the actual code you need to learn
discordjs.guide is a pretty nice website for learning to write bots in djs
If you're choosing to code with actual code congratulations for not choosing the lazy path
kudos to you
But you'll need to learn how to program at first
There are a ton of tutorials
So first learn the language, then start bots
so umm
still cant figure out a way to get redirected to the correct port
@quartz kindle lord i need halp
wut
trying to run two servers in node on replit and it keeps taking me to the wrong one
explain
I have two servers running in node: one at port 8585 (which i dont want to get taken to) and the other at 8080 (which I do want to get taken to)
but when i go to myrepl.code913.repl.co it takes me to the first one which i dont want to go to
anyway to fix this
Replit issues
yep
const express = require("express");
const app = express();
const path = require("path");
const ethers = require("ethers");
const { exec, execSync } = require("child_process");
const server = require("https").createServer(app);
app.use(express.static(path.join(__dirname, "frontend")));
console.log(`Starting hardhat network on port 8585`);
exec("npm start");
console.log(`Deploying contract Box.sol`);
exec("npm run deploy");
const listener = server.listen(8080, () => console.log(`Listening on port ${listener.address().port}`));
afaik repl.it only binds one port
whichever comes first in the code
not sure if they support multiple ports
hmm
try accessing myrepl.code913.repl.co:8080
it says site cant provide secure connection
even tho im using https
but does it hit the right server?
lemme try console loggering
there is no warning it just says it cant provide secure connection
and also no output from console.log
why are you doing this to me repl
try opening a new private window in your browser
and try accessing it directly, without https
in d.js v12
Will ```js
let ownerID = await message.guild.members.fetch(message.guild.ownerID);
give you the owner id
has owner id
fetches the owner id using the owner id
message.guild.ownerID is already the owner id
it wont give you the exact same thing you already have
it gives you the full member object for the owner
but when the server has alot it will give it as null right?
no
@quartz kindle wait curl does work
guild.owner may be null
guild.ownerID is never null
ooh ok thanks
going to smartcontracttest.code913.repl.co:8080 shows a google 404 page
Hi can anyone tell me command which tells the server name??
and removing the port number shows an <a>permanent redirect to <site name with https></a>
Read the docs
djs or dpy?
Where is it??
What language?
Node.js
Yes
well, if curling directly to that port works then it works
but the repl.it url can only point to one of them
sigh im making a new repl to interact with the old one
wait which python server what's the name of it?
somewhere a value is undefined or null in message.channel.send
dms
run: (message, name, client) => {
if (!name){
return message.channel.send(`\\❌ **${message.author.tag}**,Please specify the id!`);
};
let selected = market.find(x => x.name == name);
if (!selected){
return message.channel.send(`\\❌ **${message.author.tag}**, Could not find the item with that id!`);
};
return message.channel.send(`name: **${selected.type}**`)
}``` Ok so this code sends a information that i want to find in a .json file lthat is connected to a string like `$help avatar` and send info about avatar But it only works with 1 word not when the name is 2 words how can i fix it i maybe thought with a args
Most cases you can use args.join(' ') for that
but in what way because you can use args for multiple reasons
Ok so name is a string lets say $help kill then in this case kill is name
and it works but only with names that consist of 1 word
you'll need pass the rest of the args to the function
are you using your own command handler or a framework?
well then pass all args to the run function, not only the first argument
and then do what Mihimur said
So whenever i try to install nodejs with NVM it just gets stuck on checksums matched
does anybody know how to set the embed color to the bot's top role color in discord.py?
i tried client.user.color but it didn't work...
msssage.guild.me.displayColor
Anyone know how to add a status to a bot in discord.py
._.
Thx that will help
just a tip, 90% of questions have been asked before
just add await client.change_presence(status=discord.Status.online, activity=discord.Game("status goes here")) above the print() function in the on_ready
Just stick it into google & I promise you you will most likely find an answer
the actual docs for it instead of copy & pasting code: https://discordpy.readthedocs.io/en/latest/api.html#discord.Client.change_presence
It's why 90% of coding at this level is google and 10% is thinking
It's the other way around tbh
it's a frequently asked questions, u can find the answer on the discord.py documentation here: https://discordpy.readthedocs.io/en/latest/faq.html?highlight=status#how-do-i-set-the-playing-status
Hey guys I'm trying to set the vote api but every time i press test it doesn't send any request to my server
not in my experience but fair enough
So, Does anyone know why i cant use NVM to install nodejs it just gets stuck on checksums matched
im not excited to work with the vote api
in fact
im dreading it
ive been avoiding it for weeks
not because its difficult but bc i have to intergrate it with a bunch of database stuff
and im not in the mood
NVM fixed lol typo error
?
Do you guys know if there is a way to make Discord keep multiple spaces in an embed text?
Spaces or newlines?
thx it worked, can i ask one more question if you dont mind
u can also change the bot status either Online, Idle, and DnD with replacing the discord.status to .online .idle and .dnd
thats what i was going to ask thanks
does anyone know if ffmpeg would work on heroku for playing music in a discord vc
Idk if you'd even be able to run it on such limited specs
nodeJs > PHP
vuejs > react
good joke
it's definitely no
I can't seem to get rid of the Missing Permissions error that floods the entire console.
400 errors an hour.
well handle them and supress them
not needed to get informed about missing permissions
I did this.
let commandfile = bot.commands.get(cmd) || bot.commands.get(bot.aliases.get(cmd));
if(commandfile) try {
await commandfile.run(bot, message, args);
} catch (error) {
console.log(error);
};
that's absolutly no what I was talking about
handle the errors and sort out permission errors
console.log(error); prints all errors to the console
there's no handling
How do you want me to handle this, then?
I did this.
Every command has this line if(!message.guild.me.hasPermission(["SEND_MESSAGES", "EMBED_LINKS"])) return;
Every command has a try catch block when it wants to do an action such as adding roles or stuff.
Are the 400 errors, can it be from events?
it's an API response
the bot has no permissions to send a chat message for example, proves your permission doesn't work as it should
I am actually checking the permissions for the channel each message event
What can I do, instead.
not the whole guild, but I don't know if that even makes a difference
Permissions are for channels not guilds
I mean the bot could also miss "VIEW_CHANNEL" permission
oh there we go, you see
Permissions are for channels not guilds
message.channel.permissionsFor(message.guild.me).has(['SEND_MESSAGES'])
Its something similar
Check the docs
shouldn't it be message.channel.permissionsFor()
Typo
So, to get rid of the missing permissions, I should do what exactly, in summary, just to start working
Change your methods
get rid of checking guild permissions
the bot needs permissions in the ACTUAL channel
Damn I do always forget there's a me property
imagine are deep, complicated way message.guild.members.cache.find((member) => member.id === bot.user.id)

Oof
shame is real
Can anyone guide me how to add slash command in my existing bot project
They aren't officially supported in djs
You can still use external libs
Or manually send api requests
anyone know how make a ping command if that makes sense
i'm wanting my bot to have a commands called "d/ping"
and i want it to respond with Pong! (The Bots Latency)
but everything i have tried hasn't been working
my bot is written in python
Could someone help me with javascript?
Python asking help for Js?
i did this but it doesnt work
Template literalls
template what
template literals*
^
if you really wanna use these brackets it's "test" + js_var + "test"
`${code} text`
ohhh
smh, i've been calling it temperate literals that whole time
But I recommend to follow Feuds message
Nvm I have bad spellings
still
what is the difference between ' and "
none
nothing to most languages
kay
for Go lang it's the diffrence between a string and rune litterals
the syntax highlighting is different in most IDEs
bot.on("guildMemberAdd", member => {
bot.settings.ensure(member.guild.id, defaultSettings);
let welcomeMessage = bot.settings.get(member.guild.id, "welcomeMessage");
welcomeMessage = welcomeMessage.replace("{{user}}", member.user.tag);
welcomeMessage = welcomeMessage.replace("{{server}}", member.guild.name);
member.guild.channels.cache
.find(channel => channel.name === bot.settings.get(member.guild.id, "welcomeChannel"))
.send(welcomeMessage)
.catch(console.error);
})
``` can anyone see any errors? ive been trying for a good hour now and i cant figure it out, im not getting any errors logged either
Do you have intents enabled?
yes
Member intents?
In strictly typed languages ' is used for chars and " for string literals
yeah on the application page
no, nothing gets logged
log the actual event
Yew try that...
bot.on("guildMemberAdd", member => { console.log(member)
looks like an intents issue
It doesn't get triggered without intents
or called partials now... idk whatever
da hell is this (Quick.db)
oh shit turns out i thought i turned on intents on this bot not my other bot, its the other way around
so i enabled them
🤦♂️
There u go
now im getting an error but i want to do it myself :)
thanks for reminding me anyway
anyone know how make a ping command if that makes sense
i'm wanting my bot to have a commands called "d/ping"
and i want it to respond with Pong! (The Bots Latency)
but everything i have tried hasn't been working
my bot is written in python
Send code
We won't spoonfeed
if(Command === bal) {
let bal = db.get("user_" + message.author.username + ".bal")
const embed = new Discord.MessageEmbed()
.setTitle('Your Balance')
.setDescription('${bal} coins')
.setColor("GRAY")
.setTimestamp
message.reply(embed)
}
and ping command never makes sense anyway due the nature of source and target
gettin this error
a ping from US to RU will take longer than EU to RU for example, which makes ping results useless

Command is not defined
Define it
but i did.
well, for the bot its always it's position to the US
not sure, guess discord is using a cdn
everything in the API is in the US
Discors api server is in USA or eu?
might be, I dunno know didn't investigate yet bc who cares 
its why if you want the lowest latency for you bot between Discord you want to be as close to NY as possible
NY?
New York
Well that would be New York City
nope NY
not the state of New York
I don't like short forms 
its not short forms
the codes have an ISO norm
Bro I am not from us
what features SHOULD a discord bot have?
Any
One is a State the other is a City
not needed to discuss that anyways
oof cant think of anything....
any lmao
let feature: any = new Feature()
yes
eww shoo move on
xD

||A high level language compiled into another high level language||
yes
as long as it doesn't look like so I'm not willing to use it $super_feature = new Feature();
that syntax is ... grr nice
char * feature = new Feature()
Stop harassing me for being old!
How old?
too old
18?
Lol
69?
I thought u were like 24
i look young
if these 6 years would make any difference lol
keep in mind to prepare yourself for the midlife crisis, Tim
i have drunk the elixir of life, i age slowly
lol
oh dang, poor boy
Discord should really allow to specify a short message if you invite somebody, allowing [a-Z0-9] only
We can send a message with an invite link tho
you don't actually know if somebody randomly invites you if there's at least a reason to now ignore him
I'm speaking about friend invitations
Not a terrible idea
how can i do a command that will work in a specific guild? is it:
if(message.guild.id != "754604182995992609") return;
let's call it invite topic or reason, with a limited amount of chars and like I said [a-Z0-9] only
?
Yes.
That should work
I think there is a way to do this in the message.js, where if you mention the bot, it would return a message?
Anyone knows what it is?
wut
check if the message mention is the one for your bot, then just return the message
Hi
👀
if(message.mentions.has(bot.user.id))?
case 'setboost':
if(message.author.id != '723081690792067143'){
message.reply('only my creator can use it.');
return;
}
const role = message.mentions.roles.first()
const channel = message.mentions.channel.first()
if(!role) return message.reply("please mention the boost role!")
if(!channel) return message.reply("please mention the boosts channel")
if(role && channel){
db.set("boostrole_" + message.guild.id, role.id)
db.set("boostchannel_" + message.guild.id, channel.id)
var boostUsing = db.fetch("boostUsing")
if(boostUsing == null) boostUsing = []
boostUsing.push(message.guild.id)
db.set("boostUsing", boostUsing)
message.channel.send("Successfully set the role to be " + role.name)
}
break;
TypeError: Cannot read property 'first' of undefined
message.mentions.users.has(bot.user.id)
if anyones free could you please look at https://stackoverflow.com/questions/66750703/trouble-with-libespeak-so-1-on-heroku-cant-install-using-aptfile
Heroku doesnt allow a ton of stuff
mentions.channels
not mentions.channel
mostly stuff that handles sound, since it usually needs more resources
ah ic ic
im trying to install those extra packages through aptfile
as perscribed by heroku
Heroku just say nope
yeah basically
its also a common issue with Music bots
is there a workaround/other platform
buy a VPS
google compute engine f1-micro
rule of thump is, you get what you pay and if its free it usually sucks
but you need a credit card to register
got you
thanks for the help
there are some really good and realtively cheap VPS hosts, you can get a decent VPS that will beat heroku for like 3$/Month
alright ill look into it
generally discussing about bad practise in here you should never suggest somebody to rent a server without proper administration and network experience
just to say
who loves goanimate and vyond and legacy video maker (lvm clones) me yes
you have to start somewhere, and a 3$ VPS is probably one saver start if you dont have a RPI at home
i mean, learning how to operate a linux machine through ssh is not that hard, you learn as you go
who loves goanimate and vyond and legacy video maker (lvm clones) me yes
well that's a terrible idea to let somebody start on a machine which has access to the 'net
who loves goanimate and vyond and legacy video maker (lvm clones) me yes
just one more potential bot server
@sinful belfry chat spammer, see above
without any knowledge about administration, network (incl.) firewall it's just a risk for anybody else in the network
like i said, not everyone got a way to do it from Home, so a VPS is a good way to start, sure you may fail and do some mistakes, but not everyone got the luxuary to start a VM with linux and hack around until it breaks
if I would recommend something to a beginner, than rent a managed server
the thing is most beginner cant afford a Managed Server
they can easy go for 40-60$/month
aye which doesn't change the fact of being a god damn huge security risk for any network or hoster
I know why it's been recommended to anyone in here but just to say it's a horrible suggestion tho
then give a solution lol, there are no cheap managed Servers that are around 3-7$/Month
i guess a safer way would be giving them a Docker Container with only one or two ports open to hack around
but they are a bit limited again
never said it's cheap but throwing more and more security risks into public networks can't be a justified reason just because of an expensive price
welcome to the market, people who write a new Discord bot wont rent a managed Server for 40$/Month to have a bot using 200MB Ram running on it
I'm administrating and managing servers for more than 14 y... you might have no clue how the amount of attacks, sniffs, bot server etc. has grown the last years
what is the problem with this code? ```js
require('dotenv').config()
const Discord = require("discord.js");
const client = new Discord.Client()
const fs = require("fs");
client.on("ready", () => {
console.log(Logged in as ${client.user.username});
client.user.setActivity("with my tail"); // Status
});
client.login(process.env.token).catch(console.log);```
i know, worked as a sysadmin for a while
I know just wanted to add that part to the general "bad practises" discussion
did you get an error?
no error
if(/*Is there a code to determine if the error is missing permissions*/) return;
console.log(error)
^
actually, there's very little you can do that would critically screw up everything
sure best way to start would be a RPI at home with no Ports open in the router, but only a small fraction of Linux Beginners will go this way, others may have a old laptop to run Linux on or some even have a Cool dad with a Homelab to give the person the ability to learn Linux quite early
I have no code to determine a error yet
like, even a chmod 777 / -R is an easy fix if you're just learning
you can screw up a lot, but you dont see the damage directly
and a beginner wouldn't have an intricate system set up
like leaving ssh unsecured and ports open are common mistakes
Shutting the Missing Permissions error if the bot doesn't have permissions is like this, right?
if(commandfile) try {
await commandfile.run(bot, message, args);
} catch (error) {
return;
//console.log(error);
};
well this or using some public service like the repl thing people always talking about I guess
unless your vps gets pirated and ends up in a botnet
noone would try to invade a smallish bot vps
you are innocent lol
I'm not
we told you already how to check the right permissions and how to supress them
lmao yes
I'm just saying those are big world problems
not a "unknown nobody" thing
you rarely get targeted if you're anonymous
back when i worked as sysadmin for a small company we had some special offer for 1€ VPS servers, a ton of them ended up with chinese customers bcs cheap VPS server, and a lot of them where badly secured, causing a lot of them ending up in a botnet
like they had 1 Shared CPU and 250mb ram
const market = require('../json/market.json');
module.exports = {
name: 'test3',
run: (message, name, client) => {
if (!name){
return message.channel.send(`\\❌ **${message.author.tag}**,Please specify the id!`);
};
let selected = market.find(x => x.name == name);
if (!selected){
return message.channel.send(`\\❌ **${message.author.tag}**, Could not find the item with that id!`);
};
return message.channel.send(`name: **${selected.type}**`)
}
};``` I made this small code for my .json file so it can search and send strings like `$help ban` and it will send the info about ban but i found out that it isnt able to read nams longer then 1 word so lets say `$help server info` doesnt work how could i fix this
wrong context
dude the 'net been searched the whole day long by other bots, scanning for potiental security risks, in websites, frameworks, ports etc.
well, you eventually learn how to secure stuff
if you don't own a vps you'll never learn how to deal with one
I already told you what to do - pass all the arguments to your run function and use them, not only the first arg
what I'm pointing is that putting someone down for beginning with a vps is bullshit
well im still strugling
wrong way... you have to know it BEFORE renting a VM
so, how?
Show us how you call the run function
ok, so?
you can learn from bigger attacks but we're not talking about that scale
are you saying he should take 3 year network security university to be able to own a vps?
what do you mean by that
we're talking about somebody renting a VM and being a damn security issue for the whole network bc he has no clue to secure the server or to setup a proper firewall or how to deal with attacks or injections
i know a few good youtube videos about basic security, they help already a lot with securing servers
Uh... I don't think what I said can be made any clearer. Show us how you call the run function on each command object
still
so you want me to show how it is connected or
you shouldn't put someone down for beginning
if you care that much about security, teach 'em
or at least give an alternative
{
"id": 2,
"name": "Default Pattern",
"description": "Default pattern for profile command.",
"type": "pattern",
"deletable": false,
"giftable": false,
"price": 0,
"assets": {
"link": "https://i.imgur.com/nx5qJUb.png"
}
}``` this is how it is connected
just run run: (message, name, args, client) => {
If you can't answer me that then you should reevaluate your codebase because it appears that you don't know much about it
BRUHHHH
that's right nobody does, but this doesn't belong to security
what doesn't belong to security?
newMember.guild.channels.cache.get(channel => channel.name === bot.settings.get(newMember.guild.id, "leaveChannel")).send(leaveMessage);
i get an error saying send is undefined, i think its because it cant find the channel but i really cant figure out whats wrong?
heres an image showing that the leaveChannel is a channel id so it should work?
Maybe you should learn discord.js again if you cant explain something easily
but it's okay to have an own opinion and to see things differently
it's not different opinions
you shouldn't put someone down for beginning
that doesn't belong to security questions
sorry? were you born with alien-level security concepts pre-installed?
you had to start, right?
Lmao, the issue you're having and what i'm trying to say is not related to discord.js at all. If you don't know what How do you call the run function means then you should read up on functions 🙂
there's no "beginning" to learn how security works ON the production side
if so you will always make sure to be in a sandbox
A rented VM is live in the 'net, learning security at this point is already too late
instead of saying "no you can't"
um
point them to the docs, tutorials or whatever
well install Hyper-V role and play around at home
bruhhh deadass
now we're talking
of course you can also use other virtualisation platforms
Just to add one last thing about this conversation
I mean if you're on windows Professional or above you should already have Hyper-V installed
although they really are desperately trying to get people to use WSL2 over Hyper-V
Renting a server (no matter it's a virtual one or not) and risking your providers network just bc of missing administration/security knowledge can lead to fines you don't even think of
Written down in the ToS of each provider
wha
can someone help with this
the best case always is they will lock your server and resign the contract, the wort case... well let's not talk about that
use find
@lyric mountain Recommending anyone to rent a live environment (in the 'net) without any knowledge probably also means to buy/rent something without understanding the responsibility and concequenses it can have
to come to an end
still same error
As I said, if you're worried about that then teach them how to properly operate
or at least point to some resource they can use to learn
period
well I'm not recommending to do so in the first place, but wanted to say, it may be a good tip to inform somebody about the responsibilities and concequenses it can have
you wont get fined for mismanaging a server lol, its not illegal to not know what you're doing
for people recommending this
plus, to actually cause damage to the hosting company requires actually knowing what you're doing, you cant accidentally cause damage
well here are laws that require that you have to properly secure servers
here, too
if someone pirates your server you are responsible for it
properly secured servers for a public service, yes
that may not be the same anywhere
if you are offering a public service properly registered in a company
you're still responsible for what's written down in your contract
yes, most times its just "dont do anything illegal"
which can contain fines as well
like torrenting
(node:2084) Warning: Accessing non-existent property 'MongoError' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
What does this mean?
but like I said a simple contract resign of your provider in the first place
when ive started my Linux Journey with a Managed Server, ive had a 2 1/2 hours talk with a Sys Admin, he gave me some really good pointers also mentioned the laws that exist
It's a bug with MongoDb
Nothing to worry about I guess?
wait for them to fix it
Ok.
well that's a whole different story what providers allow on their servers and what not
i had 0 experience with linux over ssh when i rented my first vps
learn as you go is the best way, dont scare newcomers into not renting a vps for the first time out of fear
yea same here, but ive had a friend who got a Hosting company, he helped me to get the basics
lol me too, but the times were different
I don't, just wanted to state it might be a good idea to INFORM the user about the responsibilities and concequenses
but yea, if you start with Linux, one of the first things you should learn is securing the server
not just suggesting something without proper info
well not only linux but windows is kinda holding the hand a bit already
that's not really different to Windows servers
yeah
permanent scans for opened up RDP port and brute force attacks
most OS images supplied by the host are already preconfigured with a bunch of stuff
that's right
but yeah its a good idea to look into stuff like fail2ban
my last server had only the update repos routed over theyre local caching the rest where barebones
but you wont get hacked in 5 minutes if you dont either
got VMs without an activated firewall, no matter ufw or itables, nothing was active or installed
just a system core
it wont happen instantly, if you are not at some shady hoster who got already all IPs listed somewhere in the darknet as easy to grab VPS
it wont happen instantly
it actually does
created my VMs on the root these days, being online for a few minutes and booms, the network log is growing
general sniffers for framework security risks, like WP etc., port listeners etc.
if anything was found it doesn't take long until automated attacks start
that's how it is today
just try it and open up a general service port, like RDP or MySQL and log the traffic
i actually know a guy who had one of the largest Botnets in Europe, idk why he stopped with it but i guess he got his reasons.
doesn't take long to scan all exisiting IPv4
So I have an array of users, each user has a dead property nwo I need to get the next user in line that isn't dead, the current user is being saved as this.turn how would I do this?
language?
js
if you have an array, you need to store the current index of the user
not the user itself
setNextTurn() {
// Get index of the current turn player
let i = this.handler.players.findIndex((p) => p.user.id === this.turn);
// Set the turn to the next player in the array
this.turn = this.handler.players[i+1];
// If the player does not exist, set it back to player one.
if (!this.turn) this.turn = this.handler.players[0].user.id;
// If the player does exist, set the turn viarable to the users's ID.
else this.turn = this.turn.user.id;
// Get the player who's turn it is
let p = this.handler.players.find((p) => p.user.id === this.turn);
// If the player is dead, go back to square one (Back to the top of this method)
if (p.dead) this.setNextTurn();
}
We did this
would it help to just loop over the array and return the first key with the property that is not dead
currentIndex = 55;
for(let i = currentIndex; i < array.length; i++) {
if(array[i].dead) {
currentIndex = i;
break;
}
}
if you are working with subsets of an array, findIndex is not efficient
because findIndex will process the full array, not only the relevant subset
with a for loop you can do the same thing but only in a subset of the array, starting from index X until index Y
yeah its not bad
IK this is kinda advertising but it’s not Bcs I don’t get a benefit from it but I’m making a coding group for anyone who likes to develop bots
If anyone would like to join
leaveChannel: '820395516226830369',
i have leaveChannel set to this channel id, and i find the id with this:
oldMember.guild.channels.cache.find(channel => channel.name === bot.settings.get(oldMember.guild.id, "leaveChannel")).send(leaveMessage);
but it doesnt work and i get an error saying send is undefined? however, when i find it by just replacing bot.settings.get(oldMember.guild.id, "leaveChannel") with '820395516226830369' which is practically the same thing, then it works just fine?
because thats not how you get something
this is what it said in the docs?
assuming bot.settings is a Map or a Collection
ahaha lmao, dig not installed on proxmox
also that comparison
you're comparing names to ids
also
the docs explicitly say not to use find if you're looking up via the id
im using enmap
then you should have said so lul
console.log(bot.settings.get(oldMember.guild.id, "leaveChannel"))
and see what it returns
You need to return 2xx status
Else it'll retry up to 10 times
Read #site-status
ok
it returns the id
820395516226830369
sorry for late reply btw my friend messaged me
i really dont see whats wrong
I care about privacy but ... hmm 29
You god damn old brick 
channel.name > channel.id (2 hours of work)
https://i.callumdev.pw/qkhop.png
Why is the fa icon a little higher when there is only one inside the links div?
Thought you would be even younger
ill consider flexboxes some other time, for now, help me with this fankz
Gonna call you grandpa in the future
Guess we’re increasing the age average a little
xD
Why not make the switch now, though
it takes less than a few minutes
display flex on parent container
three children containers that have flex set to their respective amount of space
put your stuff inside of those
boom, done
Our comprehensive guide to CSS flexbox layout. This complete guide explains everything about flexbox, focusing on all the different possible properties for the parent element (the flex container) and the child elements (the flex items). It also includes history, demos, patterns, and a browser support chart.
flexbox is op
this tbh
` const cmd = client.commands.get(command);
if (!cmd) return;
cmd.run(client, message, args);
}; `
Does anyone know how I can get this to work in glitch?
that snippet isn't affected by a platform or anything of that sort
Yeah glitch or not makes no difference to that code.
why wouldnt it work in glitch
if I don't remove it, it doesn't work
define "Doesn't work"
do u get an error?
u put if(!cmd) return; so there isnt a command with the name
If you remove this, it cannot possibly be running your commands.
Unless you have other code that runs your commands, of course.
exactly, but if I remove it and try to start a command from outside the module.exports it works
fck
What do you mean "from outside the module.exports"? Can you show us more of the code?
`module.exports = (client, message) => {
if (message.author.bot) return;
if (message.content.indexOf(client.config.Prefix) !== 0) return;
const args = message.content
.slice(client.config.Prefix.length)
.trim()
.split(/ + /g);
const command = args.shift().toLowerCase();
const cmd = client.commands.get(command);
if (!cmd) return;
cmd.run(client, message, args);
};`
message.channel.send(embed)
const query = message.content.split(/ +/).slice(1).join(' ');
let suggested = suggestion.find(x => x.names.en === query);
if (!suggested){
return message.channel.send(`Not able to find this name`);
};
return message.channel.send(`${suggested.url}`)
``` there are two commands in one name so `$anime` that sends a random anime and `$anime {name} to get info about the anime` only they send at the same time how do i fix it that when i say `$anime` it only sends a random anime and same for `$anime {name} to get info about the anime`
And how are you defining client.commands and filling it with your commands? Can you also show us that?
I mean that looks like a shittier version of the AIG command handler but I'd still like to see.
does anyone know how to make a meme gen in python
like how you can do with dank memer
Afaik dank member has a public api for a meme generator
but there are others as well
ok
What do you mean?
you mean the command?
i mean where you load them


