#development
1 messages ยท Page 834 of 1
I think I've fixed it
if the error still occurs, there's a mistake in your code somewhere which lets dms through when they shouldn't
also it's bad practice to send messages on commands in dms (if you do not allow them), best is to not respond at all
Iok
it's because you waste a request and uselessly add to the global message ratelimit
Is it possible to change your bot platform to mobile, so far i tried this: ready event: js client.on("ready", () => { client.user.presence.clientStatus.web = client.user.presence.clientStatus.mobile; }); and error: https://hastebin.com/ukatanolut.coffeescript
and why
everytime you want to change something on discord you need to call a method because you need to make a request
this is equivalent to making your bot invisible
I mean it's useless
okay, then. thanks anyway
let LastMessage = member.user.lastMessage;
if (LastMessage > 5) LastMessage = LastMessage.substring(0, 5) + ' ...';
It says substring is not a function
let LastMessage = member.user.lastMessage.content;
t r y i t a n d s e e
how dare you tell me to try stuff my self
Lol I like that video
you have eyes, read the error
stop making up your own functions and read the docs
@weak parrot recently you kicked my bot for this : image come after, can you unkick it
I fixed this
there's no such thing as unkicking lmao
a
don't know think it's my favorite channel
thank's @shadow shale try to do better
Ps. I'm his creator
๐คฆโโ๏ธ
Keep in mind that this channel is solely for development related things please move the off-topic shit to off-topic
Um
k
K
K
K
K

K
let NickName = member.nickname;
if(!NickName) NickName = "None";
Still comes as undefined
if (Nickname === null) Nickname = "None";```
that wouldnt make any difference
...
:v
yes cause when its null it works on one server... not the other
If its undefined it works on one not the other server
it isn't
nvm
it is
director, are you sure you're actually using the NickName variable
yep
let NickName = member.nickname;
if(!NickName) NickName = "None";
Is this wrong?
no
Why does my memory Usage show NaN?
how are you calculating it
${(process.memoryUsage().heapUsage / 1024 / 1024/.toFixed(2)}
you sure you aren't getting a syntax error
${(process.memoryUsage().heapUsage / 1024 / 1024/.toFixed(2)}
@raven urchin missing )
There are two type of props that start with "heap" for memeoryUsage:
{
heapTotal: 114884608,
heapUsed: 103758256
}
heapUsage is not a property.
I'm not too sure where to find it. I'm still kinda new to discord.js
...how do you created that embed?
Kuu I think they're using this: https://canary.discordapp.com/channels/264445053596991498/272764566411149314/691633722285359224
If you want an accurate reading, use rss not heapUsed
don't forget to add the units in front of it
Wdym units?
KBs, MBs, GBs, etc
MB / MegaBytes
Ah yes ok
anyone know how to implement playlist feature to music bot without the youtube api? ping me or dm me if u know how to โค๏ธ
without the youtube api you'll not be able to search for playlists/musics
Put all the songs that need to be played in a list
@blissful scaffold right but how do you get each song from a playlist when its a link
you cant just loop over the url thats what im trying to work around
im using yt-search, but that doesn't seem to work for playlists even though it should
Not a youtube playlist, use a js list
Why without the youtube api? Doesnt ytsearch use the youtube api anyway?
So i just added MBs and it doesn't respond at all
When a song is finished load the next URL in the list
@quartz kindle using the youtube api means if u go over the daily quota it doesn't work anymore
hence why I switched to yt-search
You cant do "a" "b" lol
for some reason the daily quota was met after like 1 hour of testing
which isn't good
Either do "ab" or "a"+" b" @raven urchin
@blissful scaffold im trying to implement so that if a user enters a playlist link, it will play it and queue all the songs up so idk what u mean
I'm so stupid, thank you again.
anyone know any decent c# hosting platforms?
im so tempted to just write this in c#
Well, the correct way to do that would be to increase your quota
Other than that, only via scrapping
Downloading the page and extracting links from it
anyone know any decent c# hosting platforms?
literally anything
if you're using .net core you can run on any platform
show code
just the embed code
RichEmbed = MessageEmbed in V12
oh
๐
ye
yeah cause you forgot your () you f*** all @earnest phoenix
at the end on RichEmbed
imagine being that toxic xD
ouh
Yes
How do you make a bot reload every 10 minutes in Discord.js?
Didnt Night already said that?
bot.on("guildCreate", guild => {
bot.channels.cache.get(`688812916639924286`).send(` Joined guild **${guild.name} [ ${guild.id} ]** \`[ Now connected to ${bot.guilds.cache.size} servers ]\``);
console.log(`[ Guild Join ] ${guild.name} (${guild.id})`);
});
Why it it coming as undefined?
How do you make a bot reload every 10 minutes in Discord.js?
Why would you?
๐คฆโโ๏ธ
Which part @heavy marsh
@regal saddle Because my bot status stops working after 20 minutes
[ Now connected to ${bot.guilds.cache.size} servers ]\``);
I will dm @earnest phoenix
tag 
have you thought about maybe... resolving the issue that makes your bot crash every 20 minutes instead of putting a band aid on it
because you don't handle them properly
@royal portal don't host your bot on a rpi 3
it goes on sleep mode and the bot stop working

