#development
1 messages ยท Page 845 of 1
Because the literal JSON encoding is unnecessary 'cuz I can just plug in the data
without first accessing the files
in mongo you can do .find() allowing for an easier way to store it
members [
{
guildid:id
members:{
member1
member2
}
}
{
guildid:id
members:{
member1
member2
}
}
]
members.find({guildid:id}).members.find({memberid:id})```
i dont use mongo so idk if this is correct, but something like this
Oh
Kinda like the query function I wrote
how do you read that
I use eclipse instead normally
messy and slow operations will kill your bots
Well
When I used JSON
I didn't know how else to query data
But I actually removed my only call to that function
Because once I though I needed to search all of my documents to look for a certain piece of data
Hello, how i can do a leaderboard for dblapi?
#topgg-api please.
My .query function is essentially find, but for my JSON
.query(doc->{
AtomicReference<Long> time = new AtomicReference<Long> ();
doc.getObject(obj->id.set(obj.getOrDefaultLong("time", 0)));
return searchTime == time.get();
})
vs
.find({time: searchTime})
I just came from api and they sent me here
:v
yo, do you know the time for the bot being verifyed ? i added it yesterday and is still waiting
2 weeks
or longer
seriously lol 
srsly
you not funny 
i had to wait like 2 weeks for mine
oof
yep
i hope you are lying 
nope
https://discordapp.com/channels/264445053596991498/272764566411149314/694202695854325800
thank you @modest maple , very cool!
arf
UGH now i have to convert my functions from json reading to sqlite
@modest maple My previous system cached data when it got loaded
So it wasn't as slow for blocking
it can be anywhere from a couple days to over 2 weeks
depends on the queue size, how busy are the mods, etc
but you really waited 2 weeks ?
@twin iron yep

my bots have always been around 5-7 days for me
@slate oyster that will kill you when you get to bigger systems
Why is the emoji called clown lol
!I would call it :fakelrm:
(Discord is slow)
json is only suitable for small bots

Unless it's just not loading?
ive worked with bots that are in a few thousand servers and using Json files EVEN IF THEY ARE CACHED cause massive delays




thats just for the jsons being updated
my bot got do 2500 using json lmao
*dies*
we got to 3.8k then it quite dramatically died
but it was two big json files perma-loaded in memory, so not that bad
same
huh
we still had the issue that just updating the files
json is bad for store a lot of informations
yh
json is good for quick and little db setup
just use a proper db
even just updating the json files as long term storage would cause a long enough delay to block everything
and that was just one file per guild which was only about 20 lines each file
Uhm so I have a problem
its this Error: Cannot find module '/Users/,,,,,,/index.js'
ive worked with bots that are in a few thousand servers and using Json files EVEN IF THEY ARE CACHED cause massive delays
@modest maple
Wow
Jsons will not last
where does this error come from? @earnest phoenix
and you either upgrade and replace with a DB while files are small
or deal with the consequences when they're bigger
I'll update to DB
using collection names like
guilds.0.users
throw err;
^
Error: Cannot find module '/Users/...../index.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:976:15)
at Function.Module._load (internal/modules/cjs/loader.js:859:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
tHIS IS COMING FROM MY TERMINAL
well, you CAN make a performant database with json, but it takes a LOT of work, that databases already did for you over the last decades
@earnest phoenix what did you do to show that error?
well do you have an index.js file?
yes
then you're in the wrong folder
try cd (path to folder) and then node index
which folder is your index.js file in?
in my mega man battle network bot folder
then go to that folder, hold SHIFT, and right click on the folder empty space
cd into the folder
and click "open command prompt here"
if your on windows just go into the folder go to search bar to navigate file path and type CMD and itll open already CDd in
when you are in your terminal/cmd, you have to make sure the folder that the terminal is in, is correct
it wored
@modest maple nice pfp
worked thank you!
for example: This has to show the correct path to your bot folder
ty
cd {directory}
tbf for changing directories easily across drives
yeah
i just go to powershell
i prefer cmd
powershell can do alot more
Idk, I just use VS code terminal
that's basically cmd @gray pagoda
Powershell
the same thing
you see at the upper right cotner of the tab
I don't really care because I just do commands like mkdir or npm i
๐
yeah, that's the standard windows command prompt lol
Yes?
yeah
What kind of dbs u guys using?
dbs = ?
databases
i'm migrating to sqlite at the moment
I use Mongo aswell
I use mysql
@dreamy breach can you read MySQL from Node.js?
Yep but that's not really made for that because you always need to do async function everywhere.
It's very useful for languages like java.
compiled one
What module do I use for that?
Thx
sqlite works well with node.js
yep especially enmap
mhm
You didn't try it ?
Looks clean, especially the front page, maybe more delimitation for the chat part to really see where you can scroll/chat.
When you send more than 4 messages it allows you to scroll down
also, made entirely with WebSockets
x)
I was more talking about vertical ui divider
@dreamy breach yh, I'll try that later
Sorry to interrupt, but I have a question. What is the prefix for @pliant gorge? I added the bot to my server, and I donโt know what the prefix is.
it doesnt have one
Well.
It automatically creates a new project with default files?
@normal breach You use the site to list your server. The bot is only there to track members count and emojis.
It automatically creates a new project with default files?
@dreamy breach baaic code, setting file, install modules etc...
Oh
wow, wp
It will copy a file, open it (to install the modules) and nake the program wait for the batch to close, when It close it prints something like Module Installed then do the rest
However, I am still thinking how I will do It without needing to write any file because the framework doesn't allow me
That's very interesting, which language is it?
Oh okay didn't know to be honest ^
๐
I'm mainly working on discord bots right now for companies. You can always check my main project: mybrawlstats (BrawlStars tracker, website & bot) but I don't have a lot of projects like that ^
How to move to the bottom line in Embed (addfield)? (discordjs)
Mostly are mc based, I'm also working for solo customer.
How to move to the bottom line in Embed (addfield)? (discordjs)
@quartz hill more context pls?
(Nice pfp also)
thx ๐
So, what do you want to do?
use false
So use false yep
ooh thx
Then desvriotion do the text and the link
Like: .addField("hello", "man", false)
I understand. I'm trying right now.
Like:
you could even just not pass anything and it'll default to false
However he'd want to do it is fine
thx so much
its worked ๐
๐
sure x)
WebSockets, proxies, pass variables and functions, get mouse cordinates
my friend did it
very messed up
xD
hi
@vital mango hey
๐คฏ
@dreamy breach or go toUserScript.txt
there iit recieve maxBots, current bots, requests and all that
some random ints everywhere
the modifyCore() is brain destroyer
xD
.replace(/;if\((\w+)<1\.0\)/, ';if($1 < (!getOption("EXTENDED_ZOOM")))') Totally understandable.
100%
If you want to ask him his discord is: slasher#8598 he speaks French, so you can understand more than wht I did
Oh a baguette friend x)
baguette = ??
ree
if you understand 10% of the code I will give you...
epic music plays
the mega syntax power
which allows you to make all your code with perfect syntax and indent ๐
What?
Too much work to do rn sry, although the reward is enticing xD
client.on('voiceStateUpdate', (client, oldMember, newMember) => {
const voiceChannels = oldMember.guild.channels.filter(c => c.type === 'voice');
let newUserChannel = newMember.voiceChannel
let oldUserChannel = oldMember.voiceChannel
if(oldUserChannel === undefined && newUserChannel !== undefined) {
let count = 0;
for (const [id, voiceChannel] of voiceChannels) count += voiceChannel.members.size;
client.channels.get("689899436238831695").setName("En vocal : " + count)
}else if(oldUserChannel !== undefined && newUserChannel === undefined) {
let count = 0;
for (const [id, voiceChannel] of voiceChannels) count += voiceChannel.members.size;
client.channels.get("689899436238831695").setName("En vocal : " + count)
}
});```
voiceChannel undefined
in v11
for (const [id, "voiceChannel"] of voiceChannels) count += voiceChannel.members.size;
this code is so confusing
Hey, how does the role.setPosition works in a create role ?
is it position: number?
try it and see
client.on("message", message => {
^^^^^^
SyntaxError: Unexpected identifier
at new Script (vm.js:79:7)
at createScript (vm.js:251:10)
at Object.runInThisContext (vm.js:303:10)
at Module._compile (internal/modules/cjs/loader.js:656:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:741:12)
at startup (internal/bootstrap/node.js:285:19)
``` **Error** ๐ค
show your index.js
But its too long xD
client.on("message", message => {
if (message.content === "mb!invite") {
message.channel.send({embed: {
color: 3447003,
description: "Bot made by @wide wharf. DM for questions! \nMy invite link: https://bit.ly/mod_bot"
}})
}});
``` @crimson vapor ^^^^
^^ there is the code ^^
can better-sqlite3 store arrays
I know the point of sqlite table is to remove necessity of arrays
but at this point, I have better understanding and access to arrays with my current info
is there anyone who have ever user the guild.addMember() command and can explain to me how i should use it ? pleasee
DoCs
has*

i read them 5 times
bruh
i can't find enough documentation
what library
Hello, I'm trying to get the name of a store channel, but apparently Discord.NET is returning just the ID and channel type. are store channels just not supported?
@tired nimbus the best thing to do would be to use relations, and store array in a separate table. If you don't want that you can always use JSON.stringify / parse or String.join / String.split
Discord.js' documentation is very good
yeah indeed
i'm not saying it isn't
is just that i don't find in the guild.addMember command the oath2 code format
which version are you using?
I am not sure if that version of discord.js even exists
latest is v12
Anyways, I've never used addMember so I can't really help you
@wide wharf there is something above that code breaking it, send code, and install a linter holy fuck that'd make it so much easier for you
how do i check if the guild id is ... in discordjs ?
mhh
That's not stable but ok
o h l o l
You use
const guild = client.guilds.get("guild id")
if(!guild) return (whatever you want)
else {}
@runic fulcrum I don't think so but I'll check
okay
You sure your on v11?
mhhh ty for helping
you can't do it via a library iirc
Iirc = if I remember correctly right?
iirc
Lmao
yes or if i recall correctly
wdym by discord faces?
emojs
not
is like that you can't use standard ascii emoji
settings somewhere
In discord.js, how do I pass multiple arguments from client.on?
you need to use a bind function
Huh?
ask someone like Tim
It doesn't say in the docs
Wait where do I add more than one param
,other param
Like so?
no
Oh and then I can just use them as guild and user in the function itself? Or does the "revolution" need to be there
@crimson vapor
yeah
Okey thx @runic fulcrum
no no revolution is a var for my bot
Aight
oh ye thats correct
it works fine without XD
Haha aight thank you guys
hello
why i can't mention emoji from discord to move it to database
if (args[0] == "setfalseemoji") {
let spiltEmoji = args[1].split(":");
const emoji = message.guild.emojis.cache.find(
emoji =>
emoji.name === args[1] ||
emoji.id === args[1] ||
(spiltEmoji[1] && emoji.name == spiltEmoji[1]) ||
(spiltEmoji[2] && emoji.id + ">" == spiltEmoji[2])
);
if (!emoji) return message.channel.send("Please put a emoji id");
server.set(message.guild.id, emoji.id, "suggestions.falsereact");
message.channel.send(
`Successfully setup true emoji to ${message.guild.emojis.cache.get(
emoji.id
)}`
);
}```
only server couston emojis
your database should have the "utf8mb4" encoding or the "utf16" one
:\
@storm bluff What error are you getting?
const queues = serverQueue.songs.map((song, index) => index + 1 + ". " + song.title).join("\n");
how does one make it to where it ignore the first song

h0w d0 i fix this
const blacklist = client.guilds.get("264445053596991498")
if(!blacklist) meme();
if(blacklist)
hmmmm
h e l p
@elder garnet What
@storm bluff use Discord.Util.parseEmoji() for parsing custom emoji
i want to blacklist
None of that code makes sense???????
Okay then fetch from your db and see if server ID is bled
**
How do you break a for loo[
@spare goblet no errs]
How do you break a for loop
i want to make user can select emoji from discord and couston
@golden condor I already answered
Use return;
But that doesn't work
Wdym doesn't work
for (const video of videos) {
try {
if (serverQueue.stop) return;
const results = await yts({ videoId: video.videoId })
const finalVideo = results
if (!finalVideo) continue;
await handleVideo(finalVideo, msg, voiceChannel, playlist, queue)
} catch (e) { console.log(e) }
}```
can you use code blocks?
@storm bluff I'm aware. Someone suggested use Discord.Util.parseEmoji() to parse the emoji
You should do that.
thanks
@elder garnet just do this easy in where the command is located add this if(message.guild.id == "264445053596991498" ) {return;}
How does one get a channel from an id?
but its easy
but hardcode is gross

okay thanks
np
It says guild.channels.get is not a function @spare goblet
what is your djs version
It is

It gives user because the member object ceases existing
Because they are no longer a member if they get banned
Oh sorry it's cache
I think
:') sorry I'm on an old dev branch
guild.channels.cache.get()
That worked, thx
did they get rid of guild.createChannel?
yep
perfect, I see it, you're my hero
yep
Anytime have a good day

I'm trying to do a beginner tutorial without DM'ing them, so I think I'm going to try creating a user specific channel each time somebody joins then having it walk them through messaging, reacting, etc inside that channel
Good luck !
What not correct? (Python)
mhh
const sayackanal2 = member.guild.channels.find('id', sayackanal)
How can I do this according to discord.js v12
@iron scroll if pp is locked you go in the cycle
yes
and then you check if his unlocked in the cycle ?
mhhh
@earnest phoenix
Discord stable / V12
message.guild.channels.cache.get(sayackanal)
haven't you gotta wait 120 seconds before changing your bots status again on loop?
i thought i read something wrong 2 years ago
No it's now like 5-6s
Oh it was changed.
https://discordjs.guide/additional-info/changes-in-v12.html @earnest phoenix
Iara could you reset my name?
Done.
why is your name even tht
Thanks
Hoist prolly
My name used to be 95ec2c7d4ab594a
I need help
some hash
again
Ty
The error is probably self-explanatory.
yes he did i am stupid
Not even that. It's a semi colon instead of colon.
Yeah but that's not the only error.
his indentation is scuffed
what do I do?
Learn?
case something : not ;
case 'ping';
This is wrong. Search up how switch case blocks work.
Yeah it seems slow
Its not responding to ping
I was asking the same to myself
Because you need to remove ! inside the case
due to using substring and removing it from the string
oh
yes
that will never work
discord does not allow double spaces in messages
you will never receive a message with a double space
True
Like that
But if someone uses a double or even more can ruin it?
Yeah you end up getting empty strings in args.
wait since when does discord support double spaces lmao
Use single space
args[0] would be " "
s i n c e s o m e t i m e @quartz kindle
discord only trims messages
if you're using php it would be different 
:p
you should use regex
k
oh shoot
two clients oof
I also recommend that you put the token either at the bottom so when you screenshot like that you can miss it out or make a config file for it; safer that way in case you were to accidently screenshot it.
anyway either split on a single space .split(" ") or use regex like Dillon suggested: .split(/\s+/)
when you split on single space, doesnt it just remove any spaces that are left
no
for example, test test would be args[0] = test, args[1] = test
nope
There is a function to remove all "" element of a list?
hi
my bot on the site ??? How do I fix it stands with icon?
Is it because it is not attached to the dbl server?
you can use .filter(Boolean) lol
oh you are correct it does not
pls help
@ember bluff yes, your bot will appear there when its approved
approval can take anywhere from a few days to 2 weeks
why does it have 167 lol
already approved
if your bot is already approved then it was kicked from here
search the #mod-logs for the kick reason and contact the mod who kicked it
What do you need to add?
he meant that it doesn't show if it's online or offline, just ???
not attached here for a long time
no?
had not already been added
is it your bot?
yes
linked to my other account
was your other account banned from here?
no
what is your bot's id?
what is your other account, also you arent supposed to have alts in this server
Oh
639826292619083816
oh man I dont like when people do rainbow font
oh shit
reee
disable it for here
disable/remove the DMs
remove DMs
then contact Timo Halofan
ฤฑ did
@gray pagoda where do I put it?
Go DM
I've been waiting for a long time, my bot is unverified
how long is a long time, it takes on average 2 to 3 weeks
can you see my waiting time?
you cant see waiting times
I checked the bots he added and checked modlog for the bot that was added
is it possible to fetch a user on one shard and send a message from another shard?
[C] can anyone explain why when i do this:
int* p = 0;
printf("%d", p);
printf("%d", *p);
the output is only 0, i know why its 0, but why is there no place where its storing its data?
I dont know C but I think its because you are just printing a variable without changing it
Don't you use &p in C?
you do but, int* is a pointer
int *p = 0;
printf("%d", &p);
its the same as
int* p = 0;
printf("%d", p);
I don't have C installed so can't really run a test
actually no, it will give a diferent answer but it wont give the needed answer
ok wait lemme clear my self and repost it real quick,
can anyone explain why when i do this:
int* p = 0;
printf("%d", p);
printf("%d", *p);
the output will only print 0, why wont it print the location of 0?
hey, is there any way to redirect to a thanks page i made after my bot is added to a server? i tried adding my redirect url to the redirect urls list and put it in the link like that and it seems to not work: &redirect_uri=. is it even possible?
to use redirect_uris you need to use oauth2
@narrow kettle ```c
int *p = 0;
printf("%d", &p); // 348767944
printf("%d", p); // 0
so it doesnt work with bots?
only if you use the full oauth2 flow with bots
ie, the user needs to allow you to request their data
so you can send them to a different location after adding the bot
basically like a "login with discord" thing
ye but i just want to redirect to a thank you page after the bot is being added,if ill ask for more perms itll be suspicious
So I'm getting this mysterious monster of an error on running:
(node:15668) UnhandledPromiseRejectionWarning: RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values may not be empty.
at Function.normalizeField (/home/zander/Documents/discord_bots/FBI-bot/node_modules/discord.js/src/structures/MessageEmbed.js:418:23)
at /home/zander/Documents/discord_bots/FBI-bot/node_modules/discord.js/src/structures/MessageEmbed.js:438:14
at Array.map (<anonymous>)
at Function.normalizeFields (/home/zander/Documents/discord_bots/FBI-bot/node_modules/discord.js/src/structures/MessageEmbed.js:437:8)
at MessageEmbed.addFields (/home/zander/Documents/discord_bots/FBI-bot/node_modules/discord.js/src/structures/MessageEmbed.js:252:42)
at MessageEmbed.addField (/home/zander/Documents/discord_bots/FBI-bot/node_modules/discord.js/src/structures/MessageEmbed.js:243:17)
at Client.<anonymous> (/home/zander/Documents/discord_bots/FBI-bot/index.js:95:11)
at Client.emit (events.js:315:20)
at Object.module.exports [as MESSAGE_UPDATE] (/home/zander/Documents/discord_bots/FBI-bot/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_UPDATE.js:14:12)
at WebSocketManager.handlePacket (/home/zander/Documents/discord_bots/FBI-bot/node_modules/discord.js/src/client/websocket/WebSocketManager.js:386:31)
warning.js:32
(node:15668) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
one of ur fields is empty or null or undefined
That's the thing
all 3 is kinda the aame
oldMessage.content
It's just that error that appears
you said the error happens when running the bot?
When running yes
are you trying to send something that is not ready yet?
embed = new Discord.MessageEmbed;
embed.setTitle("Message deleted");
embed.setColor("BLUE")
embed.setDescription("A message by " + oldMessage.member.user.tag + " (" + oldMessage.member.id + ")" + " was deleted in " + oldMessage.channel.toString())
embed.addField("Content", oldMessage.content)
embed.setFooter(new Date().toLocaleString())
channel.send(embed=embed)
This is in on messageDelete
are you checking if the deleted message is cached?
It also gives the error when it executes that line
oldMessage only exists on cached messages
ie, messages created after the bot started
Yep it's all messages after the bot started
The embed itself works fine too, it's just that it gives an error every time
it gives the error but it works anyway?
Yep
(node:3576) UnhandledPromiseRejectionWarning: http status: 303
The playlist search function on yt-search keeps returning this, has also done so for my friend, is there any fix?
js
the error says you're using js, but your code looks nothing like js
const playlist = await yts({ listId: url.split("list=") })```
It is js though
then its wrong
How?
Wtf is that js
you're mixing js and python
and embed=embed will just give a boolean
I mean I'm running it in js and it works....
its clearly not working tho?
i mean, channel.send(embed=embed) is the same as doing channel.send(false)
But it still executes the code correctly
how does that make any sense
No....
channel.send(embed==embed) would be sending a boolean
But I'm not using double equation signs
im blind lol
I'm using single
but still
Which passes an argument
no need for that
How should I do it then?
MessageEmbed still needs () tho
@quartz kindle I have used it without the () in other places and there it doesn't give an error
How do you host multiple domains portforwarding with VMS?
Did anyone respond to my question my i was gone
channel.send(embed) still gives the same erro
or not
r
Snoekbaars
I'm assuming oldMessage.content is null
then how are you sure the error is coming from there?
There is just an error for some reason even though everything works perfectly fine
Because the error log says at line 95
Just do this
embed = new Discord.MessageEmbed()
.setTitle("Message deleted")
.setColor("BLUE")
.setDescription("A message by " + oldMessage.member.user.tag + " (" + oldMessage.member.id + ")" + " was deleted in " + oldMessage.channel.toString())
.addField("Content", oldMessage.content)
.setFooter(new Date().toLocaleString())
channel.send({embed: embed})```
no
It can't be coming from that code
new Discord.MessageEmbed()
.setTitle();
if none of them are null
@sullen salmon use the guide i linked, is the most complete one
Or use the docs?
Line 95 is embed.addField("Before", oldMessage.content)
const embed = new Discord.MessageEmbed()
.setTitle("Message deleted")
.setColor("BLUE")
.setDescription("A message by " + oldMessage.member.user.tag + " (" + oldMessage.member.id + ")" + " was deleted in " + oldMessage.channel.toString())
.addField("Content", oldMessage.content)
.setFooter(new Date().toLocaleString())
channel.send({embed: embed})```
Can you guys stop sending code
and messed up code
@sullen salmon then oldMessage.content is null
your error says fields can't be emoty
But it isn't null
*empty
Your error message says otherwise
Yet it prints out the correct message content and send the correct message content in the embed, so it isn't null @topaz fjord
The error is annoying that it prints out every time though, how do I like prune it or something
Don't ignore the error
What do you want me to do? It works perfectly fine how it needs to work? It's gotta be an issue in the api if everything works correctly and it gives an error
Could it be when an embed is deleted
@sullen salmon what if you do oldMessage.content || "none"
do the errors still happen?
When I delete and embed I get that error
are you declaring the embed as a global variable?
Say if(oldMessage.content.length === 0) return
Well the error is gone but now it's just sending embeds with "none" in them constan tly without me doing anything
Idk maybe @quartz kindle
is your bot replying to itself?
is it doing it whenever a message is deleted in any server?
Waaaiit

What
yes
Yhea this is cringe moment
What??
I put the console log statement at the wrong place
embeds are sent as edits
O
Ok that's gotta be the thing
I got errors
Thx for helping me
With music
(node:3576) UnhandledPromiseRejectionWarning: http status: 303
The playlist search function on yt-search keeps returning this, has also done so for my friend, is there any fix?
may i ask if anyone knows how to create a invite for a guildchannel using discord.js 12.1 ?
i checked the docs
hey so my bot, for some reason, isnt imputing the reply, even though im using the same outline/setup for every command/ reply
the reply object is probably null
but every command im using is the exact same format in the format of
bot.on('message' , msg=>{
if (msg.content == "instert text"){
msg.reply('insert reply');
}
})
and all of the others work it. dosent return any statement or tell me there is an error
yeah
brainwalker do you mean creating an invite for something like a text channel
yes
Are you saying that you're adding a listener for each command
@lucid pasture use === instead of ==
what channel are you looking for, the channel where the command was executed?
@feral fiber it still didnt work
i just want to make an invite for he guild
iff(msg.guild.id == "") {return;}
^
TypeError: Cannot read property 'id' of null
how do i fix dat
i have an value in
but i hid it
just get a channel and use that method on it
Two f?
yeah
in the code its 1
but channel has no method create invite
Guild is undefined
the object "guildchannel" has
msg.guild is defined tho?
look for a text channel
ok
it's null
guildchannel is just a channel in the guild, like a text channel or a news channel
Likely because the message wasn't sent in a guild
oh
its ok, but if you cant really find the method you want, try looking at the classes name too
@feral fiber can i dm you what im working with
how do i check if the msg is a DM
msg.guild
if (msg.channel.type == "dm")
if(!msg.guild)
use the ! operator to check if its not a guild

ok
@fleet chasm same thing?
yeah, but the use of ! is a bit more compact i guess
how do I get a bot to mention random users?
u dont cause thats rude
Keeping member object inside template literals will still mention the user.
Just randomize the members collection
And send.
I wanted to mention some users like WrongBotLol or DokiBot
You can use JS's Math methods to randomize the collection of members and output.
Thinking your bot is in JS.
What lang do you use hun ?
Me?
Yes.
I use Visual Studio Code sir
Language not text editor.
english
Programming language...
I has question how do i get the amount of servers my bot is in to show on the website
python
askin what is your language
node.js
Well client.guilds.cache.size will return the number of guilds your client is in.
Assuming you updated to v 12
If below remove cache.
@earnest phoenix sorry I'm not too confident with python neither the lib, but method is the same.
Oh
Get the members, randomize and output.
But how does commands work anyways
Pretty vague what you asked, can you explain ?
Allright.
Not really sure what you're trying to achieve, is it either adding commands to your bot or your bot to reply to a command with it's prefix ?
Haven't had experience with mongo, it's drop dead atm, few people use it, sorry.
[
<1 empty item>,
BinaryRow {
cid: '109419',
ownerid: '205649450222354433',
modtime: 2019-06-25T14:05:59.000Z
}
]
char.length Returns the length of it 2
Is there a way to get rid of deleted items? nodejs
I use !md ping but it doesn't work
@earnest phoenix does running !mdping work?
hmm let me try
Try?
Its not working
@earnest phoenix You should be able to
Send code
ok
https://tryitands.ee @earnest phoenix
Would of been nicer in hastebin
d.js right?
just try it and see it isn't that hard
Why use both switch and if
yes
Talked to aayala
Have you declared the mongoose module?
then mongoose.connect(CONNECT_STRING, { useNewUrlParser: true, useUnifiedTopology: true });
yes
The CONNECT_STRING will be found on mongodb.com
If you need more help, I have a video on setting up mongodb with a discord.js bot.
marketing 100
Yes.
@earnest phoenix What is your prefix?
!mb
Okay.
What's the error Aayala?
i'm trying my best here lol
I don't see much wrong with the code tbh
It won't respond with pong
Does it say Ready?
@earnest phoenix you don't need to have the commandTrigger variable .
I deleted it
Also you can shorten most of that event.
This is what it looks like
Most likely the switch statement
https://hastebin.com/dewowuheti.js read this but pref don't do this just an example.
A switch statement and if statement are still considered a command handler
I don't understand now
Where do I put new commands in the same file?
You can do.
new case
ok
above the default
also I have an issue with the ping
switch(command) {
case 'ping':
break;
case 'anothercommand':
break;
// etc...
default:
break;
}```
What?
I thought it was !mb
Doesn't matter if there is a space.
It works both ways.
If the code that is used was the one I provided.
Where do I put it?
main file
As a replacement for your other one.
config?
No.
no
replace the entire message event with that one
client.on('message', message => {
// code
});
// to
client.on('message', console.log);
I add it
Why my bot's token regenerates auto? when I refresh the page the token becomes different
pls help
that is normal
how to disable it?
i have to change the token everytime?
no






