#development
1 messages ยท Page 899 of 1
well idk then i dont use python
dont remove the msg part lol
you still need to get the guild from somewhere, so msg.guild gets it from the message
bot reviews take a few days up to 2 weeks
uh..
welp im a noob programmer
client.on("message", msg => {
msg // this is your Message object
msg.guild // this is the Guild this Message was sent in
msg.channel // this is the Channel the message was sent in
msg.guild.channels // this is the channels that exist in the guild where the message was sent in
msg.guild.channels.create() // this creates a channel in the list of channels that belong to the guild where the message was sent in
})```
what's your bot url
@earnest phoenix top.gg/bot/astrobot
@proper mist thats not defining a variable, thats just making use of a structure that already exists
its called Object Oriented Programming
you can however define variables using that structure as you want
let guild = msg.guild // define guild as the guild where the message was sent in
let channels = msg.guild.channels // define channels as the channel manager of the guild where the message was sent in
This is my code
client.on('message', msg => {
if(msg.content.startsWith('/channels')){
let channelname = msg.content.slice('/channels'.length); // cuts off the /private part
msg.channel.send("Creating 50 New Text Channels Named: " + "**" + channelname + "**")
var i;
for (i = 0; i < 50; i++) {
setTimeout(() => {
guild.channels.create(channelname,{type: 'text'})
.then(console.log)
.catch(console.error);
},1*1) //3 seconden
}
}
and when i use the command
it says that guild is not defined
Hello, I was wondering how I could put a photo on my bot, the image is corrupted ๐
Sorry i'am brazilian, my english is bad
i do understand
You mean, put a picture as pfp?
then your error should be self-explaining
As you can see, the image looks like this, I wanted it to be the image of my bot
๐
what do you guys reward your bot users with for voting/donating?
define 'premium' ๐
yea, but what kinda command might that be
lmao
Does your bot have economy
player: help
bot: please donate for help
yes
๐
has msg.guild.channels.forEach
been updated in discord.js v12? if so, what has it been updated to
channels.cache.forEach
yea, my bot has resources, gold, gems, special shards, metal, etc etc... i have tons of things i can offer as voting rewards. just not sure what people might expect as such rewards
i dont have vote rewards at all
i dont wanna force people into voting for no reason
but encouragement is always nice ๐
are votes even worth anything?
hey! where there are virtual internet points/score/displayed integer to be had, i want it, and i want it big numbers!
lmao
anyway i dont have any command that could be vote-locked
my premium features are locked behind donations
yea im not overly keen on locking commands behind votes
i'd rather reward users with like, something they can use within the bot
my bots a game, so i can easily give items and w.e junk
channels.cache.forEach(channel =>
yeah i dont have anything like that
channel not defined 
oh xd
was just kinda wondering what kinda things others generally reward people with
about the object oriented structure
everything comes from somewhere
your starting point is msg
so everything must start there
ok
just because i said channels.cache.forEach doesnt mean you should remove the msg.guild part of it
because channels.cache.forEach applies to EVERYTHING that can give you a list of channels, which you can get from other places, not necessarily from msg
for example when a member joins a guild, you would do member.guild.channels instead of msg.guild.channels because the starting point is different, but the channels.cache part applies all possibilities
so then its channels.cache.forEach.msg.guild right? cause iw ant each message in that channel? right?
my logic is flawless ๐
For this you can also look up the js docs 
and the v11 -> v12 changes guide
๐
what are you trying to do?

๐คฆโโ๏ธ
if(msg.content.startsWith('/massnick')){
let nickname = msg.content.slice('/massnick'.length);
var i = 0;
channels.cache.forEach(member =>{
i++
}
)
msg.channel.send("Changing names of **" + i + "** members to **" + nickname + "**")
msg.guild.members.forEach(member =>{
member.setNickname(nickname)
}
)
}
Anyone know when they are gonna open up verification
@earnest phoenix you mean official discord verification?
pretty sure you can already apply for that
you can
you just need to have your bot in 75+ servers
^
if(msg.content.startsWith('/massnick')){
let nickname = msg.content.slice('/massnick'.length);
var i = 0;
channels.cache.forEach(member =>{
i++
}
)
msg.channel.send("Changing names of **" + i + "** members to **" + nickname + "**")
channels.cache.forEach(member =>{
member.setNickname(nickname)
}
)
}
how do i define channels ;c
But turnaround time currently is probably about a month
Uhmmm... that code is... interesting
what
ยฏ_(ใ)_/ยฏ
I have already applied for official
well this probably isn't the best place to ask
Ah ok
welp how do you define channels
Mb
im stupid
@proper mist are you wanting bot.channels?
wat
or client.channels
msg.channe

There's so much wrong with that code I don't even know where to begin... I guess I'll start with the most obvious flaw
channels.cache.forEach(member => {
You wouldn't be getting a member from this, but a channel, and even then you wouldn't get a channel because you don't define if it's a guild channel or from the client or anything
you mean nothing
because channels doesn't seem to be defined anywhere
that we can see
ye
uhhh
i think he is trying to mass change guildmemember nicknames
yes
but using the channels instead of members
Dude, learn some js first
And take a look at the docs
Because channels.cache does not return members
And you have 2 forEach loops for no reason
if(msg.content.startsWith('/massnick')){
let nickname = msg.content.slice('/massnick'.length);
let count = msg.guild.channels.cache.size;
msg.channel.send(`Changing names of **${count}** members to **${nickname}**`);
msg.guild.channels.cache.forEach(member => {
member.setNickname(nickname);
});
}```

