#development
1 messages · Page 646 of 1
then developer mode on
ok
noone will help with unreadable code. if you want us to help, dont make us decipher the code as well
kk
installing beautify as said by @carmine echo
@opaque eagle I am in discord beta
oh
use it
PTB or canary?
how?
Oh
how to use beautify?
im not on beta/canary and its in behaviour for me as well
Weird'
canary on desktop
Monster is on phone
ios
uhh
i found it here
Press F1 and search for beautify file
Doesn't Discord use some sort of framework to convert web code to mobile code
kinda like electron for mobile
As I've already told you @cursive gale
If your pc is so slow as you say, you should consider using sublime text instead of vscode
but if vscode works use it
i do use it
@vague chasm thanks I'm copy id
@earnest phoenix now give id here
Then
now?
553230054830899250
there
btw you can send code in discord like this:
```js
// code goes here
```
lol we did it at same time
ik
go to this link @earnest phoenix
Is user id the same as client id?
yee
let commandfile = bot.commands.get(cmd);
let cooldown = new Discord.Collection()
let coolsecs = commandfile.help.cooldsecs
console.log(cooldown)
console.log(cooldown.get(message.author.id))
if (commandfile) {
if (cooldown.has(message.author.id)) {
console.log('User was on cooldown')
console.log(cooldown)
console.log(cooldown.get(message.author.id))
let cooldownemb = new Discord.RichEmbed()
.setColor(287361)
.setTitle(`You have to wait ${coolsecs} before you do that command again`)
.setFooter(" © Skymod 2019 by typical Gta#5594. Current ping = " + bot.ping.toFixed(0), 'https://i.imgur.com/B4yHD4K.png')
return message.channel.send(cooldownemb)
} else if (!cooldown.has(message.author.id)) {
console.log('User did not have cooldown')
cooldown.set(message.author.id, coolsecs)
commandfile.run(bot, message, args);
console.log('I have set cooldown for ' + coolsecs + ' seconds (' + (coolsecs * 1000) + 'ms)')
} else cooldown.set(message.author.id, coolsecs)
}
setTimeout(async () => {
cooldown.delete(message.author.id)
}, coolsecs * 1000)```
@carmine echo
that's my code
why do you have so much async everywhere
wait no
uhh @vague chasm put all those async
tru
What if the bot is private? 🤔
Noo... we forgot to add scope=bot
oh ok
await needed async that's y
:))
:D
Thanks all😁😁😁
see @vague chasm u r good
@cursive gale nu
nu
nu infinite and reverse card
ads??!?!?!!
np
wait
this?
@split hazel no that user did not know how to make invite link
oh i see
Why
cauz owner dosen't want u to
bot's can be private @earnest phoenix
and you can do nothing to make it not private
except for begging to the owner of the bot
How I'm invite in my server @cursive gale
you can't
Private bots
invite private bots
Yes @cursive gale
you cant

I want loco @mossy vine
@cursive gale please bro
What is going on?
If the bot is private, you can't invite it. Talk it out with the owner or stop trying
many people want their bots to be limited to their server only
so people do that to their bots and only bot owner can make it public @earnest phoenix
let commandfile = bot.commands.get(cmd);
let cooldown = new Discord.Collection()
let coolsecs = commandfile.help.cooldsecs
console.log(cooldown)
console.log(cooldown.get(message.author.id))
if (commandfile) {
if (cooldown.has(message.author.id)) {
console.log('User was on cooldown')
console.log(cooldown)
console.log(cooldown.get(message.author.id))
let cooldownemb = new Discord.RichEmbed()
.setColor(287361)
.setTitle(`You have to wait ${coolsecs} before you do that command again`)
.setFooter(" © Skymod 2019 by typical Gta#5594. Current ping = " + bot.ping.toFixed(0), 'https://i.imgur.com/B4yHD4K.png')
return message.channel.send(cooldownemb)
} else if (!cooldown.has(message.author.id)) {
console.log('User did not have cooldown')
cooldown.set(message.author.id, coolsecs)
commandfile.run(bot, message, args);
console.log('I have set cooldown for ' + coolsecs + ' seconds (' + (coolsecs * 1000) + 'ms)')
} else cooldown.set(message.author.id, coolsecs)
}
setTimeout(async () => {
cooldown.delete(message.author.id)
}, coolsecs * 1000)```
my code
it dosen't add to the map welp
@mossy vine now?
cooldowns[id] = coolsecs
hmmm
let cooldown = {}
maps are more efficient tho
Is it possible to check whether the bot is connected to mongoDB and, depending on the result, perform a certain action? P. S. Module: mongoose Thanks in advance!
@earnest phoenix is typing for the last 15mins
@mossy vine sorry to ping but can you tell me why it's not adding it to the map? i sent my code and problem over 5times now
Maybe he doesn't know. I wouldn't continually ping him
No
ok ;-;
@cursive gale Is this within message event? You need to make it oustide of message event
because if not, then on message event it is creating a new collection
idk if this is your question
@spare goblet thanks for your help and yes i think i know why i was getting the issue
Great, have a good day! 
how to log a deleted message?
which library and which language?
what is what
const Discord = require('discord.js');
const client = new Discord.Client();
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
console.log(`Online`);
});
client.on('message', message => { ///By KillerFox_
var prefix = "$" ;
if(!message.channel.guild) return;
if(message.content.startsWith(prefix + 'ac')) {
let modlog = client.channels.find('name', 'verify-yourself'); /// m غير اسم الروم اذا تبي
if(!message.channel.guild) return message.channel.send('**هذا الأمر فقط للسيرفرات**').then(m => m.delete(5000));
var b = ['5587' ,' 9978' , '3785' , '7734' , '9864' , '7681' , '3758' , '7834' , '3489' , '1382' , '7389' , '8762' , '0889' , , '7681' , '3758' , '7834' , '3489' , '1382' , '7389' , ' , '9524' , '0964' , '5930' , '5678' , '9567' , '603' , '9876' , '9846' , '9685' , '8574' , '8975' , '9845' , '9862' , '0069' , '0807' , '0673' , '0813' , '1235' , '6879'];
var b3 = Math.floor(Math.random()*x.length)
message.channel.sendMessage(`\n \`${b[b3]}\` ** : اكتب الرقم التالي للتفعيل **`).then(msg => {
var r = message.channel.awaitMessages(msg => msg.content == b2[b3], { maxMatches : 1, time : 60000, errors : ['time'] })
r.catch(() => {
message.delete()
r.delete()
msg.delete()
})
r.then(s=> {
message.member.addRole(message.guild.roles.find("name", "test")); /// الربته التجي للشخص
msg.delete();
message.channel.send(`**تم تفعيل حسابك.**`).then(m => m.delete(1000));
})
})
}
});
client.login(process.env.BOT_TOKEN);
var b3 = Math.floor(Math.random()*x.length)
x is undifiend
how
2019-06-30T14:34:51.311244+00:00 app[worker.1]: ReferenceError: x is not defined
you didnt define x lol
XD
I don't see anything in that code that shows const x = stuff or let x = stuff
and start beautifying code
@onyx summit
sa
as
Can someone help me, i want to do my bot in my phone using Dcoder app
i know where i should put the const x = stuff
but i dont know where i put the let x - stuff
forgive me for the bad english
let and const are the same, only that you can't modify the variable that was declared with const
ya hiç türk ve bana yardım edecek yokmu
tamam yokmuş
hi
Is there anyone who can command me to make the bot active 24/7
Oof
i command you to make the bot active 24/7
How do I check if a certain npm package is installed globally via code?
sa
I need some help, I have no idea how to make multiple userID's able to access a command, and I've checked the documentation along with trying everything I could think of, I have set up a JSON file called botmasters, in there I have ID's of my most trusted users who are "bot masters" and should have access to every command, but the commands keep denying the bot master's perms anyone know what I could do?
@obtuse wind what lang
most have <manager>.author.id
so
for py rewrite ctx.message.author.id == (your ID as string)
I usually use message.author.id != botMasters(...)
And I dont use Py I use Atom, & Node.js
Oh
They are very similar to py then
honestly I just would make it "if equal" to your id
Otherwise just do nothing
That's what I do for my eval and say command
aight thx, oh and nice PFP
still a nice pfp though
Look at this as a meme if you want idc my bot has image manipulation
I'm proud about it too
wat
eh
@earnest phoenix You can put images in embed
i know
that's why i said
"which is why it's in an embed"
the image url of the embed is set to the above's generator url
wot? i just said you lied about having image manipulation and instead using a website for it, aka exposed you
It uses that site for the image manipulation tho
No Argue
This is getting off-topic, stop arguing
Argue bad
What's your question?
dont ask to ask
tag a bot to a channel?
Yes
What does that mean exactly?
One sec
You mean like invite a bot to your server?
First of all you need to tag the channel where you the message that you would like the ReactionRole to go onto.
You need to reply within 5 minutes of this message before I cancel it, this also goes for every single question that will follow.
You can also reply with cancel any time and I will stop asking you questions and stop setting up this reaction role.
Looks like you need help with a specific bot, in which case you should go ask in their support server.
This place is for developers who write bots
How would I achieve what @vale fossil has done, and create a minecraft sign generator in discord.js
toy around with http://bimmr.com/signs/
that is the api
How does it work
http://bimmr.com/signs/Sign.php?Line1=&Line2=&Line3=&Line4=
idk how to customize that and get the file back
the url already sends a file, all you have to do is populate the url parameters
via?
wat
how? i'm so lost
how do i get my bot to do it
with magic
http request
what
build the url in your code then send a get request
i seem like such a noob, how do i do that? How doi get it user customizable as well
node-fetch, request-promise, axios, etc
url*
lot of libs
build the url with the users arguments
and then send a get request to the url with one of the libs
that's really unnecessary
the site returns the image already
you can put the url that generates the image in an embed
oh wow even better
great api lol
then its super easy just populate the fields and youre done
request-promise is bloated as hell
What does this mean?
if you need to refresh the render call forceUpdate
never set state in a render call or other lifecycle functions because it will cause a loop of rendering
Does anyone know of a way for my bot to start up again on server restart? Thanks in advance!
what library are you using?
Javascript
well actually now that I think about it that's irrelevant, are you using linux?
I'm using node.js
you can use pm2
what are you hosting it on
It's running on a Linux vps with node. But, ill give @mossy vine's thing a try. Thanks!
and great pfp cyber 😂
it is exactly what you need for restarting your bot when the server or the bot restarts/errors
thanks
imo pm2 is one of those things that a developer working with node.js must be familiar with
yes
Okay
you can install it directly with npm
does it configure linux services automatically as well?
wdym
I've never used node.js backend
Once started, your app is forever alive, auto-restarting across crashes.
Restart even across server restart with startup scripts that can be generated with `pm2 startup`.```
Installing on my vps now! 😀
in discord.js is there anyway to make the bot go offline immediately.
cause if you just stop the code it takes like a minute to go offline
process.exit()?
call destroy on the client
it stays alive for like 15 seconds if you exit the process because of how heartbeating works
ahh okay thanks a lot
And if discord doesn't receive a heartbeat back by the set interval it will mark it as offline
hello guys, I have a problem with the api in my bot, it does not show how many servers my bot is on, neither in the profile of my bot or in the widget.
Excuse my English, I speak Spanish.
On your DBL bot page or on discord?
Make sure you are a: using correct headders when posting and b: make sure you're actually posting the server count
There is a hashmap that all shards should use during shanding, how can I give them all hashmaps? discordjs
they can both read and edit hashmap
I couldn't find a good answer.
uhh
im kinda stuck
im usin djs commando
and i'm thinking of ways to do a daily command to get credits of some sort
but i can't think of an efficient way
i'm gonna use mysql for the currency storage btw
@quartz hill why would you use a hashmap
If you use internal sharding it treats all shards as one
But normally you can access them by doing broadcastEval
Also you don't need to individually give them hashmaps
The way sharding works is that it makes an individual process for each shard
So having a map in the code will give one to all of them
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
just go to my teacher, he will do the same but scream while doing it
and don't do linq, or he will scream even louder
Command looks fine
https://hatebin.com/lybkziqqao
error
(node:9552) UnhandledPromiseRejectionWarning: RangeError: RichEmbed field names may not be empty.
at RichEmbed.addField (C:\Users\Aidyj418\Desktop\CB Helper\node_modules\discord.js\src\structures\RichEmbed.js:163:33)
at Object.exports.run (C:\Users\Aidyj418\Desktop\CB Helper\commands\mason.js:13:4)
at Client.client.on (C:\Users\Aidyj418\Desktop\CB Helper\index.js:104:8)
at Client.emit (events.js:193:13)
at MessageCreateHandler.handle (C:\Users\Aidyj418\Desktop\CB Helper\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
at WebSocketPacketManager.handle (C:\Users\Aidyj418\Desktop\CB Helper\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:105:65)
at WebSocketConnection.onPacket (C:\Users\Aidyj418\Desktop\CB Helper\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (C:\Users\Aidyj418\Desktop\CB Helper\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
at WebSocket.onMessage (C:\Users\Aidyj418\Desktop\CB Helper\node_modules\ws\lib\event-target.js:120:16)
at WebSocket.emit (events.js:193:13)
(node:9552) 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(). (rejection id: 1)
(node:9552) [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.
DJS
There isnt a field name that is blank so idk
Is that code from mason.js?
mhm
are you sure that's the version loaded by the bot?
eg you didn't just edit the file without retarting the bot/reloading it
mhm

Btw
Client is already defined in the upper scope
Hey, so how would I get the number of all the users in all the servers my bot is in, without counting any multiple times? I know how to exclude bots, but I need help with the rest.
Thanks
lang/lib?
Oh lmao so sorry Discord.js
if you're not sharded/using internal sharding, counting the number of users in client.users should work as long as you fetch all users
otherwise there's no reliable way (besides sending tons of data around between processes)
Ok, I'll try that, thank you!
Discord.js Fetching to Cache All Members
Stable:
https://discord.js.org/#/docs/main/stable/class/Guild?scrollTo=fetchMembers
Master:
https://discord.js.org/#/docs/main/master/typedef/FetchMembersOptions
@olive path This caches all members as guilds over 250 will lose some users in memory.
Is it possible to make a command that will send a message to like 6 channels and I can specify the message that it sends?
yes
how would i get all the channels?
Yes, but you'll need to use a delayed task as sending messages to multiple channels will cause a ratelimit.
depends on the lib how
djs
if you have the ids of the channels you can use client.channels.get("id") for each channel
the library should handle ratelimits
individual lines?
@drowsy sentinel arent the ratelimits per channel
but even if you stay inside them you can still get banned for api abuse
couldnt i use await in an async function
get isn't async
no one said it was
_>, he's referring to the command execution
That's too much @smoky spire, you could just do foreach textchannel in guild.channels
but he said specific 6 channels
^
you'll have to get each channel individually
Just filter for then
that would also work
D.js handles ratelimits and if you only once send 6 messages at the same time nothing will happen
Ok thanks!
but I think the message send ratelimit is per channel anyway
Yop
there's also the global one
Six messages isn't gonna hit that
So If i get all channels and have it send a string it will work?
yes
Thanks
how do I implement this after the "rewrite":
bot.remove_command("help")
How to know bot commands @thick bough
@thick bough please understand me clearly how I know bot commands @thick bough please
#502193464054644737 @earnest phoenix
@cursive gale help
@thick bough {bot instance}.remove_command('help')
this should still work for rewrite
can I see whats right before and after the line?
it should be one of the first lines after creating that bot instance
you put that line before you actually defined client
place it three lines after its current position
@thick bough help me bro
dude i'm newbie xD i'm here asking for help
what do you need help with?
I don't know my bots commands @robust acorn
what do you mean? can you be more specific?
How I know any bots commands @robust acorn
what library or language are you using?
@thick bough you really shouldn't define client twice
how can i do this man? sorry but i'm really newbie
what about the Bot(command_prefix="=") part? try getting rid of the two lines after and use that line without the #
it should work fine
Im assuming the purpose of the two lines is so the bot analyzes messages that ping it?
the prefix can be a list like (prefix1, prefix2)
589372091615150081
I put the "#" to temporarily disable that line, does that affect anything?
This bot id
that's not even here
@grim aspen I have a bot
i can tell
@grim aspen but I don't know this bot commands
How I know bot commands @grim aspen
Sorry bro but I'm not know very well English
Please help anyone
@earnest phoenix look up “discord permissions calculator” check the perms you want to give it. then insert your client id where i tells youtoo
can you guys be more specific?
prefix = ("prefix1", "prefix2")
client = Bot(command_prefix=prefix)```
this is enough to define client, @thick bough
if you want the bot mention to be a prefix, use <@{id here}> as a string
@earnest phoenix, these are the discord.py documentation for the current latest version, 1.2.3. You might want to check them out.
https://discordpy.readthedocs.io/en/latest/api.html
https://discordpy.readthedocs.io/en/latest/index.html
Was that bot made by you?
No
How I made a bot
You want to make a bot?
Yes
What coding languages do you know?
There is a way how to create bots, but they can't be just "powered on". They need to be writed in node.js/python etc and they need to be hosted
If you want to keep it 24/7
Sorry for typo
It isn't just js or python
@earnest phoenix sorry but I can't
I think you're gonna have to try and learn to code by yourself bud. If you want to make a discord bot you should take some time with learning a programming language and using tutorials to get started. There is plenty out there, so no need to ask people here to make bots for you
@earnest phoenix
take your time to actually read the documentations
Yeah, you can search on youtube for "how to make a discord bot"
Or something like that
We all start somewhere. If you want to make something, take the initiative and go out and learn and try :)
@earnest phoenix thanks
@wheat jolt thanks
@robust acorn thanks
You're welcome
How do for this? this be red?
With the different code blocks
which part is red?
Nvm.
Well with the bot you can add a code option so for example .send("msg", {code: "css"})
if thats what youre asking
@earnest phoenix
Thanks.
diff\n - words here xD
i have this code
it tells me i cant do the daily command
when i havent even used it yet
im making it record the time
@topaz fjord The reason I use a hashmap is to prevent other commands from accessing the currently used database line.
@earnest phoenix ?? How may i help you?
Their question was answered
Please don't ping me when I'm not on as it's very painful to check all the pings an answer all of them
Ohh ok @slender thistle
nekos.life
But i think nekos.life has nsfw
@red atlas heard of nekos.xyz but i think most are also nsfw
nekos.life has many lolis/minors so thats why it's not preferable
Virtual Private Server
Ah yeah private
Js
What library can I use to make xp bar?
Like in mee6
Hello My Bot Dm answered he was thrown. But don't you have to ask me or warn?
@latent oasis js
xp bar in a canvas
or in a embed?
Could anyone dm a link for vps
Digital ocean good vps
OkY
Yes its not free
Oh
What is the vps for
Heroku, glitch
WhT is that
Not a vps, but you can host your bot here
You can’t host on glitch it won’t start but ok
So use heroku
Okay
Or if you dont want to use free vps, use your computer
Yes
How can I get count of all messages in guild? discord.js
Turn off the monitor
It’s a regular pc
Unless you count every message as it's sent
message.channel.messages.map(u => u. content)returning last 200 messages
and message.channel.messages.size returning 200
But yeah, if you want to count every message, add a count in the client.on('message') events
can someone explain 1. how shards are used
2. what they are used for
3. when should i implement them
ok
you don't necessairly need 2,500 guilds, it's best to start a bit earlier than that actually.
It's like say, instead of one big walmart there are a lot of small walmarts
It's best to start sharding around 2000 guilds as it gives you time to work out issues
I just added sharding support for my bot and it made the 2nd shard whenever it wanted to
How do I add a welcome command to my bot?
in discord.js
In the guildMemberAdd event
It gives an error
Send the error
I don't think he sent a mistake right now.
I will try and come
@earnest phoenix Does Not Send Error, but Does Not Work
Maybe a bad return
I guess the command is wrong
Is there anyone who can send me this command?
No spoonfeeding
Just send your command
Maybe someone can help u
Why not?
It is indirectly
It is kinda related to suicide, I wouldn't suggest putting that as your activity
whats the best thing to write javascripit in
sublime text
Thats visual studio code
Shoo
Decorators 
What for? Dm me owo
https://github.com/tc39/proposal-decorators this for klasa

