#development
1 messages ยท Page 1305 of 1
how can i access files in another folder in the main folder
hacktober might've been the worst possible time i could've looked to put up PR's evrywhere though.....
so like for example: i have a folder with the bot file and a folder with cogs
just extend the query
@fluid basin but i think that's checks for both queries to be valid
and i have extra files
like is it possible to use an OR
do i put them in the cog folder?
like this query or this
@opal plank not sure, if v8 requires breaking changes, they will be forced to make a v13, and since major versions are rare, they will use it to push as many breaking changes as possible most likely
bruh check mongodb docs and examples well since I'm feeling great today:
{$or: [<CONDITION1>, <CONDITION2>]}
hmmm i see
i might go ask them again in a couple days if they want some PR's for typescript
free internet points

i dont think they're much interested in TS atm, since djs-next will be 100% ts
ye ig
though what they said is very true
if you using Ts, chances are you know what you are doing
im not even interested in hacktoberfest tbh
i just so happened to get a couple PR's recently, it matched amazingly poorly with hacktober
i did some other private repo PR's before for training/practice about documenting libs, but recently ive been trying to get some commits on some stuff more public since im much more confident about it now
hrm basically tl;dr for v8 is just intents and ratelimits for gateway and a bunch of other stuff for api
its a festival/event I guess
not really a competition
tfw they increased PR duration x2
@quartz kindle wink wink hows it going pretty young man, you wouldnt like some bs prs on your lib would ya? 
lmao
no stars? yall harsh today yikes
they've only got 70k shirts this year
also new update you can only submit PRs on hacktoberfest labelled repos or get your PR labelled manually as hacktoberfest-accepted
Gotchu erwin
doubt they'd be deprecating v6 anytime soon
thats true
i'll switch asap though to be safe
at least a few months
i'll check the pros/cons of it
thats just the online rn devs
er well yea
theres a lot more than that
;-; dang ok
v7 didn't really exist (well maybe in clients I suppose)
how do i make a command that is like !pay @earnest phoenix (amount)
cuz if i do arg and member
its !pay (amont) @earnest phoenix
real money?
no
xD
just like how can i make the user the second arg
fr tim
and the first arg is the amount
@drifting wedge just do args[0] and args[1]
@quartz kindle when 50% of the changes are table fixed to accomodate the longer descriptions lmao

bruh legit this shit...
im not seeing much here that will break the end user experience tbh
most of this seems changes in how the connection is handled, most stuff moved to different enpoins, and some stuff has been removed, though it doesnt seem like stuff the general user uses
unless im doing a big oversight on something
better formatting on errors too
v8 is basically v7 turned official plus some minor changes lol
imagine having the job to fix lineups
what job? just let people with ocd do it for you for free
ez
put something awful in the very top and let them review the rest after being triggered by the first 2 lines