is likely what you were trying to do
Why you spoonfeeding though
sometimes its good to know where he went wrong
but yea i do recommend at least doing a few code academy js lessons or something
Even that wouldn't accomplish it though.
msg.guild.channels.cache.forEach(member => {
member.setNickname(nickname);
});
Does not retrun a member
ha, fair enough
lol
But yes, take some online courses man, it's better to learn before making a bot
ive been doing js for years, and thought it'd be nice and easy to make a bot. that was december...
only if you don't know what your doing
oh, i know. was just trying to highlight that its not a quick newbie friendly task

Ah
lol
Lol
aa bakc
tbf if you only want a bot that replies to a thing, thats pretty easy
but when you want it to do some cool things...
^
uhh
my bot is an rpg that has little battle embeds that you react to and it does attacks, skills, uses items, kill bosses, farm equipment, upgrade things.
you know, cool stuff
is there anything similar to pm2 but for apps that run on jvm
im reading the docs
feels like there's a better way to run multiple apps without screen
aight ok not too bad
ive done hangman, trivia and a mafia game
at this point idk what to make
goat simulator: discord version
lmao
@valid frigate run the app as a service
k
how do you edit an image with a bot?
what library? @autumn quarry
client.user.setAvatar() i think
ah, i see
Why is this crossed out
normally means it's deprecated
how do i make it not depreciated
you dont..?
Deprecated
Deprecated means it's deprecated by the developer and wont be supported in future updates
well does that mean i cant use it
not necessarily
there will normally bea newer more optimized function, which is why it gets depreciated
usually you can but it will likely be removed in the future so you should probably use a different method
yeah
woudnt a strikethrough like that maybe mean the lib isnt imported or something?
idk what ide that is from ๐
Apache Netbeans
you can read their docs
and see what happened to that Constructor
and its replacement
@lavish fern new JDA().build() is deprecated
The new substitute is JDA.create()
And don't use netbeans for the sake of your sanity
Also, note that you gotta specify which gateway intents you'll want to use
JDA.create(GatewayIntent.DEFAULT) is the default way of starting your client
if i use
const channelfilter = m => m.mentions.channels.size >= 1;
let options = {max:1,time:60000,errors:["time"]}
let collected = await message.channel.awaitMessages(channelfilter,options);
console.log(collected.size)
and i type: ea instead of #general-chat
it shouldn't be cached by the filter right? Until i actually mention a channel. Right?
So that means console.log(collected.size) should NOT be sent in console until i mention a channel/time expires right? (v11.5.1)
its actually sent 
how do i send a message to all channels using discord.js
@lyric mountain I have no idead what you mean
sounds like api abuse
You're using new JDA().build() @lavish fern
That's deprecated due to new version of discord api requiring gateway intents to be specified
you dont cause its api abuse
i just want to notify my members about something
They added a new constructor, which is JDA.create()
one time
@proper mist ping them
i wonder why its still sent if i dont mention a channel
welp ok
If it's your members, then you should have access to everyone
@tired cloud broken filter maybe
They added a new constructor, which is
JDA.create()
@lavish fern
Like this
Remove new
JDA.create() is a static method
Also, inside create you gotta put GatewayIntents.from(GatewayIntents.DEFAULT)
Im still getting errors
hmm?
Screenshot
Intellij
Try GatewayIntent
I don't remember if there's a S in the end of the name

