#development
1 messages ยท Page 1632 of 1
so can't you call the bot yourself?
I have a thing.. except the repl isnt turning off.. it makes an ngrok connection(it calls the ngrok connection in an interval too but idk)
ye ask the question there
okay thanks
btw I came to ask if I can paste the link to something I made on github
no long talk, no pings, just the link
For what purpose?
that would count under advertisement, so no.
oof
@umbral zealot one question
does the description of the bot must be in English only?
I mean
it's in russian
and I don't want to get some problems because of that
3+ weeks at the moment
okay, thanks again
repl.it allows that? wow.
bruh
I wrote to them about that
and they still didn't answer
don't make me nervous
๐
They absolutely 100% allow bots online 24/7
Their CEO literally asked my discord guide, on github, to make a tutorial on how to do it
thats likely because it makes people more likely to buy the plan
I want ask something to your guys
:l
dont make me feel like a criminal lmfao
if they allow it why don't they just remove the anti-"afk" setup?
It's not "anti-afk"
I want bot send image how to do that
read embed docs
It's a natural feature for web server hostings to shut down when they're not in use,
Ok
you want to send an image, or add an image to an embed?
I just want send image
what library and programming language are you writing your bot in?
Js
JS is the best!
Yeah but i newbe
right so... discord.js?
Yeah
this has all the ways to send file as well as messages
Ok thank you
SOmeone i need dire help and it takes two seconds. How do you do it so that if a message is sent in a certain channel, then the command will not be activated? Like message.channel.id('id') is not working for me
Well, what's your issue now?
how about describe it instead of asking for "experts" ๐
its not a error but just
but just.... ?
this: message.client.giveawaysManager.reroll(giveaway.messageID)
He send a message in the channel
I want to block this
just reroll but not send message
because I can't edit this message
mmmkay? What exactly is this giveawaysManager ? Is that something you wrote or something you caught off npm or something?
Then maybe you wanna speak to the developers of that thing to ask for support?
okay
we have no way to know how they coded it
oh
oh wait
I think I understood what the problem was @umbral zealot
so
I have a library
yeah?
called Cybernator
I installed it using the shell
but after sometime
the server thinks that it's not installed
and sends errors
and at last just turns off
now I need to understand how to fix that.
I mean
I wanted to make pages for the help command
and this library helped
but
it doesn't work really great
how to add pages to the help command?
easily
see if there's a pagination lib for your language and current library
what language btw?
rip
f
but how isn't repl recognizing it?
idk
I mean
I install it using the shell
it works just fine
but after 2 hours
it sends a lot of errors
saying there is no library like that
and when i refresh the page
I have to install it using the shell again
it's like an endless loop
doesn't python have a dependencies file like java's gradle.build or node's package.json?
or rust's cargo.toml
idk. I am not a professional in it, so can't say
so, should I create a txt file and write every needed library inside?
so it will download them?
idk, I don't code in python
I mean, I am not really good, so I can just not understand at some point
but search online regarding that file
okay, thanks anyway
there's probably a walkthrough out there
how do i make stuff like "client.on" on a seperate file?
Right now ive been coding everything to index.js.
Please help ๐ญ
please do ping me
import the file
Eh?
right
KuuHaKu thanks for the help! It was useful. I hope no errors will happen this time!
so its best to have all my "client.on" code in the same file?
my index.js already 13kib
actually, you shouldn't have any command code in client.on
kb size of a file isn't important unless you're dealing with DBs
except for the handler
like, client.on calls the command handler -> handler calls the command
oh
there is not best here, is just user preference
but having more smaller files can be easier to manage and maintain than few large files
any idea how much memory would i save switching from discord.js to discord.js-light? my bot's in about 350 discord servers and is using up 33% of the 1GB of ram.
depends on what your bot does and what caches you need
im using 150mb ram with 8k servers
that not too bad. are you caching anything? i'm guessing the main trade off is more network usage and the bot being a little bit slower.
my bot suddenly went offline and won't log back in
i haven't changed anything in the code
im caching some data that is not from discord
discord caches are all off except for guilds
look for errors or clues in your logs
try logging the debug event
8k discord servers is taking up <150mb and my 350 servers are taking up over 300mb
I really recommend you don't code everything in index.js it clutters everything up
Clutters*
I MADE A TYPO NOOOO
xD
Lmfao
yea fuckin critters
Yeah
makin my code work funny
wt
ahaha
I fokin hate em
sa<e
there's no errors or anything
nothing's changed
it literally just stopped all of a sudden and won't log in anymore
Could of been rate limited but very unlikely if it is not a big bot
As in server count
or you've used all 1000 identify calls
how do you know it "wont login"
if there are no logs
I swear every person with the "team" Role either has verified bot dev or early supporter lmao
Ik they are the owners basically
Btw
They are also previous bot developers n also skilled at coding vs a lot of the badge farmers who use bot makers or tutorials
let deleted = (await channel.bulkDelete(mgs.slice(0, amount))).size()``` how is .size() not a function?
It just isn't yeah
oh duh
xd
const {size: deleted} = await channel.bulkDelete(mgs.slice(0, amount))```
Lmao
xD
sneak revert
it should
apparently i have to catch it
message.channel.send(item.question).then(() => {
message.channel.awaitMessages(filter, { max: 1, time: 30000, errors: ['time'] })
.then(collected => {
message.channel.send(`${collected.first().author} got the correct answer!`);
})
.catch(collected => {
message.channel.send('Looks like nobody got the answer this time.');
});
});```
from docs
ah wait
this is awaitMessages
hmm
awaitMessages is different from messageCollector
yeah
you can simply not have it error
this is after 10 seconds
but after 10 seconds it should send timeout embed
mcollector.on('end', async mcol => {
message.channel.send(timeout)```
meh screw it collectors are weird
ill use awaitMessages
o
ok
let choices = ['Test', 'Noob']
let answer1 = await a.channel.awaitMessages(m => m.author.id === message.author.id, { max:1, time:10000 })
if(!choices.includes(answer1.first().content.toLowerCase())) {
message.channel.send('nooo')
}
how come this doesnt work
i probably lmessed something up
with the includes thing
you need to check if answer1.first() exists
if it times out, answer1 is an empty collection
if(!answer1.size) return "no answer"
So my bot has an, urban command I feel I should make this NSFW channel only welp
if(!answer1.size) return message.channel.send(timeout)
if(!choices.includes(answer1.first().content.toLowerCase())) {
message.channel.send('nooo')
}```
What sorta command u tryna make?
that should work
Ohh
yea so lowercase your arr elements
so it will never match
so I made a fun bot where you mine blocks to level up by running &mine and it shows up an embed you can control by reacting to it but if 2 people are using it at the same time it slows down rlly bad, is there a way to make it run smoother?
async function normal (amount, channel, mtime) {
let mgs = (await channel.messages.fetch({limit:100})).array().filter(m => (!m.pinned) && (m.createdTimestamp < mtime) && (m.createdTimestamp > (mtime - 1209600000)))
if(mgs.size < 1) {
return(0)
} else if(amount > mgs.size){
let deleted = (await channel.bulkDelete(mgs)).size
return(await normal((amount - deleted), channel, mtime), + deleted)
} else {
let deleted = (await channel.bulkDelete(mgs.slice(0, amount))).size
return(deleted)
}
}``` can someone tell me what i did wrong other than api abooze?
so i installed node.js for an project and it changed my browser to yahoo from google?
you didn't install from official sources then
i fail to see how pip is correlated to node
just but- pip is for python packages
so ive installed something bad then
Usage: npm <command>
npm install install all the dependencies in your project
npm install <foo> add the <foo> dependency to your project
npm test run this project's tests
npm run <foo> run the script named <foo>
npm <command> -h quick help on <command>
npm -l display usage info for all commands
npm help <term> search for help on <term>
npm help npm more involved overview
All commands:
access, adduser, audit, bin, bugs, cache, ci, completion,
config, dedupe, deprecate, dist-tag, docs, doctor, edit,
exec, explain, explore, find-dupes, fund, get, help, hook,
init, install, install-ci-test, install-test, link, ll,
login, logout, ls, org, outdated, owner, pack, ping, prefix,
profile, prune, publish, rebuild, repo, restart, root,
run-script, search, set, shrinkwrap, star, stars, start,
stop, team, test, token, uninstall, unpublish, unstar,
update, version, view, whoami
Specify configs in the ini-formatted file:
C:\Users\forth\.npmrc
or on the command line via: npm <command> --key=value
More configuration info: npm help config
Configuration fields: npm help 7 config
npm@7.0.14 C:\Program Files\nodejs\node_modules\npm``` this is all correct right?
this is what i get from doing npm help
i did npm install
yes by doing what i just said
wha
"are you high?"
i reckon you are
and where did you install node from?
so i installed something bad then correct?
thats the main thing?
you're being cryptic about what you did
this
what about it
im answering @misty sigil question
yes
i installed from here https://nodejs.org/en/download/ by doinf npm install like i said
but they said about 4 different things that contradict themselves now
wha
so i do not know which statement is true by this point
??????????
im confused
so am i
so are we
elaborate
you said 4 different things, all of them contradict eachother and none of them make sense
the fact that you say you installed from https://nodejs.org/en/download/ and installed node by using npm
๐ค hmm
all i wanted to know is if i installed something bad
why are you being cryptic about what you did ๐
or not
literally just say what you did step by step
you already had node installed then
nope
yes
never used node

huh well i mustve forgotten then
chances are npm install in fact actually did nothing unless you had a package.json (and some packages in the package.json) in the directory where the console opened
i mustve had it installed if your saying it wont work if i have node installed
if thats the case im good
and my questions solved
what npm install does, is it installs all packages from the package.json file in whatever folder you opened cmd in
i see
"my fridge isn't working!!"
"did you plug it in"
"well my microwave is plugged in so the fridge should work too!"
the correct term would be "couldn't care less" xd
let money = db.all().filter(data => data.ID.startsWith(`money`)).sort((a, b) => b.data - a.data)
let bank = db.all().filter(data => data.ID.startsWith(`bank`)).sort((a, b) => b.data - a.data)```
is it possible to add these two values
and then put it on a leaderboard
my discord bot has been added to the server i want it to message the server owner and a random room on the server
why is that
because you're violating discord tos im p sure
your bot should only interact with users when your users initiate the interaction first
aka
yeah
your bot responds to actions, it shouldn't be doing an action on its own
i dont think adding will work
because
i need to splice each
to get the id
for (var i in money)```
i want to do this to two values
for (var i in money & bank)
that wont work but thats what i mean
o i got it to work
but its not adding the values
Yeah except for maybe a message, saying like Hey thanks for inviting me to your server but that is still kinda user initiated
ok i have a new issue
so basically, the #1 user should be the one with the most in their bank
but
its showing their coin balance as someone with the highest coin balance
they don't have 56 coins in their wallet
they have 0
but the person (me) has 56 coins in their wallet
so its showing that at #1
hmm
ill just make sep lbs ig
i found out the issue nw
it was because
i make the numbers depending on the highest amount of balance
and since bank overrules wallet that happened
So sense ejs doesn't allow you to use document I have had to resort to some good ol <script> tags to get the classes and there contents...
https://i.imgur.com/eDnkPUC.png
Is there a way I can convert each of the vars to be inputted into ejs so I can run functions with my bot on it
@vivid fulcrum I think he means when the bot first joins it posts some kind of help message about the bot. which most bots do.
What are you trying ot use them for
DB storing
Can I do that in the function?
ofc you can do something like amount = int(amount), but type hinting it is cleaner imo
What would be the recommended way?
Nvm, doesnโt work in the function
You need a parser iirc
brain go weee
I have add a command to Disbale/enable features in my bot like Disbale encome system I this allowed?
Yes disbale encome
๐
I mean like this
I have already added and it works when the bot first joins the encome system will be on until someone who has the perm or a admin(mod) to control it
trying to embed my commands page that'll fit below my description in top.gg nicely
without any sort of border or smaller sized frame
anyone got an idea?
how do i make my bot status refresh
Just use an iFrame
And adjust it with css to get rid of scrollbars, borders etc.
Media queries or simple min/max width rules are able to deal with different screen sizes etc.
@ benji
<client>.user.setPresence({ activity: { name: 'dogshit music' }, type: 'LISTENING' });
thx
It's not against the rules to allow command customization
But sincerely, are you serious about "encome"?
how to i get emoji's from other servers
Buy nitro
Android mome t
@earnest phoenix are you trying to import db from another file?
Does anyone have any idea if it's possible to change dynamically generated type properties to be optional? I'm trying to write an ORM and the def is created from a sample object, which this dynamic type is used for the column defs when selecting and also the return value. I would hate to write the definitions multiple times if I didn't have to
https://cdn.discordapp.com/attachments/405285983794364417/817660148548894770/unknown.png
https://cdn.discordapp.com/attachments/405285983794364417/817660217789644810/unknown.png
https://cdn.discordapp.com/attachments/405285983794364417/817660310193307679/unknown.png
how can i install 7.0.0-b21 version of quick.db in repl.it because its showing error
help me pls
@static sinew what language?
js
Yea
it didnt worked
it showed an error that it cant find my index.js file after it
what is ur current version of quick.db?
If it not working type npm uninstal quick.db than install it again
^
latest
ok
it will istall latest i need older cuz i wanna use startsWith function
i did this i frgt to puut @ last time but now it's showing node gyp rebuild
and stuck at it
wait a 5min
ok
anyone pls tell
how can i show leaderboards on latest version of quick.db or install older one with no errors on repl.it
Please use #general-int for other languages
is there any npm package for levels? Except discord-levelling, should be able to display rank card?
any idea?
just don't use a npm package
you don't need an npm package to make a leveling system
cool but you don't need to post that into development
nice i somehow managed to get the node build tools to get uninstalled, but idk how and now node-gyp-build fails, i guess its time to wait a hour again for the installer to finish
Can someone possibly help me out with bot development? I'm a quick learner, Just need a rundown.
you can check out https://discordjs.guide if your looking into javascript
I remember being told how to a year ago, there was a site that had a step by step tutorial on how to get the bot online. I just can't find the site. Is that the site? ^^ @marble juniper
Wait it is. Pog, thanks homie.
yeah
Mind adding me on Discord?
that guide is probably the best you can find
hey
i wasn't here for a while
so
uh
await message.channel.createWebhook(message.author.username, {
avatar: message.author.avatarURL()
}).then(hook => {
hook.send(message.content);
db.delete(`number-${message.channel.id}`)
db.set(`number-${message.channel.id}`, message.content)
hook.delete()
})```
it says DiscordAPIError: Unknown Webhook
there's also an idiot's guide
I might need that..
if you need it
My brain is broken.
Anybody here know about Python graphics libraries I could use that are able to make something like this? https://cdn.tanners.space/yglj
Digital gauges where needles would actually need to move in real time as data gets sent to the program
not bot dev but I figured maybe one of you nerds knows something abt Python bc I dont ever use it
Use Pillow
I assume you could just re-render it every frame
^
You could render it everything data comes
Or render each second
For mean data of that second
It would need to render and display 10 images a second
And these images would be around 1920x1080
A digital dash for a car, like in that photo
If html then you can use graphs
So the computer needs to fit behind the dash of the car
lmao
Maybe smthn like a game engine would be better but then I need to figure out sending the data to the game engine via python
Python graphics could work there
I don't like this statement
good
Man I was hoping I wouldn't have to like
generate each image one by one that seems kinda really dumb
Yeah it's mean. 
I mean
I feel like there's a much better method
you could use html or something like that
Yeah I would need to use Python to get the data so maybe that's the best bet
python server running to pass the data
And python flask backend to power the front end
you could just integrate the server into python
That is what I said
lol
ty
I'll look into wat can be done, definitely sounds like the easiest route
I like your sharex server
Great ๐
Directions unclear. I am still lost lol.
tfw
Just do npm i discord.js
Thanks for the help, I'm gonna leave it to my development team to do this stuff. I'll just manage the server, and behind the scenes work. I am literally looking like a lost dog.
Thought I'd give it a shot, and got lost.
Hello, so for my rank command i've always used to fetch the levels of the guild and sort them descending. But as the bot grows it joins bigger guilds with thousands of level documents. My issue is that i want the rank of the user & their level data without fetching all docs from the guild. Is that something possible? Because it starts to take time to fetch all the docs from the db. Here is what i use currently:
const data_sorted = await lvl.find(
{ guildID: message.guild.id }
).sort([['totalXp', 'descending']]).lean();
const rank = data_sorted.findIndex(x => x.userID == member.id);
const levelData = data_sorted.find(x => x.userID == member.id);
You can cache the data and fetch every 6 hours for each guild
And show data is updated every 6 hours
I tried doing ascii art using a embed and it went horribly wrong ๐ anyone know how I can get it to work? (Js)
I know what happened
iirc discord just butchered the formating
Your ascii was larger than the embed allowed
So formating got ripped
Just make it so that chars after a specific limit are sent in new line
Seems like i found something. I could fetch the data of that one member and try to use this. To count all documents above that person by the totalXp.
hey guys i recently made a command that saves voice chats
and saves it in pcm file format
however, how would i convert it to mp3?
well if anyone knows the answer, please ping!
Yea
And i will be adding more items to the shop
why not just save it as mp3 on the first place
But i waana test something real quick
economy?
yea I think economy
anyone here using kurasuta?
kyoso?
ยฏ_(ใ)_/ยฏ
Nah
change it to $onlyFans I guess
Depends on you
OnlyPerms for the users who has permission to use the command
I will be changing it
I have to check if it exists
does anyone know how I can modify the announcement icon ? I am trying to do it but the only thing I can do, is to remove it ๐ I can't replace it
using CSS
what announcement icon?
I presume this one
yeah this one
yeah, I done it but I can't change font size
look at some profile, if they done an announcement, it will be shown on page
upper the long description
ok, since sending links would count as advertising, I'll talk about it instead(dm me if ur interested)
I have something called HideJS and it is a system that will take your backend callback function and modify it so that you can return HIDDEN client side script
Return frontend script to client that CANNOT be viewed by client side user. After all, why obfuscate code when you can just HIDE it
Like I said, directly message me if you're interested >:D
that doesn't sound like a good idea tbh
how so though?
i mean obfuscation of client side script exists in attempts to hide its ways from the user
because there's nothing wrong with obfuscating the javascript files
And if someone steals you can just file a lawsuit
uk this is my question right?
*this
yeah it's not a good idea because obfuscating already does a good job
but if lawsuits are on the table why try to hide it in the first place?
obfuscating your code isn't only done for hiding it, it also makes it smaller
because it aint the methods in terms of copywright sense.. it's methods of communicating with their server, stuff that needs to be loaded client side but they dont want the user to be able to imitate
true but it also is done for hiding it
Return frontend script to client that CANNOT be viewed by client side user.
this statement is just false lol
done
anything the client receives, the client can see
dm me for the link and try it yourself
would it be through websocket traffic
or anything
there is SSR
server sided rendering, where the rendering is done by the server, so the client doesn't really see everything
if i post the link here it's advertising so just dm me if u wanna find out
but that statement is just false
new pfp ๐
it's not advertising if we're asking you to give the link, I think
ohh ok
i'll give an example of a running one just in case the mods get edgy for posting a repository
HideJS example https://hidejs-example.paultaylor2.repl.co/
@vivid fulcrum did you lose your main or just decided to use an alt for some reason?
i lost access to the main
good job
i contacted support but no response whatsoever
What is the meaning of a shard?
as expected
splitting a big thing into a bunch of smaller things
well that sucks
Required modules that MUST be in their DEFAULT form are compromised I'm getting this popup
for this link, find the alert script
yea that's for if u mess with alert when loading it
open the link in a new tab
can't even open dev tools because of the popup
this is what it shows me..
it doesn't show anything for me
are you opening it in some place that doesn't use alert?
hm.. this IS strange.. lemme load it on firefox and see
ik..
ik what that alert means.. but for not seeing an alert?
thanks for the feedback.. different browsers seem to work very differently with my code(even though im not trying)
i've said it before and i'll say it again
you can't hide front code from the client
even if you encode it in something
the code for decoding is going to be on the front
oh but you can
using a websocket and evaling the code, I guess? Unless the dev tools allow you to see websocket transfers as well
google and me having problems proves that you can't
people obfuscate sometimes because "hiding is impossible"
but it is.. im just not sure what's going on with my tabs and urs
dev tools allows you to see websocket traffic as long as it isn't encrypted
for other uses, use wireshark
you can see all traffic with wireshark
btw can u stop assuming how I attempt to HIDE my script?
i literally... didn't?
o..k
until someone who wasnt the brightest, strongest or most charming found out that the world was round
people said it was flat
it's not like i said i hacked the nsa or some impossible chit
I just gotta get my code to work with other browsers.. gonna run some experiments
be back later today :D
if i tell you "i want this chocolate"
and you tell me "then eat that chocolate"
i cannot eat the chocolate before you give me the chocolate
once you give me the chocolate, it's over, i have it, i can do anything i want with it
anything the end user receives can be read
you didn't invent anything new
that's with chocolate, not with server client communication.. they're similar but some things make it NOT THE SAME
things like headers that you can't imitate
it would be really funny if all you did was SSR and pretend it was something new lol
things like headers request information that give contexts that you cant replicate
when i make it work with yall browsers.. try to find the alert code
@vivid fulcrum new light theme pfp ?
sure
yup :p
ok cya
Emotions are jumping from frustration to be pleased within seconds in this channel 
how do people not get that if you send something to the client, the client is going to be able to read it no matter what
otherwise the browser would not be able to execute whatever was sent to the client
I'm somewhat excited, I'll be learning React today ๐
you're in for a ride, react is so much fun
~(^o^)~
(node:24) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions
at RequestHandler.execute (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:170:25)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:24) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 88)
It says To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict
How can I do that?
"DiscordAPIError: Missing Permissions"
I know.
This stupid error won't shut up.
I putted an intense amount of try catch blocks on all events, and stuff, but yet won't stay shut.
node file --unhandled-rejections=strict
that's probably because you have a misunderstanding of promises
If I would want to undo?
just restart the process
it would do what the error says it would do, kill your node process on an unhandled promise rejection
anyway
the reason why try catch is not working is because you're not awaiting the promise
also
instead of wrapping in a try catch
Oh goodness, To Terminate, I just understood.
...just check if you have permissions to execute the action in the first place
you missed something somewhere
God knows why, I think it's from the events.
events dont need permissions
they're doing an action in the event
Sometimes the bot doesn't have permissions to send messages from the events.
Like guildMemberAdd
sure, you can wrap in a try catch and forget about it, but remember that it's still costing you a request and contributing to the global ratelimit
that's why you should always check if you have permissions to do the action in the first place
also also
remember that channel permissions have priority over guild permissions
Ok, where exactly.
wherever you're executing an action ๐คทโโ๏ธ
I'm not able to know what is causing this error to develop.
before executing your command, first check if your bot has permissions to execute the command in the first place
//pseudo
//take this as fun command that sends an embed
async execute() {
//if we don't have send message permissions OR embed link permissions here, lets not execute the command
if(!sendMessages || !embedLinks) return;
//if we got here, we know the bot has permissions to send messages and send embeds
await send(...);
}
just a small example
you should do these checks before executing any sort of action
banning, kicking, sending a message, executing a command...
is there a way to view pdf files uploaded to discord without it downloading?
no
ah
I'm already happy on how this is going, even if I haven't written any code yet xD
Alright. Let me rewrite an example of a code just to understand more.
const { MessageEmbed } = require("discord.js");
const { cyan } = require("../../other/colors.json");
module.exports = {
config: {
name: "dice",
aliases: [],
usage: "!dice",
category: "fun",
description: "Rolls a dice!",
noalias: "No Aliases",
accessableby: "Members"
},
run: async (bot, message, args) => {
// This was before.
/*const dice = Math.floor(Math.random() * 5) + 1;
const embed = new MessageEmbed()
.setDescription(`Your dice landed on ${dice}!`)
.setColor(cyan)
return message.channel.send(embed);*/
// This is after
if(!sendMessages || !embedLinks) return;
const dice = Math.floor(Math.random() * 5) + 1;
const embed = new MessageEmbed()
.setDescription(`Your dice landed on ${dice}!`)
.setColor(cyan)
await return message.channel.send(embed);
},
};
Like that?
yes, but sendMessages and embedLinks is just a placeholder in my pseudo code, you need to replace that with actual permission checks in djs
await return is not a thing
also that
Why the await though?
can't I just return?
Yes, I guess that.
returning without the await will return Promise<Message>
returning with the await will return Message
.. and must be in async.
Hey, I have a problem:
const logsnuke = message.client.channels.cache.find(channel => channel.name === 'suggestion')
My bot is in 2 servers, I test a nuke command, but he sends the logs in the wrong server.
How to return if its not the server where the command has be executed?
correct
Lastly, am I supposed to do this in every single command?
Put the if statement check
query the guild instead of your client
.. or can I make it in the message.js?
I add if (!message.guild) return;
?
yes, keep in mind you should adjust the permission checks to the according permissions the command requires, for example, a ban command would need to check for banMembers, an embed command would need to check for sendMessages an embedLinks etc.
no
or just
const logsnuke = message.client.channels.cache.find(channel => channel.name === 'suggestion')
to
const logsnuke = message.client.guild.channels.cache.find(channel => channel.name === 'suggestion')
works this?
guild is not a property on a client
oh
you're close though
so I need to do what?
take a guess
idk
guess
WoopS <---
:/
and i'll tell you if it's correct or wrong, and where you went wrong
euhhh
no, that'll just get them back to their original problem
const logsnuke = message.guild.client.channels.cache.find(channel => channel.name === 'suggestion')
?
const logsnuke = message.guild.channels.cache.find(channel => channel.name === 'suggestion')
?
yes
see, it wasn't that hard
i'm telling you to guess because it makes you think
oof
Doesnโt work for anyone unfortunately 
๐ At least I'm happy I understand the documentation for once now! ๐
the first pinned message of this channel strikes again i guess
Btw, cry. Should all my message.channel.send(...) have an await before them? like await return message.channel....
Like in all my commands?
returning without the await will return Promise<Message>
returning with the await will return Message
once again await return isn't a thing
but it's really up to you, if you don't await you'll return Promise<Message> and the command execution won't wait for the send to finish
if you await you'll return Message and the command execution will wait for send to finish
If you wanna await the result to do others things after, if not no
if you ask me, awaiting is better in all cases, follows the async all the way pattern
So, I'll take that as a yes, and yes, I remembered return await, correct?
yup
for the most part, the checks will prevent the command from executing if the bot doesn't have enough permissions
Sweet!
you can further expand this by allowing replies on what permissions are missing etc.
the limit is your imagination
design it however you want
Just keep a logical structure and donโt check if a client is allowed to use a command after it has been executed already