xD
tim how does d.js cache currently work?
not even 3 weeks ago i asked em' the same question, ish
One message removed from a suspended account.
One message removed from a suspended account.
well yes
One message removed from a suspended account.
@earnest phoenix #memes-and-media
One message removed from a suspended account.
lol
One message removed from a suspended account.
i used vpn
One message removed from a suspended account.
It auto update time
One message removed from a suspended account.
One message removed from a suspended account.
How lmao
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
ima redo my os
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
I~I
Apparently what i'm trying todo is Extremely basic SQL, but i'm sat here confused off my tits, on what i actually have todo.
the docs are annoyingly confusing..........
Ended
@clever thunder Why are you reacting to everything
it was a shyevent
Can I check if the website is on dark mode?
I mean
wouldn't the background color chage
zane should be a moderator on this server honestly
He will get burnt out on helping people like everyone else
My first two weeks i was in here 4 to 6 hours a day atleast
Please keep this channel on topic uwu
.bot-img {
background: transparent;
background-color: rgba(0, 0, 0, 0);
border-radius: 50%;
animation: bounce 1s infinite alternate;
-webkit-animation: bounce 1s infinite alternate;}
.bot-img img {
height: 100%;
border-radius: 50%;
}@keyframes bounce {
from {
transform: translateY(0px);
}
to {
transform: translateY(-15px);
}
}
@-webkit-keyframes bounce {
from {
transform: translateY(0px);
}
to {
transform: translateY(-15px);
}
Current css
Trying to set border-radius: 50%
For some reason not working at all
how do i add ID functionality
For...?
for example for a user info command i want to able to input an id and make the bot detect the user through id inputted
const member = message.guild.members.cache.get(args[0]) || message.mentions.members.first()```
args[0] would be the ID argument.
ok thanks
๐
Also you are going to want to do it like this:
const member = message.guild.members.cache.get(args[0]) || message.mentions.members.first()
if(!member) return message.channel.send(`Member not found`)
@mild flower
So it doesn't error if either of the 2 are not fulfilled
yeah i already had that but thanks
hey
So, how do I setup the thing where it can do "1 Vote", "2 Votes". etc?
like autoroles
So, how do I setup the thing where it can do "1 Vote", "2 Votes". etc?
like autoroles
oop wrong link
@brittle eagle You mean each user add a vote?
If reactions, just check the amount of reactions
Like whenever someone votes, it will show how many times u vote
Database
what that
Search for user upon vote, if not found create a new entry for the user with 1 vote
Then each time just add a vote
Into the database
on the internet?
No
Search up databases to use
MongoDB and MySQL are 2 good ones
Then do what I said with one of them
hey is it possible to get the colour in hex code of the highest role color of a member?
hoist role color
ahk
idek
if i wanted ot create a class that does the following: ```js
const Data = new Data()
console.log(Data)
would logjs
1.0.0
in js of course in case it wasnt obvious
uh
i see lots of websites tht hab xyz
mee.xyz??
its just a domain name
^
is there a way to code one not paid
nope
๐ฆ
unless you have your own server
wuts dat
heroku
a
oh
server
uh
bcs funny
no I dont think so
all websites are paid
@karmic compass not some like .tk or .ml
if i wanted ot create a class that does the following: ```js
const Data = new Data()console.log(Data)
would logjs
1.0.0
lmao excuse me what
Tk is free domains
bro...
AUGER
Freenom is the right site
it isnt loading
Definitely a wonky one. But it'll get you there
and rock on
@karmic compass if you wanted to do that, you'd probably need to provide your own implementation of the toString method when declaring the class.
||it redirects to freenom||
The warning sign next to the domain 
how do i prevent this?
Prevent?
prevent what
uh so ive added an if statement at the end of my kick command to verify that the member kicked is still not in the server but it doenst seem to be working
let kuser = message.guild.members.cache.get(args[0]) || message.mentions.members.first()
if(kuser != message.guild.member) return message.channel.send(Eked)
@faint prism it didnt work
how do i prevent this?
@fervent goblet cant you just substring the []
from the titel
But i still want it there
Can I ask a question?
how do i send a message ONLY when the user specified has been kicked?
if(kuser !== message.guild.member) return message.channel.send(Eked)
i tried this
[ with \[
tried that
Markdown provides backslash escapes for the following characters:
\ backslash
` backtick
- asterisk
_ underscore
{} curly braces
[] square brackets
() parentheses
hash mark
- plus sign
- minus sign (hyphen)
. dot
! exclamation mark
@ me if you have a solution
how do i send a message ONLY when the user specified has been kicked?
if(kuser !== message.guild.member) return message.channel.send(Eked)
i tried this
yeah
When you perform the API action to kick the member, resolve the promise and send it when it's succeeded.
yes thats what im asking how
kick(...).then(() => {
// do something when the user has been successfully kicked
}).catch((err) => {...}) // do something when the user wasn't kicked```
\[**${nowPlaying.song.info.title.substr(0, 30)}...**\](${nowPlaying.song.info.uri})
@boreal iron i did this and i still get the same issue
ah k
cant I like
host locally
ok
how do I use vercel
can I just make a github ras
that is just index.html
and nothing in the html file?
and just
@fervent goblet That doesnโt work.
You need to replace the brackets inside the title not the markdown link []()
[**${nowPlaying.song.info.title.substr(0, 30).replace("[", "\[").replace("]", "\]")}...**](${nowPlaying.song.info.uri})
If that doesnโt work, too just use ``Title...``
Keep in mind to escape both brackets. Itโs just horrible to type code blocks on mobile.
Hello can anyone help me with this?
@bot.command() async def role(ctx): roles = ctx.guild.roles for role in roles: await role.delete()
I am trying to delete all roles in my server with this command
what exactly is the problem
https://hastebin.com/jasavulanu.apache hey I'm trying to install packages from npm on google cloud but it's giving me error
why would you want to delete all roles ?
@earnest phoenix
@earnest phoenix How do I edit the site now
I setup a basic html
I updated it
and commited to github
the website didnt change
@earnest phoenix becuase I am trying a new comamnd where it deletes all roles and catagories and channels
Its for migrating my server
so.. a nuke bot? ๐
Yea
But i prefer the name server builder
Lol
We can't help here, as it's API Abuse,
Oof

Yea ik
Its api abuse
I feel like u would use that for bad.
^^
But
I need for migrating server
Im stuck on trying to make a mee6 type bot
Cuz i am joining my friends server
Wait i have a question
?
I cannot have a comamnd which destroys all channels and catagories and then recretae new channels and categories??
I cannot have a comamnd which destroys all channels and catagories and then recretae new channels and categories??
@earnest phoenix Negative
Yikes
Kk I am going to remove that command
@earnest phoenix I am sorry but support for api abuse isn"t given here or in the official discord.js server
@earnest phoenix language?
I am sorry but support for api abuse isn"t given here for official discord.js server
@finite bough what are you talking about
who said anything about d.js

Im guessing discord.js is good
d.js caches everything in sight
yes
How do I get discord.js
idk google it
What is the best free database to use?
Idk
db
I have an array with some words in it, How do I get a word by only having a part of a word.
let search = 'bana'
let array = ['apple', 'banana', 'car']
must return banana
Hello
Can anyone tell me how to make bot for lock the channels
๐ค
@everyone
Can anyone tell me how to make bot for lock the channels
@glossy lantern What do u mean
update channel overwrites
Whats carl?
Carl bot
message.channel.updateOverwrite()
message.channel.updateOverwrite(message.channel.guild.roles.everyone, {
SEND_MESSAGES: false
})
Just stop
Dyno
take the code
apste in in your thing
boom
magic
bye
case closed
nothing to see here
Plssss tell
HE SENT THE CODfe
๐ญ
SoMEONE KILL ME NOW PLEASE
message.channel.updateOverwrite(message.channel.guild.roles.everyone, { SEND_MESSAGES: false })
all u had to do was scroll up...
Ok
myghad
@carmine summit you shut go away from here๐๐๐
I have an array with some words in it, How do I get a word by only having a part of a word.
let search = 'bana'
let array = ['apple', 'banana', 'car']
must return banana
I have an array with some words in it, How do I get a word by only having a part of a word.
let search = 'bana' let array = ['apple', 'banana', 'car']must return
banana
wym?
@carmine summit you shut go away from here๐๐๐
@glossy lantern toxic much
๐
how can i run my bot scripts in my pc
is node.js is good ??
Theres some hosting websites or somethinh
Nodejs is great
You can host locally, but your pc will need to be on 24/7 for the bot to be on all the time
Ideally you'd get a vps which costs a bit a month
You can host locally, but your pc will need to be on 24/7 for the bot to be on all the time
@solemn latch na just for testing
i forgot how for loops work,
is the middle parameter i < 10 or i > 10
Then yeah just testing thars fine
Either
^
guys give me server info best embed code
Hm?
for node,js
Could be any conditional statement
wdym either
We don't spoonfeed code @earnest phoenix
If I is greater i-- or if is less i++
i++
We don't spoonfeed code @earnest phoenix
@solemn latch joking buddy
Then use the less than

ok thanks,,, My brain had a compressor. But it doesn't have decompressor
so yeah..
How do I cancel a for loop, then move on to the next code if an if statement becomes true
HELP HELP HELP
I think you might want a while loop not a for loop

A while loop is just a loop thats an if statement.
A for loop is a loop that runs x number of times(can be dynamic).
ok cool it works
Hello command is not working
what are u guys talking about ?
Hello command is not working
@glossy lantern show console
and code
Ok
message.channel.updateOverwrite(message.channel.guild.roles.everyone, {
SEND_MESSAGES: false
})
THAT SHOULD WORK
ORRRR
YOUR SERVER IS SET UP INCORRECT
FOR EXAMPLE YOU HAVE A MAIN ROLE, THAT HAS CHANNEL OVERIDES
THAT WONT WORK
I think it is updated
lemme checl
node and d.js
update NODE too
@glossy lantern what do you need?
@opal plank how to devlop bot for locking the channels
get channel, @ everyeone and overide perm to SEND_MESSAGE to deny
read that

@opal plank should i update to latest one?
or stable one
node
I am talking about
Alright thanks
LTS ??
latest
@dark kestrel bad idea, try NOT to use forEach(), like, EVER
use better loop functions
what do you want to do?
filter the role that has admin ignore them and permission overwrite the rest
also im fairly certain cache is a map, and im also rather confident filter() isnt part o Maps in JS
either spread it or iterate thru its entries/values
.cache = collection :/
which is a MAP
if you didnt know
filter() might be added to Collection
but filter() isnt native to Maps iirc
@opal plank
I just got this error
what can I do now
I need to shift to stable one i think
Waht
not talking to you
did you use STL?
TSL
something along those lines, i keep forgetting
LTS
LTS
almost there
LTS
sudo n latest
what?
@languid dragon before you go to bed i need help with another thing
shut up i know it's only 1 PM
yes
could you help me stack my dropdown elements vertically
this what i have currently
.drop {
position: absolute;
min-width: 160px;
z-index: 1;
display: none;
margin-top: 2%;
flex-wrap: wrap;
background-color: black;
padding: 10px;
float: right;
border-radius: 10px;
overflow: hidden;
}
.drop a {
text-decoration: none;
text-align: left;
padding: 13px 17px;
}
.drop i {
margin-right: 4px;
}
Ok so im using visual studio code, how do I fix this, SyntaxError: C:\Users\trent\Desktop\Momt's Mod\Data\config.json: Unexpected end of JSON input at parse (<anonymous>) at Object.Module._extensions..json (internal/modules/cjs/loader.js:1049:22) at Module.load (internal/modules/cjs/loader.js:879:32) at Function.Module._load (internal/modules/cjs/loader.js:724:14) at Module.require (internal/modules/cjs/loader.js:903:19) at require (internal/modules/cjs/helpers.js:74:18) at Object.<anonymous> (C:\Users\trent\Desktop\Momt's Mod\index.js:4:27) at Module._compile (internal/modules/cjs/loader.js:1015:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10) at Module.load (internal/modules/cjs/loader.js:879:32)
@earnest phoenix your json is malformed
Which part
When I look at debug console it shows, (node:12716) UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided. at WebSocketManager.connect (C:\Users\trent\Desktop\Momt's Mod\node_modules\discord.js\src\client\websocket\WebSocketManager.js:133:26) at Client.login (C:\Users\trent\Desktop\Momt's Mod\node_modules\discord.js\src\client\Client.js:222:21) <node_internals>/internal/process/warning.js:40 (node:12716) 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: 1) <node_internals>/internal/process/warning.js:40 (node:12716) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. <node_internals>/internal/process/warn
read the error @earnest phoenix
Ficed, ty
fixed*
How do I handle Discord system errors/exceptions? (not command errors) in discord.py?
for example, when the bot hasn't got the required perms
check your bot permissions before trying to execute something
@earnest phoenix
@bot.event
async def on_error
@earnest phoenix
@bleak glacier wrong channel
ok
Idk if this is the right channel to ask in, but I don't have of the accepted forms of ID for bot verification so how am I meant to verify?
I know it's not related to topgg I'm just asking
probably can't then
you can create a support ticket but i doubt they can do anything about it
This is so sad
you can ask your parents
Nah I don't want them to have verify me lol I'm old enough I just don't have it lul
well, good luck
Thanks
hm??
case 'warn':
let user = message.mentions.users.first()
if(!user) return message.channel.send(`you did not mention a user!`)
if(!args.slice(1).join(" ")) return message.channel.send(`you did not specify a reason!`)
warns.findOne({ guild: message.guild.id, user: user.id})
if(err) console.log(err)
if(!data){
let newWarns = new warns({
user: user.id,
guild: message.guild.id,
warns: [
{
moderator: message.author.id,
reason: args.slice(1).join(" ")
}
]
})
newWarns.save()
message.channel.send(`${user.tag} has been warned with the reason of ${args.slice(1).join(" ")}. \`\`\`they have now 1\`\`\` warn.`)
}else{
data.warns.unshift({
moderator: message.author.id,
reason: args.slice(1).join(" ")
})
data.save()
message.channel.send(`${user.tag} has been warned with the reason of ${args.slice(1).join(" ")}. they now have \`\`\`${data.warns.length}\`\`\` warns.`)
}
break;
ReferenceError: warns is not defined
warns is not defined
300 lines uwu
Oh what the fuck is that
vertical scaling
we must ask ourselve, how efficient is this in the long run
it presents a single point of failure in a larger infrastructure and thus thanks for coming to my ted talk that clustering is only a temporary solution