@lavish fern have you imported it?
yes
Ah, forgot that
it should be .create("token", gateway intents)
Btw, don't put your token as a common string if you wish to submit the bot
submit the bot?
Enviro what>
Or any other bot listing
I havent coded for 7 years
So they are totally safe even if someone reads your code
It's kinda easy
At least in intellij
should i use that?
Probably
whats the difference?
Netbeans is awesome for guis and desktop applications
okay
But for everything else it's just not good enough
Intellij is a complete coding workspace, so you have more tools at your disposal
Although its gui builder is harder to use than netbeans
Inteliji work with Java 14?
okay
Plus it's not a java-only ide btw
cause i current am use JAva JDK 11
Bruh
can anyone send me a good resource for economy discord.js
Doing an enconomy bot is not really something you should try if you are getting into development imo
help?
Next next next next finish
No need to modify anything
Then you'll have to choose your preferences
Again, next next next next
@lyric mountain You know any good tutorials with the new changes to the JDA

JDA is seriously lacking a wiki
But their javadocs are quite well documented
Way too well I'd say
javadocs are quite trash as their own thing
You do know javadocs are the thing that appear when you do ctrl + Q, right?
Reading javadocs directly on the site is a hell
When you peek into the javadocs, javadocs peek into you
I just created a c!play music command, and I can't figure out why its not working.
There is an error in the logs when i use it.
so ill go grab that along with its code.
error:
(node:12178) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'get' of undefined
code:
const serverQueue = message.client.queue.get(message.guild.id);
That's.....wrong I think
I did it wrong??
so i need to create a handler?
Do you know how to use promises?
no, Im trying to learn though
Awesome
Need help setting up my play command on command handler
How much do you have currently?
how much what?
might have to restart but I have 64 lines
I use ytdl, is there possibly a better way?
Ytdl?
I have opus
Ytdl only downloads the file
and I was considering switching to lavalink
Lavalink is good if you know what you're doing
as in javascript know what im doing?
Well let's say that lavalink can either be the worst lib or the best lib depending on configuration
ah
im switching to lavalink because I think ytdl is no long compatable
it's too clunky and laggy
But anyway, I did those questions to get more info about your issue, unfortunately I know little about sending audio with js
See if someone here knows something about it and link them here
I'm switching to lavalink anyway
Instead of saying all that again
Is there any HTML example on showing the statistic for my bot?
@copper fog html no, you'll need some kind of backend
Markdown?
Oh ._.
https://www.npmjs.com/package/gamedig Anyone ever used this If so how do you make it so when a player joins a minecraft or gta5 server it updates the player count
need help with custom prefix command setup
explain
I followed a guide to have keyv store custom prefixes for each server, I use the code they used in the guide but my .prefix command does nothing
no sign of reply and it doesn't crash
this guide exactly https://discordjs.guide/keyv/#installation
if (message.author.bot) return;
let args;
if (message.guild) {
let prefix;
if (message.content.startsWith(globalPrefix)) {
prefix = globalPrefix;
} else {
// check the guild-level prefix
const guildPrefix = await prefixes.get(message.guild.id);
if (message.content.startsWith(guildPrefix)) prefix = guildPrefix;
}
// if we found a prefix, setup args; otherwise, this isn't a command
if (!prefix) return;
args = message.content.slice(prefix.length).split(/\s+/);
} else {
const slice = message.content.startsWith(globalPrefix) ? globalPrefix.length : 0;
args = message.content.slice(slice).split(/\s+/);
}
// get the first space-delimited argument after the prefix as the command
const command = args.shift().toLowerCase();
if (command === 'prefix') {
if (args.length) {
await prefixes.set(message.guild.id, args[0]);
return message.channel.send(`Successfully set prefix to \`${args[0]}\``);
}
}
})
}
}```
omg
why are you checking for everything the way you're doing it
and why are you defining prefix only if the message was sent in a guild
that's not my entire file
what is prefixes
name: 'prefix',
description: 'changes server-wide prefix',
execute(bot, message, args) {
const Discord = require('discord.js')
const Keyv = require('keyv');
const keyv = new Keyv('me like mangoes me live in sa')
.on('message', async message => {
if (message.author.bot) return;
let args;
if (message.guild) {
let prefix;
if (message.content.startsWith(globalPrefix)) {
prefix = globalPrefix;
} else {
// check the guild-level prefix
const guildPrefix = await prefixes.get(message.guild.id);
if (message.content.startsWith(guildPrefix)) prefix = guildPrefix;
}
// if we found a prefix, setup args; otherwise, this isn't a command
if (!prefix) return;
args = message.content.slice(prefix.length).split(/\s+/);
} else {
const slice = message.content.startsWith(globalPrefix) ? globalPrefix.length : 0;
args = message.content.slice(slice).split(/\s+/);
}
// get the first space-delimited argument after the prefix as the command
const command = args.shift().toLowerCase();
if (command === 'prefix') {
if (args.length) {
await prefixes.set(message.guild.id, args[0]);
return message.channel.send(`Successfully set prefix to \`${args[0]}\``);
}
}
})
}
}```
that's the error
That small block of code is like a titanic on top of a glass
you don't know what you're doing
that syntax is not correct
oh bot.on is there
and you should not try creating a new message listener inside a command run
stop copy pasting code and read the text above the shiny colorful code blocks that explains what you're supposed to do
brb
ah
oh
so I wasn't supposed to use the guide's command handler unless I really neeeeeeeeeded to...
dude
read that
you won't be able to fully transfer the DOM to node.js but you'll be able to transfer logic and good practices
will give it a read
What is right ? V =12.x.x
Or
message.channel.messages.fetch({})```
I would like for my bot to update message every 1.5 seconds. Is it considered as API abuse?
why is my bot always quota exceeded, what if later my bot is on 250 more servers?
anyone can help me?
what if lots of people are tuning in to music and it's always like this?
I have an error with my c!bancommand,
Error: (node:31860) UnhandledPromiseRejectionWarning: TypeError: promptMessage is not a function
Code: line 77
const emoji = await promptMessage(msg, message.author, 30, ["โ
", "โ"]);
help me
Is that correct @drowsy sentinel
idk
if its supposed to be discord.js for the require part
Well, I guess I don't need to see the function because you are importing it incorrectly.
?
You are trying to import a function called 'promptMessage' from the discord.js library which doesn't exist.
You need to import it from the file it exists in, example: ../tools/functions
tools would be the folder, and functions the .js class file that contained the promptMessage function.
Ok, I will go create one for this, and ill see how it goes
You don't need to create anything @clear wraith. Where is promptMessage?
Did you even create a function called promptMessage or did you just assume discord.js had it?
I didn't create one ๐คฆ
discord.js doesn't have promptMessage, so you have to make that function yourself.
Lol since when was promptMessagr a thing, whereโd u find if cuz if it was on the docs theyโll have to remove it
ok
How to defined 14 day older message in a channel
Umm
@drowsy sentinel I changed discord.js to ../../functions.js
const { stripIndents } = require("common-tags");
const { promptMessage } = require("../../functions.js");
You'd need the promptMessage function in the functions.js file and it would have to be exported.
Are you familiar with programming?
I'd recommend looking either further into the discord.js library https://discord.js.org/ or learning JavaScript on Codecademy.
Okay, did you try and see?
try the command?
Run it and see what errors you get.
I havn't tried the command, because my bot is offline because of the error
Well if you did it right it should work.
It says it can't find the module
show your file tree
even though its there
are you sure the file is in ../../ and not in ../ or ./
in which file are you calling the prompt message function?
functions.js
./functions.js
no
I mean
where are you calling the function
not defining
in which file are you doing const { promptMessage } = require('')
In my ban file
wait there's a command named 'me gusta' do you speak spanish?
yes
your fix will be removing one ../ from the require function
do you know what ../ and ./ mean?
No
then why did you try ../../
are they like folders
./ means the same folder as the file the ./ is in
../ means the parent folder
so basically doing ./ is the same as doing cd .
and doing ../ is cd ..
I said remove ONE ../
not both ../
so the thing should look like this
../functions.js
Thank you! I appreciate it!
np
message2 = sendMessage(etc)
message2.delete()
Do i put that at the end of the code?
inside the message event after you are done doing everything, sooo.... yeah 
Ok
.then(m => m.delete())
how can i change this background ?
?
find the element class with inspect element
and overwrite it in your desc
ok
Is there a specific channel or server to talk about JDA?
@visual turtle https://discordapp.com/invite/0hMr4ce0tIl3SLv5 this i guess
Thanks
the discord-api server also has a jda channel iirc
and for js ?
iirc?
if i remember/recall correctly
Ah ok
@sick cloud ts folder.roles.splice(folder.roles.indexOf(r), 1); example of stuff I do.
m'kay
const index = this.reactMessage.indexOf(M_ID);
if (index > -1) {
this.reactMessage.splice(index, 1);
}```
i'm just gonna check some stuff to be sure i didn't break something
OH
should work
there's only the one array element
categories.splice(categories.indexOf(category[0]), 1);
How do I make embeds? in JS?
what library @pale stone
Depends on the lib.
Sorry I'm very new to coding bots and coding at all (well i know how to make const, let, var, if, funcations ect)
What is library(lib)
learn js before making a bot
if you don't know what library you're even using you need to learn js before trying to make a bot
The only thing I want is the current PST time to know when the votes on top.gg will get reset. How can that be so hard? It's simple to set the time to LA time, but LA also has PDT
I tried getting the current UTC date and substracting 8h from that, but that's not working
oh wait I can also just substract 9h from my local time
no ^ is not true
solved it: js const now = moment().utc().subtract(8, 'hours');
In discord.js is this the code for going on mobile?7
const client = new Discord.Client({
fetchAllMembers: false,
disableMentions: "everyone",
messageCacheMaxSize: 0,
presence: { status: "dnd" },
ws: {
intents: ["GUILDS", "GUILD_MEMBERS", "GUILD_BANS", "GUILD_VOICE_STATES", "GUILD_PRESENCES", "GUILD_MESSAGES", "DIRECT_MESSAGES"],
"$browser": "Discord iOS" //this bit
}
});```
object["Blam Canyon"]
object is the object where "Blam Canyon" is located, in your case body.invasions
As you can see, the image looks like this, I wanted it to be the image of my bot
On d.js, how do you make your bot look like it's on mobile
@clear haven try editing your bot's page
@modern sable ,in this case I can't find a place to put an image
just edit
click on the edit button and click submit without changing anything
It forces DBL to refresh your bot's information
ok thanks
It should be body.invasions["Blam Canyon"] and not .object.. I just typed object instead of body.invasions cause this be used to access property in any object
const obj = {
"Something One": 1
}
console.log(obj["Something One"]);
and not to spoonfeed ;-;
In discord.js v 12.2.0
To log shard disconnect is it correct?
bot.on("shardDisconnect", (event, id) => {
let embed = new discord.MessageEmbed();
embed.setColor(`#e74c3c`);
embed.setDescription(`Shard \`${id}\` Disconnected`);
botshards.send(embed);
console.log(`Shard ${id} Disconnected!`);
});
why event guildCreate and GuildDelete are call in this server while the bot is not gone no income
please mention me if you are an answer
how are the number of bots and real members from a server called? (discord.js v 11.5.1 ) i know that for all members is message.guild.memberCount
^ You will have to filter it out to get the human member count and the bot count
How ?
message.guild.members.filter( ... )```
shal i use json databases?
no
Hello How Can I See My Boat's Ping On Your Voice Channel Discord.js Will Change Automatically
what
I donโt understand either
Also is this correct - https://discordapp.com/channels/264445053596991498/272764566411149314/705369914634141748
@heavy marsh
And I dont see it happing
if you get a shardDisconnect, that shard is dead, it cannot send messages
OOh so no way to do that
shardDisconnect should never happen, only if you have some real bad error
use shardReconnect and shardResume
//Shard Resumed
bot.on("shardResume", (id) => {
let embed = new discord.MessageEmbed();
embed.setColor(`#2ecc71`);
embed.setDescription(`Shard \`${id}\` resumed session!`);
botshards.send(embed);
console.log(`Shard ${id} resumed session!`);
});
But I get undefined
[30/04/20 10:06:37] [LOG] Shard undefined Reconnecting!
[30/04/20 10:06:37] [LOG] Shard 0 resumed session!
show your shardReconnect
//Shard Reconnections
bot.on("shardReconnecting", (unavailableGuilds, id) => {
let embed = new discord.MessageEmbed();
embed.setColor(`#FFFF33`);
embed.setDescription(`Shard \`${id}\` Reconnecting`);
botshards.send(embed);
console.log(`Shard ${id} Reconnecting!`);
});
oogs yes
why event guildCreate and GuildDelete are called in this server while the bot is not gone no income
please mention me if you are an answer
Also then how does this happen - https://cdn.danbot.xyz/xrKSdZJ2
is that your bot?
https://cdn.danbot.xyz/dwLvM9t8
Index.js = sharding
bot.js = Bot
Nope
I have shard logs in bot.js
then they are probably using shardReconnecting but writing "Disconnected" in the embed
shardDisconnect and shardReconnecting are the same thing, but one will not reconnect, the other will
why event guildCreate and GuildDelete are called in this server while the bot is not gone no income
please mention me if you are an answer
@cobalt mesa do you mean guildDelete emits and 2 sec later guildCreate, when the bot didn't leave at all? (mention me too)
@quartz kindle Sorry for the ping
id.guilds.cache.size
Will this be correct to get the number of guilds on that shard?
on shard ready
no
So just bot.guilds.cache.size
if you're using the sharding manager, yes
OOh ok let me test it
0003 is unicode for END OF TEXT
not sure why would a json api ever return that in the middle of the text lol, but you can probably use a replace function
Same
how can i make a function in a different file to get the username of the message.author
(where message is not defined)
@earnest phoenix how can you get an author of a message that doesn't exist?
@nocturne grove basically yeah
ah yes I had that too. I fixed it by these two lines
if (Date.now() - guild.joinedTimestamp > 10000) return console.log('Stopped a fake guildCreate event');
if (client.guilds.cache.get(guild.id)) return console.log('Stopped a fake guildDelete event');
Though I've not seen any of these logs yet @cobalt mesa
both of these just under both of the events
either send the message as a function parameter or send the author itself as a parameter
@earnest phoenix
^
yes, where you can also place async
https://cdn.danbot.xyz/TDfpAFvq
Where should I do this event? On index.js where shards are?
getusername: function(message) {
return message.author.username```
ah yes I had that too. I fixed it by these two lines
if (Date.now() - guild.joinedTimestamp > 10000) return console.log('Stopped a fake guildCreate event'); if (client.guilds.cache.get(guild.id)) return console.log('Stopped a fake guildDelete event');Though I've not seen any of these logs yet @cobalt mesa
@nocturne grove oh ok thanks
Just a last question, first condition is for guildCreate event and the second for guildRemove event ??
this is my function but it still didnt work
@nocturne grove
the error is that it cant get author of undefined
@cobalt mesa np
Yes, but guildRemove = guildDelete ofcourse
@heavy marsh in the shards, check if the channel you want to send to exists first
guildRemove is not a thing
@earnest phoenix how do you use it
@cobalt mesa np
Yes, but guildRemove = guildDelete ofcourse
@nocturne grove yes guildDelete sorry ๐
@earnest phoenix you should also give the message object to the function when you execute it
if(command === "checking") {
let functions = require("./functions.js")
let username = functions.getusername()
message.channel.send(username)
}```
const functions =
{
abc: function() {
return 10
},
getusername: function(message) {
return message.author.username
}
}
module.exports = functions;
you have to use is as getusername(message)
(new to other files, just wanted to make it look clear)
oh
@quartz kindle I am using webhooks
what you put inside () is what you get inside function()
oh
so i need to use the parameter in both command and function?
So i dont think it will matter right?
but why should you use functions for one short line like that?
yes, the command sends the parameter, the function receives the parameter and does something with it
but why should you use functions for one short line like that?
or am I just noob
@heavy marsh if you're sending a webhook, you might be able to do it from the shard manager
wherever you use the shardingManager
const config = require('./settiings/credentials.json');
const { ShardingManager } = require('discord.js');
const manager = new ShardingManager('./bot.js', { token: config.token });
manager.spawn();
manager.on('shardCreate', shard => console.log(`[ Shard Log ] Launched shard ${shard.id}`));
but why should you use functions for one short line like that?
@nocturne grove just for checking how it works
if you asked me
settiings lmao
at item.request.gen.end (/rbd/pnpm-volume/5b146d33-2649-47dc-b5df-4bb5db586bdc/node_modules/.registry.npmjs.org/discord.js/11.6.4/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:85:15)
at then (/rbd/pnpm-volume/5b146d33-2649-47dc-b5df-4bb5db586bdc/node_modules/.registry.npmjs.org/snekfetch/3.6.4/node_modules/snekfetch/src/index.js:215:21)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
(node:3758) 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: 127)```
help me
pls
:((
@heavy marsh shardingManager.totalShards
Your bot is missing permission
@heavy marsh yes
check if the bot has perms @earnest phoenix
(to do whatever command)
and
(node:3758) 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: 127)
?
that means you didnt catch the error above
@quartz kindle how ?
.catch()
So only shardcreate
It will be -
js manager.on(`ready`, )
@heavy marsh how ?
haa okey ๐
(node:3758) 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: 127)
help
pls
at item.request.gen.end (/rbd/pnpm-volume/5b146d33-2649-47dc-b5df-4bb5db586bdc/node_modules/.registry.npmjs.org/discord.js/11.6.4/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:85:15) at then (/rbd/pnpm-volume/5b146d33-2649-47dc-b5df-4bb5db586bdc/node_modules/.registry.npmjs.org/snekfetch/3.6.4/node_modules/snekfetch/src/index.js:215:21) at <anonymous> at process._tickCallback (internal/process/next_tick.js:189:7) (node:3758) 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: 127)```
@heavy marsh more info
@earnest phoenix ```js
message.channel.send("bla") // if it has permissions, it will work
message.channel.send("bla") // if no permission, it will error with Unhandled Promise Rejection
message.channel.send("bla").catch(error => console.log(error)) // if no permission, it will console.log the error instead of rejecting
(node:3758) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions
Perfect example ^
@earnest phoenix ```js
message.channel.send("bla") // if it has permissions, it will work
message.channel.send("bla") // if no permission, it will error with Unhandled Promise Rejection
message.channel.send("bla").catch(error => console.log(error)) // if no permission, it will console.log the error instead of rejecting
@quartz kindle but where should i write?
thats not for you to copy and paste
thats for you to read the comments i wrote
and understand why its showing that error in your code
sever.js ?
...
Should I write maine?
please read
Please don't ask to be spoonfeeded
Tim is helping you and trying to explain where is the problem, not giving you the solution directly
Which version are you using?
@heavy marsh discord.js 11.5.1
did you code it yourself or did someone code for you?
So its like this ...
(node:3758) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions
^ This means your missing permission. So when your testing the command the bot is missing some permissions.
So to catch the error do something like Tim said
https://discordapp.com/channels/264445053596991498/272764566411149314/705390535950729226
Or check your bot permission
So its like this ...
(node:3758) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions
^ This means your missing permission. So when your testing the command the bot is missing some permissions.
@heavy marsh okey and I understand
Like send message
guys how can i track votes , like if one vote for my bot , my bot send (**[UserID] Voted Now ! **) ?
https://discordapp.com/developers/docs/topics/permissions - @earnest phoenix
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
Check this for missions
permissions*
Is there a discord.js event that gets called when mentioned?
I can't find it in the documentation
you can check if the message had mentions in it
ok
OOh I see thank you
does somebody have code to check if my bot is mentioned?
check if the message contains mentions
I tried
Error: ```js
(node:12) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'on' of null
**Code:** ```js
//When Bot Is Conneted
manager.on('shardCreate', (shard) => {
manager.fetchClientValues('guilds.cache.size').then(results => {
const totalGuilds = results.reduce((prev, val) => prev + val, 0)
fs.readdir("./commands/", (err, files) => {
if (err) console.error(err);
let jsfiles = files.filter(f => f.split(".").pop() === "js");
let embed = new discord.MessageEmbed();
embed.setThumbnail(bot.user.avatarURL());
embed.setTitle(`Bot Fully Booted`);
embed.setColor(`#2ecc71`);
embed.addField("Guilds", totalGuilds, true);
embed.addField("Shards", shard.totalShards, true);
embed.addField("Commands", jsfiles.length, true);
botshards.send(embed);
});
});
console.log(`[ Bot Fully Booted ] Bot Booting to ${shard.totalShards} shards`);
});``` - @quartz kindle
[ Bot Fully Booted ] Bot Booting to undefined shards```
Or is it completely wrong
read docs
manager.totalShards
shard.manager.totalShards
also, you should only run that code when the last shard has been created
no, just manager
Then it told me manager not defined
it cant be undefined, you're using it a few lines above
anyway the manager doesnt tell you when all shards are ready
you have to do something like this (untested) ```js
manager.on("shardCreate", shard => {
shard.on("ready", () => {
if(shard.id === manager.totalShards - 1) {
// run your code here
}
})
})
What can I do to run this even after all the shards are online?
I am on discord.js v12
const ms = require('parse-ms')
const Discord = require('discord.js')
module.exports = {
name: "daily",
category: "info",
usage: "daily",
description: "Get daily credits ",
run: async (client, message, args) => {
if(!message.content.startsWith('!'))return;
let user = message.author;
let timeout = 86400000;
let amount = Math.floor(Math.random() * 400) + 1;
let daily = await db.fetch(`daily_${message.guild.id}_${user.id}`);
if (daily !== null && timeout - (Date.now() - daily) > 0) {
let time = ms(timeout - (Date.now() - daily));
let embed = new Discord.MessageEmbed()
.setColor("#FFFFFF")
.setDescription(`โ Hey${time.hours}h ${time.minutes}m ${time.seconds}s `);
message.channel.send(embed)
} else {
let embed = new Discord.MessageEmbed()
.setThumbnail(message.author.displayAvatarURL)
.setTitle("**Daily Money**")
.setColor("#FFFFFF")
.setDescription(`:PandaRiche: hmm ${amount} coins`);
message.channel.send(embed)
db.add(`money_${message.guild.id}_${user.id}`, amount)
db.set(`daily_${message.guild.id}_${user.id}`, Date.now())
}
}}
Please tell me why it is not working
https://cdn.danbot.xyz/lUoBxlXV Thanks Tim
have you tried debugging?
@quartz kindlei think there must a problem in changing from v11 to v12
But I cant find it
displayAvatarURL is a function in v12
Heroku isn't turning on the bot, it says that it's connected.
open logs
@pale vessel
@hallow sandal
read the error because it's your code
@hallow sandal
invalid syntax
also stop pinging me
Is here anyone who uses discord.py? I need to make -vote command & I dont know how
how do you make like a table so like "632327424595722251", "632327424595722251"
@unreal steeple just send a message saying vote for me or somthing
pretty much as simple as it get
oh ok
@unreal steeple I use discord.py, how may I help you
nice
or gimmie ideas for commands :)
How do we add a bot to the website...
@earnest phoenix what will the command do?
what will it do
it opens a new channel
member will DIRECTLY communicate to staff to discuss their problems
bruh what
I have a modmail bo
bot*
on heroku
It's pretty easy to do so in dpy
cool
ok great ๐
oh i understood
but bot cant understand commands in dm's
i mean i have prefix changing system
oof ok
i mean i need fun commands
yes
etc
they'll make use of random.choice
even joke
How bout making a bot thats actually unique rather than like thousands of other bots 
make a bot that shows the positions of the stars in the sky
how to do that
bruh
hah
2 hard
lol tim
make a bot that shows information about latest earthquakes
But as a stargazer i'd love them
Thanks for the idea Tim
@slender thistle fuck
have you ever thought that maybe the reason why some bots get big and others dont is by how much effort the developer puts in and how well they make it

no its fucking not
it takes 5 minutes to make a system for scraping a site
im actually pondering about the idea myself
If it doesn't have complex encoded stuff
make a bot that shows the positions of the stars in the sky
@quartz kindle
@bot.command()
async def starpos(ctx, star:str):
if star=="that one":
await ctx.send("Its a star you dumb kid")```
@quartz kindle i can help as a stargazer ๐
indents, colons, ==
remember command
my bot actually does that @wheat saffron @unreal steeple but it puts them in an astrology chart