Thats why I want to have a bot that refreshes every 10 minutes
why
The status works on older versions
The newer version of node.js and discord.js is just breaking it
@heavy marsh send pic of ur code

Wait why is it like ${bot
.guilds.cache.size}
Or is it because the software you used ran out of lines?
Oh ok
neehsi what language and library?
By the way I am using v12.0.2
discord js?
client.guilds.cache.size
Gimme moment
its client.guilds.cache.size or client.guilds.size
@crimson vapor v12 so .cache
what is your djs version
ok
client.guilds.cache.size
Any idea why MongoDB sets the 2 last digits in a Discord Server and Channel ID to 00?
Yes, you're using a data type that doesn't support numbers that high
Use strings for ids
bot.channels.cache.get(`688812916639924286`).send(` Joined guild **${guild.name} [ ${guild.id} ]** \`[ Now connected to ${this.bot.guilds.cache.size} servers ]\``);
Is it like this?
it doesnt
does mongo not have unsigned int64s?
I had to use strings
I think the issue actually is that js (which is likely what they're using) just has Numbers
Hmm
And js will just round those numbers so they are no longer accurate
bot.on("guildCreate", guild => {
bot.channels.cache.get(`688812916639924286`).send(` Joined guild **${guild.name} [ ${guild.id} ]** \`[ Now connected to ${bot.guilds.cache.size} servers ]\``);
console.log(`[ Guild Join ] ${guild.name} (${guild.id})`);
});
How to fix this ...
@heavy marsh Unless u make it as an embed. I find them a lot easier
\`[ Now connected to ${bot.guilds.cache.size} servers ]\``);
Gives me [ Now connected to undefined servers ]
One moment
bot.on("guildCreate", guild => {
bot.channels.cache.get(688812916639924286).send( Joined guild **${guild.name} [ ${guild.id} ]** \[ Now connected to ${bot.guilds.cache.size} servers ]`); console.log([ Guild Join ] ${guild.name} (${guild.id})`);
});
I want it to send when the bot joins a server
then don't do anything in guildCreate until ready is fired
But it worked on v11
ok
Ima try it on my bot
-)0
isnt there a bot ready timsetamp
what's problem
you tell me
I dont know what is your problem with the code
just give the client a isReady prop set to false and set it to true on ready
can someone help me with a code?
https://lumap.is-inside.me/MH4gEhRu.png first command in d.py done ๐
do you need help because you have an error or is it just because you want someone else to code something for you @earnest phoenix
and i want to know how i can do it that when the persons join he auto-execute he
it was because idk how to do it on join that execute he his message
use a reduce function on client.guilds.cache
and i cant use that
client.on('guildMemberAdd', member => {
because in start i use this
module.exports.run = async (bot, message, args) => {
that the command work when a person join
what command
how i can do it?
not commands
quick question : ```py
import discord
from discord.ext import commands
client = commands.Bot("py-")
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@client.command()
async def ping(ctx):
await ctx.send("Pong")
@client.command()
async def pong(ctx):
await ctx.send('ping')
@client.command()
async def say(ctx, *, arg):
await ctx.send(arg)
@client.command()
async def add(ctx, arg1 :int, arg2 :int):
await ctx.send(arg1+arg2)
client.run('mah token')```
if I try to add a help command it says there is aleready a help command
you need to unload the inbuilt help command first
wow
question : how
how i do a event, im looking in the documentation
i cant remember
ok
client.on('event'
ok
and so on
yes
Why message.member ?? Use message.author no?
message.member is a guild member
guild members are not the same as users
message.author is a message author
@elder garnet #topgg-api
okay
I think you mean to check if anyone was mentioned first, else default to the author.
how i fix it?
fix what exactly
yes, it found the channel
ok
the name of the bot?
client
ok
but i have the const client
i change everything user to client?
and what i change?
ok
it dont send nothing
yep
is user a User or GuildMember? What version of Discord.js are you using?
what is user supposed to be
can you show where you defined it
I need some guides. How can I make it where if my bot joins it'll send a join message?
skies, what library?
we are working on it
discord.js
listen to the guildCreate event. check the docs
On google?
Ohh ok, thx
Grayald where did you even define I see where.message
Though I still don't get it. The screenshot you showed is a different file than the file you attached called Message.txt. If you're trying to find a channel in the current guild where the bot joined, you should be looking at message.guild.channels.find(...)
Ok so I found one. But idk if it'll work for my handler
You should also fix message.user as that's not a thing. Check the docs.
message.user isn`t a thing?
yep
I found one on GitHub
then why are you adding a new listener for every time the command is run?
My handler is like this
module.exports = {
name:"",
description:"",
execute: async (client, msg) so on
You're just asking for a memory leak.
@earnest phoenix Mine does too
wait why cant you do commands like that?
idk
Put your new listeners in their correct location in your code. Not in a file like that, as you add a new listener for every time that happens. You may want to go over your code over again.
if you put event listeners in command files, here's what happens:
bot receives command
command creates listener
command runs
bot receives another command
command creates listener (now you have 2 listeners)
command runs twice
bot receives another command
command creates listener (now you have 3 listeners)
command runs three times
yes
F
use the guildCreate event, find the first channel where your bot has permissions to send, send to that channel
Im using discord.js but i cant firgure out how to create a category and then create a channel and assign that channel to the created category
what have you tried?
All kinds of stuff lol
he means code
Ohh hold on
how we make the list of members with a pseudo example !ban tony, list members with tony in their username
umm
message.guild.members.cache.find(m => m.tag.username.includes('tony'))
wait
no that is just one
filter.
guild.createChannel('test', { type: 'category'}.then(guild.createChannel('test', { type: 'text'}))
in ^11.4.2 srry
Thats basically what i did
ok so you created a category and a text channel
but you didn't assign the channel to the category
@unborn steeple ```js
...createChannel(...).then(newchannel => {
// newchannel is the newly created category channel. create a new channel and set the category channel as parent
...createChannel("name",{parent:newchannel})
})
@wicked pivot to find members by name, including offline members, you need to use fetchMembers (in v11)
okay, but rightly i've never done this so i don't know how to start.
when you receive a message, get the guild from the message, use guild.fetchMembers() according to the docs link above
fetchMembers returns a promise so you either need to assign a variable to await ...fetchMembers() or use .then
I start from a good base or not?
@sudden geyser and i cant use this?
client.emit('guildMemberAdd', message.member)
you can, but this is what you're doing when you add a new listener for every command use: https://canary.discordapp.com/channels/264445053596991498/272764566411149314/691661421674758205
so if any user joins any guild, it'll emit for all your listeners. You only need 1 listener.
but i now change 20 commands?
probably
feels bad
๐ฆ
๐ข
I had to figure channel creation out but in v12 d.js
its hell
not when you just learned v12
what do you mean
let new_channel = await message.guild.channels.create(`${message.author.username}-${quizcode}`, { topic: `Request Opened By: ${message.author.tag} | Request Opened On: ${moment(message.createdAt).format("LL")} | Request ID: ${quizcode}`, parent: "686315004210839725", permissionOverwrites: [{ id: message.author.id, allow: ['VIEW_CHANNEL', "SEND_MESSAGES", "READ_MESSAGE_HISTORY"] }] })
v12 is actually so much easier
I never knew v12 I started on v11
same
let Users = message.guild.fetchMembers(args.join(" "), 100)``` but then? 
let Users = await message.guild.fetchMembers(args.join(' '), 100)```
if you dont await, it will return a promise
if you don't want to use await you gotta use .then
^
^
^
I suggest using await anyways as it makes the code not so long
is there a performance delay?
lol I have about 600 if statements in one command
I try to keep it lower than 10 per
const object = example().then(variable => )
const object2 = await example()
le basics
@earnest phoenix the correct way to use listeners is like this: ```js
// mainfile.js
client.on("message", message => {
// process command 1
// process command 2
// process command 3
// etc
});```
the listener should be used only once, in your main file.
then inside the listener you should check the message content, what command was run, and fire the relevant command or/or command file
also check for prefix (part of the command stuff) and if the user is a bot
ok
also if the message comes from a server
is it a bad idea to have multiple listeners?
and cpu
I should change my bot then lol
you don't really need multiple listeners anyways there is no reason
well I have one for commands and one for handling xp
combine them
I am now
fuuuuuuusion
haaa!
lmao I actually have 3
if you don't declare variables twice then copy pasting should be enough
another for loading data
its time for another fusion
got it
brain pls think
let thought = new Thought('how').question()
I mean on the thinking part
I have an idea on the combining
let brain = require("iq")
const emoji = client.emojis.cache.get(args[0]) || message.guild.emojis.cache.find(emoji => emoji.name === args[0] ) || message.guild.emojis.cache.get(args[1])
if (!emoji) return message.channel.send("Please mention emoji or put id")
server.set(message.guild.id, emoji.id, "suggestions.turereact")
message.channel.send(
`Successfully setup true emoji to **${emoji.name}**`
)
}
help:>>
args[0] is both "setreacttrue" and the emoji
They need to be different in this scenario
@earnest phoenix Explain more
@storm bluff default Emoji's are Unicode
you'll have to use https://static.emzi0767.com/misc/discordEmojiMap.json to parse unicode emojis
it looks offline :P
function getAll(client, message) {
const embed = new MessageEmbed()
.setColor("RANDOM")
const commands = (category) => {
return client.commands
.filter(cmd => cmd.category === category)
.map(cmd => `\`${cmd.name}\``)
.join(", ");
}
const info = client.categories
.map(cat => stripIndents`**${cat[0].toUpperCase() + cat.slice(1)}** \n${commands(cat)}`)
.reduce((string, category) => string + "\n" + category);
return message.channel.send(embed.setDescription(info));
}
how can I make this ignore the category called owner?
if (category === owner) {
i dont know how to make an ignore function
}
also i see you're watching thesourcecode @marble juniper
y e s
me 2
how do you make that in lines
like
command list another command list
etc.
instead of
command list
another command list
Check if the message author and message mention are the same
basically yeah
am I super dumb or is there not a way to generate one-time invite links for a guild from the API?
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
Get Invites, Delete Invites
but I'm not seeing Create anywhere
for me https://static.emzi0767.com/misc/discordEmojiMap.json doesnt work and because im dummy, so i use a regex lol
guys]
does this look good enough
the name
(because setActivity works for like 20 mins dont ask why lol)
ah hah, it's under channels, gotta create a channel invite
I want the bot to disconnect automatically when there is no user in vc [music bot]
How to make a bot say their prefix and all that when they get invited to a server?
Like 'Thanks for adding the bot'
js?
listen guildCreate event
is it possible to use discord.js functions through player.voiceConnection...
so I can do something like
player.voiceConnection.play(ytdl()) for livestreams?
or is there a player.playStream()?
(For shoukaku)
client.on("guildCreate", function(guild){
channel.send("Thanks for adding me.")
});
like that?
I asked in their community they didn't answer
client.on("guildCreate", function(guild){
channel.send("Thanks for adding me.")
});
@royal portal define channel
so that will work?
This error just suddenly happened
I don't know why]
events.js:180
throw err; // Unhandled 'error' event
^
Error [ERR_UNHANDLED_ERROR]: Unhandled error. ([object Object])
at Client.emit (events.js:178:17)
at WebSocketConnection.onError (/rbd/pnpm-volume/f1552016-7520-4cf1-aa54-a936a6ca55c3/node_modules/.registry.npmjs.org/discord.js/11.5.1/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:374:17)
at WebSocket.onError (/rbd/pnpm-volume/f1552016-7520-4cf1-aa54-a936a6ca55c3/node_modules/.registry.npmjs.org/ws/6.2.1/node_modules/ws/lib/event-target.js:128:16)
at WebSocket.emit (events.js:189:13)
at abortHandshake (/rbd/pnpm-volume/f1552016-7520-4cf1-aa54-a936a6ca55c3/node_modules/.registry.npmjs.org/ws/6.2.1/node_modules/ws/lib/websocket.js:718:15)
at ClientRequest.req.on (/rbd/pnpm-volume/f1552016-7520-4cf1-aa54-a936a6ca55c3/node_modules/.registry.npmjs.org/ws/6.2.1/node_modules/ws/lib/websocket.js:595:7)
at ClientRequest.emit (events.js:189:13)
at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:556:21)
at HTTPParser.parserOnHeadersComplete (_http_common.js:109:17)
at TLSSocket.socketOnData (_http_client.js:442:20)
at TLSSocket.emit (events.js:189:13)
at addChunk (_stream_readable.js:284:12)
at readableAddChunk (_stream_readable.js:265:11)
at TLSSocket.Readable.push (_stream_readable.js:220:10)
at TLSWrap.onStreamRead (internal/stream_base_commons.js:94:17)```
@golden condor when did you update node.js or discord.js
I didn't
I can't boot my bot, I have this error (in python) :
File "stelybot.py", line 973, in <module> |
client.run(client.config_token) |
File "/usr/local/lib/python3.6/dist-packages/discord/client.py", line 598, in run |
return future.result() |
File "/usr/local/lib/python3.6/dist-packages/discord/client.py", line 579, in runner |
await self.start(*args, **kwargs) |
File "/usr/local/lib/python3.6/dist-packages/discord/client.py", line 543, in start |
await self.connect(reconnect=reconnect) |
File "/usr/local/lib/python3.6/dist-packages/discord/client.py", line 457, in connect
await self._connect()
File "/usr/local/lib/python3.6/dist-packages/discord/client.py", line 418, in _connect
self.ws = await asyncio.wait_for(coro, timeout=180.0, loop=self.loop)
File "/usr/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
return fut.result()
File "/usr/local/lib/python3.6/dist-packages/discord/gateway.py", line 244, in from_clie
nt
await ws.poll_event()
File "/usr/local/lib/python3.6/dist-packages/discord/gateway.py", line 469, in poll_even
t
await self.received_message(msg)
File "/usr/local/lib/python3.6/dist-packages/discord/gateway.py", line 370, in received_
message
raise ResumeWebSocket(self.shard_id)
discord.gateway.ResumeWebSocket: None
I don't understand the error I got
Sounds like Discord API issues
@summer torrent like this?
client.on("guildCreate", function(guild){
bot.channel.send("Thanks for adding me.")
});
??
What would bot.channel be
well
I wanted to make so
when you add the bot to your server
then it says Thanks for adding me
something like that
And where are you going to send the message
Yeah seems weird that two people get the same error on two different language
in general
search for a channel named general then
.-.
or use the guild's system channel
idk how
What do I have to do to fix the mistake?
Apparently it's a discord api issue
Unless you work at Discord, you can't fix something that's server-side
Me and you had the same error in two different coding languages
any idea how to fix this
BRUH
Error 520 is essentially a catch-all response when something unexpected happens or when the origin server incorrectly interprets or does not tolerate a request due to a protocol violation or an empty response.
READ ABOVE
@slender thistle I have to wait?
Discord is dying atm
yes
client.on("guildCreate", function(guild){
bot.channels.get("#general").send('Thanks for adding me')
});
howwww
We ain't spoonfeeding
If you have other more important things to do, go finish them. Might as well come back to a lively API
no it gave me an error
events.js:180
throw err; // Unhandled 'error' event
^
Error [ERR_UNHANDLED_ERROR]: Unhandled error. ([object Object])
at Client.emit (events.js:178:17)
at WebSocketConnection.onError (/rbd/pnpm-volume/89f57bc8-9932-4d43-9864-f45b13c950de/node_modules/.registry.npmjs.org/discord.js/11.5.1/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:374:17)
at WebSocket.onError (/rbd/pnpm-volume/89f57bc8-9932-4d43-9864-f45b13c950de/node_modules/.registry.npmjs.org/ws/6.2.1/node_modules/ws/lib/event-target.js:128:16)
at WebSocket.emit (events.js:189:13)
at abortHandshake (/rbd/pnpm-volume/89f57bc8-9932-4d43-9864-f45b13c950de/node_modules/.registry.npmjs.org/ws/6.2.1/node_modules/ws/lib/websocket.js:718:15)
at ClientRequest.req.on (/rbd/pnpm-volume/89f57bc8-9932-4d43-9864-f45b13c950de/node_modules/.registry.npmjs.org/ws/6.2.1/node_modules/ws/lib/websocket.js:595:7)
at ClientRequest.emit (events.js:189:13)
at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:556:21)
at HTTPParser.parserOnHeadersComplete (_http_common.js:109:17)
at TLSSocket.socketOnData (_http_client.js:442:20)
RTD 
Read above
Weird error
Discords API is dying
Discord api issues
can someone check my error
Everyone is getting i
@finite bough you have the same error as everyone else here
Atm
client.on("guildCreate", function(guild){
bot.channels.get(general).send('Thanks for adding me')
});
that might work
Read what we are saying
Api got Corona?
lel
My bot is struggling
client.on("guildCreate", guild => {
guild.owner.send('Thanks! You can use +help to discover commands.')
});
Seme
Every single bot is slowly going down
Sad AF
https://corynth.is-inside.me/LhYKrqW0.png Users including bots
would this work
client.on("guildCreate", guild => {
guild.owner.send('Thanks! You can use +help to discover commands.')
});
My bot came back online
Oof i waited 30 mins until this showed
because you don't try and see
i did
Maybe because you should try the code and see if it works bruh
i got error
Sending a message to guild owner on bot invite isn't the smartest idea
throw error
Maybe owner didnt add the bot
my bot's running fine
As an average user I don't exactly care if you're grateful if I use the bot or not. I invite the bot to either try it out or use it on my server
My bot is back
Mine too!!
LMFAO
@royal portal that code is correct
Lol Discord
@finite bough ye it works now
https://corynth.is-inside.me/lxmKtxAp.png They were doing so well
Lol
this big outage happened in december last time
is that like the new gyazo
?
sharex server
Corynth is my bot lmfao
o
Thought so
no
it's f r e e
from where
just open the domain smh
i t ' s f r e e
PewDiePie Tuber Simulator Intensifies
what?!!
It's free, and that's a great price!
Thanks for your password
download sharex or any other software that supports it
@spice pier wdym
const search = ["discord.gg", "http", "www", "free", "FREE", "Free"].map( s => s.toLowerCase())
const members = message.guild.members.filter(member => !member.user.bot)
let FoundStatut = members.filter(m => search.filter(s => m.user.game && m.user.game.state.toLowerCase().includes(s).length > 0))```
TypeError: Cannot read property 'state' of undefined
Thank you for giving me your password
user.game is undefined
@spice pier i didnt
You created an account on is-inside.me
no
@wicked pivot
i logged in
bcrypt btw
m.user.presence.game```?
try it and see
let FoundStatut = members.filter(m => search.filter(s => m.user.game && m.user.game.state && m.user.game.state.toLowerCase().includes(s).length > 0))
filter members who has game.state
I really thought i could play with this white name, sorry white name
being a bot developer doesn't make you special
also m.user.presence.game @wicked pivot
good site
TypeError: Cannot read property 'toLowerCase' of null
because the user is not playing anything
Hello
Hey
Ik
Thanks for liking my bot ๐
it does not work @summer torrent @pale vessel
don't ping two people
this is impossible there is a problem 
๐ญ
there's just all the members (no bot)
look at the first screen, my code to find all no bot members
He's trying to point out that the 2 numbers shown are the total member count
While they shouldn't
The issue, or at least one of the issues would be that the includes method returns true or false.
So you using a length property on that makes no sense?
I used this for nicknames, is it works pretty well
let FoundUser = members.filter(m => search.filter(s => m.user.username.toLowerCase().includes(s) || m.nickname && m.nickname.toLowerCase().includes(s)).length > 0)```
that's different
Notice how there's 2 ))
You're no longer using .length on the result of the includes method.
it works ! thank you i didn't notice this
how can I send a message to every channel in a guild
(using v11.5.1)
loop through the guild's text channels
^^
just for fun in my private server
Don't make this
also I tried doing for each but that didn't work
map wastes memory
loop through it
also the channels collection doesn't only contain text channels
U can:
message.guild.channels. forEach(c => {c.send("Yeet")})
You gotta filter out the voice channels.
k
and categories, and news channels
Yup
oof
basically check if the type is text
how to check how many people in vc with bot
forEach is less performant than a for-loop
so a for loop is better?
In terms of performance I would guess so
yikes
i think i've been using map too much, only because its easy to use
map doesnt have a noticeable effect on ram, rifht?
a native for loop is a winner in performance in all of them
i'm going from my knowledge of other languages, but i'm guessing it's because functions like map(), forEach() etc need to create a callback for each iteration and then call that callback in memory - while a native for loop is set in code as an instruction and does not need to generate anything extra, it just goes to the pointer and does what it's supposed to do
how the hell did forEach beat Find a few times?
just like how Italy defeated china in active cases
also, the for loop code for the find test is wrong
unless the actual finding part is being ignored on purpose for this test, that would also explain why the forEach may have been faster a couple times
they might be inaccurate, especially because of this part These result does not consider the JIT, inline caching, hidden classes, deoptimizations, garbage collection, pretenuring etc.
yeah but even ignoring all those, the differences between forEach and find should be abysmal, if "finding" is actually being done
ie: breaking the loop when the item is found
which find does, for could do (but they didnt do it) but forEach does not
yeah, it seems to me they are measuring just the loop performance, not the performance of actually finding an item
oh wait
they are
then the result is indeed invalid
i mean
the code searches for a random item in an array; so depending on the random item, the difference between .find and .forEach should be drastically different on each run
map is gay and a ram eater
which is best for looping?
for is the fastest in 99% of cases, and it pretty much can do anything the others do
all others are just convenience functions, which introduces overhead
but it mostly doesnt matter unless your code is dealing with multi-million-sized arrays lol
How can I do that the bot doesn't send messages to console which was send via DM?
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ \nServer: ' + message.guild.name + ' \nChannel: ' + message.channel.name + ' \nUser: ' + message.author.username + ' \nMessage: ' + message.content)});```
^^ It's to check that nobody is misusing my friends bot 
if (message.guild) {...}
if (!message.guild) return;```
Does anybody know about bot music commands well? If so, would anyone help me? Ping me pls
Just ask your question
@uneven lichen https://dontasktoask.com
if (message.guild) {...}
@sudden geyser Which one, this?
if (!message.guild) return;```
@summer torrent Or this?
@modern sable Can you help me please?
How can I do that the bot doesn't send messages to console which was send via DM?
console.log('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ \nServer: ' + message.guild.name + ' \nChannel: ' + message.channel.name + ' \nUser: ' + message.author.username + ' \nMessage: ' + message.content)});```
They both work. They're just done differently.
in your event message listener.
So in the )});
yes
at the very top
okay
Learn JS pls. It needs to be before where you're logging the info to console.
Thanks!!
Yes please learn the language before attempting on doing stuff
Okay, I created a command in java script (it plays music when you type in /play (title) the song list from Youtube will be displayed) I would like to be able to cancel the song list if I make a mistake and type the name of the song wrongly. I can upload the current script I'm using and invite you to the server where my bot is located. Is there anyone who can help me? I'm a beginner.
create a message collector and collect the word cancel from the author
and then manage the rest
easy
not for me ๐
well it's not that easy
but that's the logic of what you want to do
try to do it and if you get into a deadlock just ask here
easy
am i allowed to ask people to help me test something with my bot
Kind of. What exactly do you want tested (I may be able to help)?
Since I can't get the setActivity working, I've done this but I'm not sure if it looks good.
(the !help was meant to be on the status but it only worked for 20 minutes so I put it on the bot's username)
wdym it only stays for 20 mins
it shouldn't do that wtf
there must be something else removing the activity
how did u set it
inside the ready event
its because I updated both node.js and discord.js
well that shouldn't affect ya
there was like
a lot of ppl helping
but ppl cant find the issue
bot.on('ready', function() => {
console.log('Ready to Protect.');
bot.user.setStatus('idle')
bot.user.setGame('discord.js | Prefix: !')
});
it just doesn't work on my rpi3
well it did
the idle turned on but setActivity stopped working
i could only see setActivity for like 2 secs
and then 20 mins, idle gone
so yeah
I'm just asking if the '!help' looks good on the bot name
and if there is anyway to improve it
here's the screenshot again
alr hold on
```js
//code here
```
bot.on('ready', function() => {
console.log('Ready to Protect.');
bot.user.setStatus('idle')
bot.user.setGame('discord.js | Prefix: !')
});
isnt it bot.once?
wdym
gimme sec
no wtf
try with
client.user.setActivity()
ik it's most likely to not fix anythin
but setActivity can do what those 2 lines of code do while looking cleaner
Thats js or not?
client.once('ready', () => {
client.user.setActivity('whatever you want',{type: "STREAMING", url: ""})});
you can use something like that too
yeah i did
but you get my point
but still does same thing
but you get my point
yeah
like it stops after 20 mins
awaiting, sir
then create an interval and set the status every 20 minutes
how tf you dont know?
but i don't want the status to change
setInterval(function that gets called every n seconds, n)
but i don't want the status to change
it won't change
const activities_list = [
"test"
];
bot.on('ready', () => {
setInterval(() => {
const index = Math.floor(Math.random() * (activities_list.length - 1) + 1);
bot.user.setActivity(activities_list[index]);
}, 10000);
});
every 10 seconds btw
4 is the minimum
wdym
what language and what library
remember
there's thousands of languages out there
well not thousands
but a shitload
of 'em
ok
What does this mean
Error: Request to use token, but token was unavailable to the client.
EDIT : +
socket hang up
When try to fetchUser
Using Discord.js
@heavy marsh do you know about discord.js?
yep
Could you check 
the socket hung up
are you on an old version of d.js?
512 RAM is enough for mongodb ?? or will it be few?
Sorry for my English
@broken ruin are you trying to fetch a user from a disconnected client?
ie: do you have new Client() more than once in your code?
No
Is there a way to get the latency of the current guilds shard in v12.0.2
This in command name .js
async execute(message, client) {
@heavy marsh there is no cache in shards, and there are no channels in shards
This index.js
command.execute(client, message);
py!eval message.channel.send(bot.ws.shards.get(message.guild.id).shardID)```
Also wrong?
yes
bot.ws.shards = A collection of all shards this manager handles
Sorry for ping but could you check up @quartz kindle
ooh
@broken ruin why are they reversed?
What ?
message,client
client,message
Oh
py!eval message.channel.send(bot.ws.shards.get(message.guild.shardID))
ye
but I get it as error
what error?
DiscordAPIError: Cannot send an empty message
the shard is a class, either it cannot be stringified,or its being stringified to something that discord cant use as a message
you still need to get the property you want from the shard
bot.ws.shards.get(message.guild.shardID) = the latency?
ping is the latency
bot.ws.shards.get(message.guild.shardID).ping
yes
is there a way to go back to v11 of djs
Just add the version to you package.json and npm i