that tip should immediately promote me to a god like role
anyone else have problems trying to connect to the vsc market place
No.
No.
uuuhhh
message.guild.createChannel('test',[{
type: 'role',
id:args[0],
permissions:328896
}])
.catch(console.error);
message.guild.createChannel is not a function
Requests invite privileges for invite commands not included in the bot I don't know why I'm looking for an expert who can help
you don't have permissions for whatever you're trying to do
from what i'm seeing it's fetching invites
which would mean you don't have permissions to manage invites
no reason to lead invitations
??
the bot is not coded to do anything with the invitation
The best part is if I do CTRL + Z, it opens 390 tabs! ๐
v12 dont know v11 i know
sucks to be you
you're going to have to update soon enough regardless as v11 is granted to break this year
Is there a website that can automatically convert v11 codes to v12?
no
huh... I'm smelling a new business project
i understand
your best bet is changing your code gradually by going through the changelog
Thanks
bot.GetServerCount = async function(){
const promises = [
bot.shard.fetchClientValues('guilds.cache.size'),
];
Promise.all(promises)
.then(results => {
const totalGuilds = results[0].reduce((acc, guildCount) => acc + guildCount, 0);
return totalGuilds
})
}
bot.GetUserCount = async function(){
const promises = [
bot.shard.broadcastEval('this.guilds.cache.reduce((acc, guild) => acc + guild.memberCount, 0)'),
];
Promise.all(promises)
.then(results => {
const totalMembers = results[0].reduce((acc, memberCount) => acc + memberCount, 0);
return totalMembers
})
}
``` Hi! Can someone help me out? Both of these functions come out as undefined. Anyone know why? I used await when calling the function.
btw what browser did you open it on to get that?
chrome
very interesting.. do u got some strange settings on chrome?
i tried opening chrome all kinds of ways.. gonna try chromium and see if it does that
I don't think so
const Discord = require('discord.js');
const { deletionTimeout, reactionError, reactionSuccess, pinEmojiId } = require('../../config.json');
module.exports = {
name: 'setlogs',
description: `Crรฉe des channels pour les logs du serveur.`,
usage: 'nuke',
requiredPerms: 'ADMINISTRATOR',
permError: "โ Tu n'as pas la permission !",
async run(message, args, prefix) {
const staffRole = (args[0]);
if (!args[0]) {
let msg = await message.channel.send(`Conseil de pro : ${prefix}setlogs (id du role Staff)`);
msg.delete({ timeout: deletionTimeout });
return message.react(reactionError);
}
message.guild.channels.create('test',[{
type: 'role',
id:staffRole,
permissions:328896
}])
.catch(console.error);
}
}
yes
but not works
check the doc link i sent you for create
there's a sample on how to use it properly
exports.run = async (client, message, args) => {
const clausping = new Discord.MessageEmbed()
.addField(`**Pong!!**`, `**${client.ws.ping}** ms`)
return message.channel.send(clausping)
}
exports.conf = {
enabled: true,
guildOnly: false,
aliases: ["ms"],
permLevel: 0
};
exports.help = {
name: 'ping',
description: 'Ping Command',
usage: 'ping'
}; ```
this is not working, what is the problem
tor and firefox(well tor is modded firefox in the first place) return nothing..(I think firefox tries to use a normal xhr like fetch or xmlhttprequest separate from the script loading and if it doesnt get anything.. don't load the script ig)
but as for the chrome doing that. still didnt see that yet
be back soon
exports.run = async (client, message, args) => {
const clausping = new Discord.MessageEmbed()
.addField(`**Pong!!**`, `**${client.ws.ping}** ms`)
return message.channel.send(clausping)
}
exports.conf = {
enabled: true,
guildOnly: false,
aliases: ["ms"],
permLevel: 0
};
exports.help = {
name: 'ping',
description: 'Ping Command',
usage: 'ping'
}; ```
this is not working, what is the problem??
who can say, i dont have many times
you don't use args
should i delete args?
Delete and test
ok
@viscid gale i just opened your site in edge and it took me less than a minute to get your script
that's the script that loads the hidden script
not working @earnest phoenix
u didnt find the hidden script
whats your command handler?
message.js
thanks for proving my point lol
-bots
What
you're straight up doing a request that fetches the script
What is DeathABot
Me?
no
k
so im not very dumb either
dig as long as u like
-bots
Huh
fr ^^
can someone please tell me why my bot isnt sending welcome messages
i enabled intents too
ik, but can you imitate the fetch, NO
if it's so simple.. pls find the script
sry
actually i'll make it a challenge, https://hidejs-example.paultaylor2.repl.co/ is the url.. alert('HIDDEN SCRIPT >:D\nAt...\n/') is the hidden script.. find it >:D
the earth is not flat, client side script can be hidden from user
bot.GetServerCount = async function(){
const promises = [
bot.shard.fetchClientValues('guilds.cache.size'),
];
Promise.all(promises)
.then(results => {
const totalGuilds = results[0].reduce((acc, guildCount) => acc + guildCount, 0);
return totalGuilds
})
}
bot.GetUserCount = async function(){
const promises = [
bot.shard.broadcastEval('this.guilds.cache.reduce((acc, guild) => acc + guild.memberCount, 0)'),
];
Promise.all(promises)
.then(results => {
const totalMembers = results[0].reduce((acc, memberCount) => acc + memberCount, 0);
return totalMembers
})
}
``` Hi! Can someone help me out? Both of these functions come out as undefined. Anyone know why? I used await when calling the function.
you're not returning anything
for bot.GetServerCount u return nothing
help me please
๐ฅบ โค๏ธ
GetUserCount too
I used return though?
you didn't use return for Promise.all
technically but that's a function INSIDE the then
Ohhhhhh.
So, how would I fix it?
return the Promise.all?
as a const value?
Just add return I guess
Okay. Thanks!
same
now to make sure ur not capping.. I'm gonna change the hidden script to a comment.. do the same thing and senda pic
what
multiple people already told you it's possible and proved it
you're just making requests
it's loading an iframe lol
you're not really smart
bot.GetUserCount = async function(){
const promises = [
bot.shard.broadcastEval('this.guilds.cache.reduce((acc, guild) => acc + guild.memberCount, 0)'),
];
return Promise.all(promises).then(results => {
results[0].reduce((acc, memberCount) => acc + memberCount, 0);
})
}``` This would work... right?
bet you're embarrassed rn @viscid gale
try it and see
Okay!
no.. im gonna keep trying until i can do it
it is possible
you can't
any error?
try {
rMember.roles.add(role.id).catch(e => {
embedError.setDescription(tryError);
return await message.channel.send(embedError);
});
} catch (err) {
embedError.setDescription(tryError);
return await message.channel.send(embedError);
};
Cry, how can I async this?
half of this code seems to be stolen anyways
try {
await rmember.roles.add(...);
}
catch (err) {
return await message.channel.send(embedError);
}
also you're copying window objects lol
just in the network tab of devtools
can i use https://www.npmjs.com/package/i18n on discord bot?
I don't see any examples (except express)
not copying.. checking to see if they're the same
The blue part of your code is there to fool people, it doesn't really do anything, the red parts make a post request to the same URL, and _pw seems to be a secret one-time key which gets the script
respect the role hierarchy by checking the member's highest role position and the bot's
yes you can i want to get my bot to use it too
declaring
yeah that's why i said a lot of that code seems to be stolen
bruh
just the docs are shite
how
you're a clown
like i said the docs are shite, have to figure it out too
it isnt there to fool people but the second part is correct..
can you stop trying to throw insults when u arent even saying anythign correct?
just make a webserver and send requests to it
ez
BRO you literally keep claiming you can hide front code WHEN YOU CAN'0T
LMFAO
he is correct tho??
I have seted all the modrate commands to $onlyPerms[ban;kick;Error msg)] the meaning the user's hwi has one of those permission ban or kick he will be able to use is this that command is this allowed too?
@pale vessel Servers: undefined Users: undefined Didn't work. Should I share my code?
if you hid the front code then the browser wouldn't be able to render it,, how isn't that going inside of your head???
stop embarrassing yourself
i said it's possible.. i never said I copy objects from iframes
Sure
this is genuinely the worst thing i've seen in here so far
message.guild.channels.create('test')
message.channel.overwritePermissions(args[0], { READ_MESSAGES: true, SEND_MESSAGES: false})
.catch(console.error);
y r u getting so toxic over it.. im the one taking the critisism
I have a error :/
bot.GetServerCount = async function(){
const promises = [
bot.shard.fetchClientValues('guilds.cache.size'),
];
return Promise.all(promises).then(results => {
results[0].reduce((acc, guildCount) => acc + guildCount, 0);
})
}
bot.GetUserCount = async function(){
const promises = [
bot.shard.broadcastEval('this.guilds.cache.reduce((acc, guild) => acc + guild.memberCount, 0)'),
];
return Promise.all(promises).then(results => {
results[0].reduce((acc, memberCount) => acc + memberCount, 0);
})
}
``` Code.
because you keep claiming you're doing the impossible
when you aren't
you're just clowning
honk honk
or maybe it was that dude who couldn't make an object after 6 months of js