install quick.db then?
@tardy hornet npm i quick.db
@tardy hornet read. your. errors.
its npm install quick.db right?
yes

that what i was going to ask
imagine having your token leaked
no
please god not me
Me
oh lol

the only messages from clyde that i get are supportive messages saying your bot sucks and you should feel ashamed 
i did npm install quick.db
how do i check?
you got your terminal open?
const overSend = m =>{
let array = m.match(/.{1,3}/g);
array.forEach(str => message.channel.send(str))
}
```How can I define message?
yes
screenshot it
Can i ask one thing
no
Ok I will ask 2 then
just ask it
I got verified but they cant add my bot becaus eof max servers. Do I need to make them off
wait
I dont understand
its only for phyton @opal plank ?
erm, i assumed you were on js
First : What is contribution on github
I made a public repo
Now i want people to help me make code better
I have seen many repo's do contribute thingy
Can someone explain me how it worked
ello ello
yes
const overSend = m =>{
let array = m.match(/.{1,3}/g);
array.forEach(str => message.channel.send(str))
}
```How can I define message?
how do i install it on something else ?
First : What is contribution on github
I made a public repo
Now i want people to help me make code better
I have seen many repo's do contribute thingy
Can someone explain me how it worked
@delicate shore
Do i give them my account access?
so they can make pull
requests