My bot dont send any message when I run a command
it doesnt have errors on console
Show us some code, otherwise its like a murder mystery without any evidence or clues
Library and Language?
`const Discord = require('discord.js');
Is that all?
hi
hi
Try doing npm rebuild sqlite3
did not work
Could you show me your package json @quartz goblet
Package.json file
Was about to show you but np
Try running
node-gyp rebuild
Glitch for you.
Dillon Yes
Try running npm install -g node-gyp
Also, Your version of quick.db is behind. Latest is like 7.0.0
what is the message edit limit .-.
@quartz goblet then fucking download it I dont care if it's not. Download it.
@soft plaza the title you can.
Format:
<:name:EMOTEID>
Tho I need to change it dont i

@west spoke like this?
code block
add \
yeah but its not a custom one
Then I believe you would use unicode symbols
At least that's what you can do for reactions
Ah.
guys no module found name "discord.js"
heres my code
no
I dont care about your code
you need to install discord.js
npm install discord.js
@hoary current
Wtf is my bot logo not Changing?
hm?
Your bot xx was declined. Reason: Your bot has a publicly available token.
what does it mean? Tokens is accessibility by everyone? I didn't understand this.
@plain bough Token on github
@plain bough ask to @coral trellis
@plain bough you do
@quartz hill what database are you using
Most have an auto locking so that data doesn't get messed up
Ok, so I thought I knew how to do this... but apparently I don't... Oops lol sorry. I'm using Discord.JS and for some reason this is returning errors. (I'll send the errors in a pastebin in a sec) bot.users.filter(member => !member.user.bot).size (I tried replacing the use of bot with Client for the whole file, but got the same error)
I'm trying to get the number of all non bot users
the error would def help
you're thinking that the collection holds guild members
in a sec
it holds users, not members
oh yeah there ya go
it should be user.bot
You mixed up member and user. Just make it (user => !user.bot).size
Because you used the member variable on the filter, it kinda just confused ya. That is my guess
mysql free host I don't think it's such a feature.
Wait I get it. Sorry I was just getting the error to put it in a pastebin
@quartz hill it does
I've ran multiple shards with MySQL and haven't had any issues with reads and writes
@earnest phoenix run npm rebuild sqlite3 it should fix it
If an operation is confirmed within 10 seconds, a command executes the operation. I'm disconnecting access to the row in that database in 10 seconds.
is this possible to handle every missing permissions error with one code?
hi guys, can a friend using lavalink in music commands send me a private message? my code javascript.
Singularity, use the .hasPermission method on the bot's guild member.
is there any other way?
Uh, if you want to just ignore the error, then you can connect to the error event and match the "Missing Permissions" keyword, I guess?
🤔
i want to ignore all missing perms errors
How would I have multiple args in one command?
Such as h!command <arg 1 goes to one field> <arg 2 goes to another> etc
What lib
djs
You can split by spaces
I got half of it I just need to split the args into multiple ones
.setTitle(args.join(' '))
.setDescription(args.join(' '))
.setFooter('ChannelBot Suggestions')
.setTimestamp()
.addField('Category', args.join(' '))
.setColor('00e3ff')
``` So far I have this
So How can I split the args
dont .join() them or .spit()
How do i define split
It's a method on a string
^
fuck it i give up
@red atlas Well it shouldn't be spamming editing messages
just found that in my logs
Yes because we need to check if NSFW content is in non-nsfw channels
Wait a second, isn't message logging forbidden by Discords ToS?
I'm getting an Error 403 on any command that uses Request(url, headers={'Mozilla/5.0'}) then does an urlopen(req).read()
It's hurting my head as to why and I just woke up so brain is not 100% working. This was working completely from the day I wrote the code to sometime last night, I can assume.
needed to monitor it
Anyway, who maintains the Github Repositories and the DBL Libraries for Golang?
Is it possible to auto add reactions in a command?
how to over write permissions of a channel when a new channel is created?
@spice mango look at the GitHub the person who commits likely does
@ember atlas explain what you mean by “auto”
you mean me?
@smoky mica what lib
discord.js
I write a command and the message that the bot sends, auto adds 2 reactions
await and then msg.react('emoji')
@smoky mica https://discord.js.org/#/docs/main/stable/class/GuildChannel?scrollTo=overwritePermissions
assign the message send a variable so you get the message object, then check the docs for a way to add reactions once you have a message object, i'd assume
it's like that in discord.py but i wouldn't know for .js
i'd assume it's not too different?
@smoky mica I can add the emoji id right?
how to check members permissions on the channel?
@ember atlas await the message send or put it in a .then and you can .react on the new message
code
@plain bough https://discord.js.org/#/docs/main/stable/class/GuildChannel?scrollTo=memberPermissions
I cant just use msg.react('emoji') ?
In the new message you have to
when the bot sends a message, assign a variable to it
Cuz you have to wait for said new message
thanks
so i can await the msg.react under the message.channel.send?
yes
Example
.send().then(newmsg=>newmsg.react(etc))
ok ty
Or newmsg = await .send()
newmsg.react(etc$
i'm still dying because of this dumb 403
To the discord api?
It grabs a request from a site like some-random-api.ml or nekos.life and it worked fine before
but now it's just sending me 403
let me repost the initial message;
I'm getting an Error 403 on any command that uses Request(url, headers={'Mozilla/5.0'}) then does an urlopen(req).read()
It's hurting my head as to why and I just woke up so brain is not 100% working. This was working completely from the day I wrote the code to sometime last night, I can assume.
message.channel.send(suggestionembed)
await msg.react('')
await msg.react('')
Would this work?
Boss no
no
You have to await the .send
why
Then no you can’t automatically do it 
Cuz no one is going to help you
Yea it’s called the internet
Isnt it just wait the message, and then add the reacts
Google it
i have like two full sections of my bot closed off because of this 403
Well then I dont need to be getting help from you if youre gonna act like this. I actually learn better by getting help from others.
Pythr it means you don’t have permission to do something specific, this is really endpoint specific based cuz they can all mean different things
I understand what a 403 is
It's just the fact that it worked perfectly before
Which is throwing me off
Right but no one is gonna hold your hand 24/7 if you can’t learn yourself don’t even consider yourself a developer. You’ve got your answer please stop talking here unless u have a new question. That wasn’t meant to be rude I can’t express well over text lol
then they changed their auth system or your token expired
403s usually mean you have the right auth you just don’t have access to that endpoint
Atleast In dapi it is
dbl uses 403 for exactly that
401 is token
403 is endpoint
So it doesnt work. Its saying msg isnt defined.
well i changed it to message
still not defined
So that would be why msg isn't defined?
ur using js right?
well message is defined.
But msg isn't
Because I got a diff error when trying that
but msg not
whats your code now
const discord = require('discord.js');
exports.run = async (client, message) => {
const suggestionembed = new discord.RichEmbed()
.setTitle('Reaction Permissions')
.setDescription('It is almost like a reaction role, but instead when you react you get permissions to view a channel.')
.setFooter('ChannelBot Suggestions', 'https://cdn.discordapp.com/avatars/594568982342664194/275908a4c33320f641404a8afa74288d.png?size=2048')
.setTimestamp()
.addField('Category', 'Channel Management')
.setColor('00e3ff')
await message.delete()
await message.channel.send(suggestionembed)
message.react('')
message.react('')
}
msg = await message.channel.send
msg.react
then why doesnt it say message isnt defined
because you delete the message
because u have it in the async
don't u have a test bot or something
One message removed from a suspended account.
a 24mb pdf lmao
im not reading 430 pages
im trying to get this to autoreact and i dont know why its ot working
One message removed from a suspended account.
as others already told you, you're trying to react to the message you deleted, not to the message you just sent
well i need to fix that
@ember atlas
msg.react(...)```
and what will work
that
that will work
this place is so helpful, thanks for your help
which is also what i told you to do before 
(node:13356) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
emoji_id: Value "595288390782550036>" is not snowflake.

insert repost of the have you tried: reading the error image
Wait you dont need <> for the emoji id?
no
No. An ID is numbers in a string
Well even that it messed up
Even if you were supposed to
You had one >
unless you're using discord.py-rewrite, in which case, ids are ints because life hates you
lol
Is it a Discord Nitro emoji?
do you have an emoji in that guild
Like ones across different servers
with that id
yes
I would make sure it is the correct ID again. Just re copy it
ads
I just looked at my code and had a 'ohhh, that's what i did wrong' moment, then I got the same exactly error.
lol
lol
@abstract crow someone is spamming ads lmfao
It was a my bad
Where?
I have a question.
Example:
If my bot is in 1000 servers and has 2 shards and I want to post shards+servercount to the DBL api, do I post (shard id, 500 (for 500 server per shard)) or (shard id, 1000 (full server count))?
the problem that i have with my 403 issue is that every single report of the problem online leads people to say "well use a header" and links some useragentstring website yet no header has worked for me, despite all of these commands working fine yesterday
403? Authorization!
the reason I think it's related to my agent-user is because the first time I got a 403 relating to these commands was because I needed the agent-user to make it work
and that's the only part of the command that I can change really to make it work
aka i have no clue what to do by you saying 'authorization' i am very lost
Google status 403
you know
that response just now
means you have not read
any of what i have said
User Agent doesn't really matter
403 is endpoint being locked for you usually but I have no clue what endpoint exactly
I'm trying to use both nekos.life & some-random-api.ml
and any command relating to those two don't work
Do those require authentication upon requests
I had to switch from urllib to Request() just to use them because of the User-Agent thing
Because before it would spit a 403 at me if I used urllib

It was working fine for a few weeks
and now it's coming back at me with the error
403 for undefined user agent...
well, that would be a neat way to solve this, but i've tried three different user-agents that I've obtained through three different ways.
'User-Agent': 'Mozilla/5.0' (it worked fine up until now and I had no reason to change it)
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:64.0) Gecko/20100101 Firefox/64.0' (found from a list of user-agents)
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:64.0) Gecko/20100101 Firefox/64.0' (from a network tab off the site itself)
It's also not throwing a 403 through the request
it's throwing a 403 through my urlopen(req).read()
I feel like there's something blatantly wrong here but I really can't see what it is
Just to make sure, these two are the same, right? js Object.assign(this, { client, name }); this = { client, name, ...this };
I haven't tested it myself, but I'm pretty the first one keeps the instance while the 2nd one just contructs an emtirely new object. So it wouldn't have the <Constructor Name> {...} for the 2nd one
which I think are different
ok
also one more thing
Nothing shows up on the console when the client logs in```js
class Client {
constructor() {
const functions = Object.getOwnPropertyNames(this).filter(e => typeof this[e] === "function");
for (const func of functions) {
this.on(func.slice(2), (...args) => this[func](...args));
}
}
onReady() {
console.log("Connected!");
}
}```
Are you sure that line is being executed/where you ran it
if (!message.member.roles.has(["594588784671064065", "594588905190326297", "594588967144390656"])) return message.reply("You need to have a premium subscription to use this command!");
I have one of the roles
Am I dumb or something? Why does that not work? I am on master discord.js
@grave pilot use .some() instead of .has()
Will try
(node:5904) UnhandledPromiseRejectionWarning: TypeError: fn is not a function
at Map.some (C:\Users\erikn\Desktop\manager-v3\node_modules\discord.js\src\util\Collection.js:280:11)
at Map.store.(anonymous function) [as some] (C:\Users\erikn\Desktop\manager-v3\node_modules\discord.js\src\util\Util.js:459:23)```
Did not really work
I never even used fn
That is why I am lost
I know what it says
Check the location for the stack trace @earnest phoenix
const { Premium, Users } = require("../databases/manager/db.js")
const moment = require('moment');
exports.use = async (client, message, args, command) => {
if (!message.member.roles.some(["594588784671064065", "594588905190326297", "594588967144390656"])) return message.reply("You need to have a premium subscription to use this command!");
Mind telling me where I use fn?
C:\Users\erikn\Desktop\manager-v3\node_modules\discord.js\src\util\Collection.js:280:11
that error is coming from node_modules
The issue is .some
the stack trace is the stack trace...
It's this part... 🤦 at Map.some (C:\Users\erikn\Desktop\manager-v3\node_modules\discord.js\src\util\Collection.js:280:11) at Map.store.(anonymous function) [as some] (C:\Users\erikn\Desktop\manager-v3\node_modules\discord.js\src\util\Util.js:459:23)
stable or master? @grave pilot
Master
You need to pass in a function then
It was deprecated in stable, and now removed in master
Awe
Pass in a function to thatjs message.member.roles.some(["594588784671064065", "594588905190326297", "594588967144390656"])
Then I need to make a function
What do u wanna do with that code in the first place?
To much work
That's not too much work
Yea
["594588784671064065", "594588905190326297", "594588967144390656"].some()```
Now in that function check if the author has the role with Map.has() for message.member.roles
Lemme check
Would
["594588784671064065", "594588905190326297", "594588967144390656"].some(message.member.roles.map())
Work?
No
nope
you can also just do t => [].includes(t.id) in the .some
Yeah that works too I guess