so it would be the stars positions from a geocentric perspective
placed along the ecliptic
๐คฆ
@unreal steeple make something unique
if you want your bot to grow start by not making a bot like every other multi purpose bot
make a discord bot WITH FLASK
now that's a fucking hard challenge
if you want your bot to grow start by not making a bot like every other multi purpose bot
@modest maple
motive quotes
its the truth 
do somthing you'll actually end up using not somthing thats easy
top 10 motive quotes:
10. east or west, home is home
example
I have a coin system, and im wondering about "-travel" command, if i use it, i can find coins, or kill enemies...
u can make a bot which turns off or on your wifi
or tells you which clients are connected to your wifi
now that's a genius idea
I have one bot BTW xdddd
what about tic tac toe command? how can i realise it?
or turn off pc
or get your's ip adress
cool
look

bruh
:kukuha:
anyone here ever had issues with commands not responding 95% of the time when scaling your bot on several shards?
what is your end goal for your bot?
anyone here ever had issues with commands not responding 95% of the time when scaling your bot on several shards?
@stark terrace
No never had that
yeah this is a pretty recent issue for me
11 shards with nearly 11k guilds
and commands are generally just not responding
64 Shards 
i'm not sure if it's a sharding issue or not tbh
discord.js
i cant see how sharding is the issue
considering you will of had to previously shard
mhm
unless u fucked somthing up on quite a amazing scale
yeah idk
I have a new idea for a bot
TELL MEEE
It's going to do everything a moderator can do by right clicking a name
i found tic tac toe example
but with chat commands
best
with right clicking
I'm gonna call the bot, "Rightclickr"
also that will be strictly attacking discord tos
bruh
don't
never
do
that
no one will invite ur bot
members will try the rightclick and bang done everyone's banned finished boom
server will die in seconds
Please don't send individual messages like that 
lmfao
so much moderation
It's just obnoxious and spammy
๐ Moderation๐ Bots ๐ are ๐ not ๐ new ๐
do you read those as a clap
https://AvBot--woozydragon4018.repl.co
This will be my future dashboard for my bot!
so much traffic owo
something that explains functions more in depth than discord can
I should do a dash board butttttttt i cba
not that its hard to integrate with the bot
I mean if your bots in js
you can literally copy and paste half your bot to the html
my controls atm for the db lol
ok so in my dev environment w/ a few shards spawn, commands respond okay. If I spawn up 11 shards like I have in production, no command response. It seems like it's a sharding issue @modest maple
why is everything from nekos.life banned? shouldn't the sfw api be allowed?
yeah that wont happen lol
my bot is showing that this server doesnt exist, even tho it is in it (i only have one shard) @ripe slate is the bot, its showing offline here. 10/10 discord
I need help