@delicate shore check git/githup PR's
PR's?
Ohh
can I ask??
Lmao
uh
HAHAHAHAHAA
cAn SoMEoNe HelP ME
you need a folder containing the commands from the bot
im not even gonna ask why your display is screwed like that
XDDDDDDDDDDDDD
im not even gonna ask why your display is screwed like that
@opal plank AHHAHAHAHAHAHAHAHA
my language is spaghetti
@tardy hornet
I'm currently working on a bot for my server, and you know all the programming languages
const overSend = m =>{
let array = m.match(/.{1,3}/g);
array.forEach(str => message.channel.send(str))
}
```How can I define message?
id like to have some friendly debate in the effectiveness of clustering node.js processes
with anyone whos down to do so
clustering is an optional "feature" that nodejs provides
you can run your processes manually as well
yeah definitely @valid frigate, clustering is basically multi-processing which takes up all cores of your CPU/server
how do I split my string to arrays that has a maximum of 2000 characters?
get the first 2000, then skip 2000 and get the next 2000, etc, etc
In Python, how would I get a cooldown error working with retry_after?
I have a 123mb ram and 3 gb storage server to host discord bot . Anyone needed??
123MB of RAM?
yes
@slender thistle Seems sus
@twilit horizon What do you mean by "give it free"?
yes
In Python, how would I get a cooldown error working with retry_after?
I'd suggest implementing your own cooldown system or using commands extension's
... unless that's what you mean
Still need the error message working
The cooldown is fine, itโs the error I need help with
K, you know my DMs are open
how to filter letter from string? so 'hello everyone' and remove e becomes 'hllo vryon'
you can use .replace() or split the string by "" and use array.filter()
"hello everyone".replace(/e/g, "");
"hello everyone".split("").filter(x => x !== "e").join("");```
oop i just assumed you use javascript
but it's the same concept in any other languages
yay it works ty
nice man glad i could help
you would just take the wallet bal and deduct a value and add it to bank
using quick.db
i alr make but if i deposit nothing deducting in my money
hi, not sure whether this has been asked before. What's the best practice to run a bot in a production and test at the same time? So have a live current version of a bot that users use now, but have another version that I improve and want to test at the same time?
can I have 2 bots (with 2 different tokens) under the same application?
Two options:
-
Use one bot account, commands are attached to specific channels or a guild and a separate prefix. You would have to make sure the testing version is also restricted only to you if the channels/guild is/are public. Ratelimits might be an issue at some point, though, as you will use the prod bot account.
-
Create a separate bot account that can't be invited anywhere by non-owners and use it. Ratelimits will be less of an issue.
so in the second approach I create a new application and a new bot in discord
Mhm
๐
"can i have 2 bots (with 2 different tokens) under the same application?" Sadly that's not possible but there's an approach to this, create a private API where only you can use it, and send the main bot's data to the api, and pull that dafa from the second bot
So you can do tests
You can run multiple bot scripts under one token, which is the first option I listed
since a token is attached to a Discord application
It's possible to run 2 bots with the same token but anything you do on the second bot will also happen in the first, because they're using the same token
How to release my bot as a npm package
Mean if someone does
Const xyz = require('xyz')
xyz.token("")
So the bot will work
Wuth same function
As my bot
k
<Your entire bot here>
module.exports = {
token: function token(string) {
<client>.login(string);
return <client>;
}
};```
someone knows how to do a cooldown in command handler?
try using setTimeout
I've used it, but it still doesn't work for me
Best way to set cooldowns is to use a database
@earnest phoenix you can just use a map for cooldown data
I use collection but I'm pretty sure I'm wrong
map or collector are temp database tho
I know, map prototypes reset when you restart the bot
i doubt 5 second cooldown remainders will matter when the bot restarts
hi, is it looked better?
yellow button
button:hover {background:yellow}
yes
try what it says in Discord.js guide but I skip the command and the reply
background-color*
@zenith pecan Show code?
is the same as the one in the Discord.js Guide
Just show it
put your source code here without lacking your token
it won't let me connect, that's why
Connect to wot?
Or hastebin
Well rest in pepperonis
afaik, glitch is not that good, am I wrong?
Glitch is the best only for free hosting, but it's not efficient because it's not meant for bot hosting
it's because whoever did it does it in Glitch
So you copied someone's bot?
haha no, we do it together
ok, back to the point, "source code"
and we don't know how to do a cooldown, that's it
That's why we said provide source code as you said it doesn't work and bypasses the check
So we can check what the problem is
Well, as soon as my partner connects I will let you know since he does not let me enter the Project
or I will tell you about my logic for cooldown
I used setTimeout to add cooldown logic with it, and some function for the timer. I also use collectors
Okay
const embed = new Discord.EmbedMessage() // Set up your embed code
.setColor('#rgb')
.setDescription('description')
msg.channel.send(embed).then(message => {
setTimeout(() => {
// fill it with whatever you want
}, <cooldown>); // put the cooldown inside
})
This is what I currently using.
so, the setTimeout() will affect how long it should be work again
and it works fine?
it works fine, however, I didn't copy paste all my code here
so, there are probably some mistakes
Okay
@pale vessel Thanks for the #development message
@open rune and how do I put the reply message?
message.reply(' ') ?
the message that says how much time is left
more or less
<Your entire bot here>
module.exports = {
token: function token(string) {
<client>.login(string);
return <client>;
}
};```
@earnest phoenix
Oh
In the main file ?
Right ?
And I can upload it as a npm package ?
But like I check ./storage.json
So do I need to change the oath
Path*
To something like node_modules/ehwiekd/usiejeid
Something like this
What?
@earnest phoenix
Means that only code will work without changing location of any files ?
You don't need to change to location of the file
Alright
And then I can upload my npm package ?
@earnest phoenix one last thing
Like currently my bot is open source
People clone it and put their token in config.json
So will the config.json file effect npm package ?
If I put this code in the end
module.exports = {
token: function token(string) {
<client>.login(string);
return <client>;
}
};```
It's not like you have to detect that file
Means M
Lemme edit it so it warns them if they don't provide a token or an invalid one
https://cdn.discordapp.com/attachments/761662699058495519/763720195793485844/unknown.png is this error caused by the discord api changes?
try {
var reg = new RegExp("([a-zA-Z0-9]+://)?([a-zA-Z0-9_]+:[a-zA-Z0-9_]+@)?([a-zA-Z0-9.-]+\\.[A-Za-z]{2,4})(:[0-9]+)?(/.*)?")
if (reg.test(message.author.presence.activities[0].state)) {
if (!message.member.hasPermission(`MANAGE_MESSAGES`)) {
message.delete()
message.author.send(`${message.author} You have an advertisement set as your custom status, and as such you are being prevented from chatting `)
}
}
} catch (e) {
}```
<Your entire bot here>
module.exports = {
token: function token(string) {
if (!string || typeof string !== "string") throw new TypeError("Expected a token, and it must be a string");
try {
<client>.login(string);
} catch(err) {
throw new Error("An error occurred when trying to login, error: " + err);
}
return <client>;
}
};```
@delicate shore Here
Ok thanks
try {
var reg = new RegExp("([a-zA-Z0-9]+://)?([a-zA-Z0-9_]+:[a-zA-Z0-9_]+@)?([a-zA-Z0-9.-]+\\.[A-Za-z]{2,4})(:[0-9]+)?(/.*)?")
if (reg.test(message.author.presence.activities[0].state)) {
if (!message.member.hasPermission(`MANAGE_MESSAGES`)) {
message.delete()
message.author.send(`${message.author} You have an advertisement set as your custom status, and as such you are being prevented from chatting :NM_peepoOfficer:`)
}
}
} catch (e) {
}```
@gentle lynx
Which message are u deleting ?
I mean
Is the command being executed
Or is it in an event
it's in the message event
I mean what is execution
if somebody has an ad in their status their message will get deleted and the bot will DM them
but the bot DMs them twice
and i got this error
It's because you're trying to send the message while the user's message is being deleted
should i put the message deletion after the DMing?
resolve the promise
try {
var reg = new RegExp("([a-zA-Z0-9]+://)?([a-zA-Z0-9_]+:[a-zA-Z0-9_]+@)?([a-zA-Z0-9.-]+\\.[A-Za-z]{2,4})(:[0-9]+)?(/.*)?")
if (reg.test(message.author.presence.activities[0].state)) {
if (!message.member.hasPermission(`MANAGE_MESSAGES`)) {
await message.delete()
message.author.send(`${message.author} You have an advertisement set as your custom status, and as such you are being prevented from chatting :NM_peepoOfficer:`)
}
}
} catch (e) {
}```
how do I check if a port is in use using express
@earnest phoenix Why do i get this error
I have a file
package.json
you can see
how do i like change EVERY mongo db post in a db?
Every document?
@delicate shore Are you running npm publish in the directory where the files are?
Every document?
@slender thistle so basically im making a Intrest command
which every 32 hours, it multiplies everyone's bank by 1.02*
updateMany with {} as the filter
{would be like all the ids?}
like how would i get the ids?
also would it be easier for it to just be a command?
like they run !intrest
etc\
<Role>.setPermissions()```
You mean, you want to remove permissions from a role?
It's possible to do something like this
<Role>.edit({
permissions: {
allow: [<allowed permissions>],
deny: [<denied permissions>]
}
});``` i think
role is undefined
let role = message.guild.roles.cache.find(r => r.name === "Muted");
that's what i used
Is there a role with the name "Muted" ?
Try to add some console.log output, or set a breakpoint
I did when it cant find a role named Muted
He creates a new one
Does that mean it always attempts to create a new role currently?
the role creation?
Yes
also, that else if won't continue where the if left off. It'll skip the logic inside if a previous conditional is true
hello
I have a problem with the role creation do u know why?
const bot = new Discord.Client();
const token = "";
bot.on("ready", ()=>{
let channel = bot.channels.cache.find((x) => (x.id === "759428694711336960"))
channel.join()
bot.user.setPresence({ activity: { name: 'Playing Music ', type: "PLAYING" }, status: 'dnd' })
console.log(`${bot.user.tag} is setup `)
});
bot.login(token); ```
whats wrong
I have a problem with the role creation do u know why?
@balmy anchor https://discordapp.com/channels/264445053596991498/272764566411149314/763736588470976542
What's the problem tho
so i should use a permissions calc ?
No
it says invalid token
@next flax sounds like it isn't though. Have you tried regenerating the token and trying again?
HM
permissions: {
allow: [],
deny: ["SEND_MESSAGES"]
}```
โ
```js
permissions: []```
@balmy anchor
So to deny the perms i will need to use <Role>.edit()?
You can also pass it when creating the role.
You can't choose to allow or deny permissions on role, you can either set the role to allow it or don't set the permission to deny it
You can't choose to allow or deny permissions on role, you can either set the role to allow it or don't set the permission to deny it
So How can I do it?
<RoleManager>.create({
data: {
permissions: new Discord.Permissions(0)
}
});
Or just js permissions: []
@warm marsh but how do I define the permission I want to use?
permissions: ["PERMISSIONS_HERE"]
Either calculate the permission's bitfields you want to set or use their flags
Yeah, I've already understand this but I want to deny a permission and not allow it
For example, the default bitfield is 104324673 so we find the bitfield of the send messages, and subtract from it
To deny a permission from the role, don't set the permission

It's me again,
Does anyone knows how to deny role's permissions at all the text channels in the current guild?
I saw something like this but it just creates a channel
@balmy anchor are u trying to make a new role or editing a given role
im trying to edit a specific role's permission at all channels in the guild
overwritePermissions
Im trying to figure and find a bot that does response and reminds like this
yea
u can also use forEach()
something like forEach(<Guild>.channels) {
//CODE
}
?
Because it's API abuse
@earnest phoenix I still dont understand what api abuse means OwO
can you please put the code in a code block (3 `)
Voltrex Master#0001 I still dont understand what api abuse means OwO
@balmy anchor discord.js is a library to handle interactions with the discord api
It makes api calls for you. Like how your browser handles talking to websites for example
this is hurting my brain
.login-form{
margin-top: 10rem;
background-color: #24252a;
width: 300px;
padding: 5rem;
}
How i can fix this ?
ok
putting code in plain text and not in
code blocks```
is hurting my brain
Much better. Looks like Discord now lol
โฌ๏ธ
@balmy anchor Best way to do this is
let channels = [...<Guild>.channels.cache.array()];
let permissionSetInterval = setInterval(() => {
if (!channels.length) return clearInterval(permissionSetInterval);
channels[0].overwritePermissions(<overwrite here>);
channels.splice(0, 1);
}, 180000);```
Something like this?







