#development
1 messages · Page 882 of 1
show full code
not the message bot sent
if(command === "someone") {
const embed = new Discord.MessageEmbed()
.setDescription('reaction')
message.channel.send(embed).then(() => {
message.react('486453662923751424')
message.react('486453681940594699')
i told you
newMessage => {
newMessage.react()
message is the old message, not the new
so uh, (probably wrong) message.channel.guild.getAuditLogs().then((e) => e.executor));
how about you console.log(e) ?
would that be correct to get the way to get the member who done the action
so
if(command === "someone") {
const embed = new Discord.MessageEmbed()
.setDescription('reaction')
message.channel.send(embed).then(newMessage => { newMessage.react() })
message.react('486453662923751424')
message.react('486453681940594699')
ok
would that work
so you can actually see what's going on instead of coding blindly
@royal portal no
where would I add the reaction id
oh
did you log e?
yeah
newMessage is not defined
show it
message.channel.send(embed).then(newMessage => { newMessage.react() })
newMessage.react('486453662923751424');
newMessage.react('486453681940594699');
what it logs?
message.channel.send(embed).then(newMessage => { newMessage.react('486453662923751424'); })
newMessage is not defined
wait it works now
but would I do
'291489214891284218' , '192481248192481' for two reactions?
same as before
in order so tick then cross
just all newMessage lines have to be INSIDE the {} block
you can do like this js message.channel.send().then(newMessage => { newMessage.react() newMessage.react() })
@winged mulch so you have maps in python too right
What are maps?
did you ever code before
dictionaries
Ah, yes
message.channel.send(embed).then(newMessage => { newMessage.react('486453662923751424'); newMessage.react('486453681940594699'); })
so in a map you can put two values each
I did that @quartz kindle
dictionaries for Python but commands extension allows you to add cooldowns to commands with decorators 
They are called dictionaries in python
ah okay
@royal portal yes, it doesnt matter if its all in the same line, or separated in multiple lines, what matters is that its inside {}
what about an error log
so you will make a dictionary and everytime a user executes a command, you put in the user id and the number 1, in case he isnt in the map yet
if he is in the map, you increase this number
do I add .then(console.error); at end?
.catch(console.error)
message.channel.send(embed).then(newMessage => { newMessage.react('486453662923751424'); newMessage.react('486453681940594699'); }).catch(console.error);
so that works?
then you make a limit, how many commands a player should be able to run within a time
check everytime he runs a command if the number in the map is bigger than ur limit, then cancel the command
and you also create a timer which will run every X seconds, which clears the dictionary
done
@bright meadow I thought about doing that but I don't know how to use time.
Hamburger is your bot sharded?
@royal portal that will work for errors during the sending of the embed, not for errors during the reacting
I did 5 commands every 3 seconds, so it cancels a command if the number in the dictionary is 5 or greater (greater shouldnt be possible tho)
and so I created a Timer, which clears the map every 3 seconds
@winged mulch
to catch errors on the reactions, add it to the reactions as well: .react().catch(console.error)
shard?
i prefer 5 seconds cooldown
i dont
and 0.5 cmds per second
Hey
no wtf xD
yes xD
@winged mulch Do you use discord.py's commands.Bot or discord.Client
depends on bot type ig
Chi e ita?
@slender thistle Bot
i have a game bot so it will get boring if you have a too long cooldown
@bright meadow Thanks for the information.
Hey!
How can I make a system that when a message receives a specified reaction, the bot will edit the message and change a number from 0 to 1? and then when it gets another reaction it will edit the message again and change 1 to 2, etc? - I'm using Discord.js
This is my current code:
let hotw_committee_role = "698660218040483921";
let hotw_committee_members = message.guild.roles.cache.get(hotw_committee_role).members;
if (message.content === `example command`){
if (message.author.bot) return;
message.delete()
const Embed = new Discord.MessageEmbed()
.setTitle(`example`)
.setDescription(`example`)
.setColor('color')
message.channel.send(Embed)
const Embed2 = new Discord.MessageEmbed()
.setDescription(`Current votes: **(number/${(hotw_committee_members.size/2) +1})** \n\n(**Bot's reaction doesn't count!**)`)
.setColor('color');
const m = await message.channel.send(Embed2)
m.react("698687776421445654")
const a = db.fetch("message")
if(!a) db.set("message", [m.id])
else db.push("message", m.id)
message.channel.send(`Test Message`)
};
});
const approvedIDs = new Set();
const upvoteID = "698687776421445654", committeeRoleID = "698660218040483921";
const committeeMembers = message.guild.roles.cache.get(committeeRoleID).members;
const requiredCount = Math.ceil(committeeMembers.size / 2) + 2;
if (emoji.id !== upvoteID || count < requiredCount || approvedIDs.has(message.id)) return;
approvedIDs.add(message.id);
message.channel.send(`Test Message");
});
Thank you very much, please Ping me when replying 😛
The word 'number' is where the function should be at:
(number/${(hotw_committee_members.size/2) +1})**
hi installed ubuntu nodejs and npm ```sudo apt install nodejs
sudo apt isntall npm
node -v
v8.10.0
npm -v
3.5.2``` WHYY????
WHY Version
node js 12 ??
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt install nodejs
@earnest phoenix
hi uh
module.exports = () => {
console.log('edited');
};
in my messageUpdate.js and uh
it just spams edited for some reason
any ideas why?
nothing else spams
like same dir and everything, but
¯_(ツ)_/¯
spams
@quartz kindle how would I send an emoji in a message
I tried it and it only sends the id
@royal portal <:emojiname:emojiId>
@royal portal is ur bot in the server the emoji is from?
no I used a different method
for custom emojis
it works now
thanks for helping too
np
How can i fix "process.send is not a function" i am not tried this code but i am seeing it on every opening..
v12?
what is the full stacktrace
this;
https://oliy.is-just-a.dev/0ncaw9_3629.png comes from here could be a discord.js bug?
What node version do you have?
is process.send all the code?
It's in the discord.js shardingutil file
It must be a parent process, where process.send() isn't defined
I don't really understands Eris's sharding system, can someone please explain me little bit about it, example how do I shard my bot?
its ur client options
in ur*
eris doesn't have djs' wack sharding manager
Eris, a NodeJS Discord library
so I just make sharded true or something like that?
oh, nice.
and are there way to get all shards to execute some code, like d.js has broadcastEval?
i haven't really looked into sharding much since i don't really need it but, i do not believe so
so I need to use some process.send or so. thanks for the help :)
np
i believe eris does internal sharding
okay
there is a separate sharding manager for eris if you prefer process sharding
okay, well ill probably use it if eris own shard manager wont provide such info as: current shard, current cluster, shard guilds, shard users.
Well, I looked little bit into the docs, and I dont seem so it doesnt.
That's kinda the point of internal sharding I believe
all that info is available
its just harder to get with internal sharding
for example, you need to loop over guilds and count the number of guilds on a given shardID
are you resolving the promise first?
Any ideas on how to check if my bot has permission to post in a text channel?
@vast oxide I believe there is a channel.permissionsfor(member) method
Function:
if (language !== "en_US" && language !== "tr_TR") return console.log(`${language} dili bulunamadı!`)
const file = require("../languages/" + language + ".json");
const text = file[message]
if (!text) return console.log(`${language} dilinde ${message} mesajı bulunamadı!`)
return text;
};```
**Tests:**
console.log(client.locale("en_US", "testtest"))
console.log(client.locale("trtadkt", "testtest"))
console.log(client.locale("en_US", "Version"))
const test = client.locale("en_US", "Version")
console.log(test)```
en_US.json:
"Version" : "1.0.0"
}```
**Results:**
```testtest is invalid message!
Promise { undefined }
trtadkt is invalid language!
Promise { undefined }
Promise { '1.0.0' }
Promise { '1.0.0' }```
@iron steeple doesn't seem like it. I can get overrides but if there is no override then it won't show right?
client.channels.get("CHANNEL ID").send(test)
Cannot send an empty message
yeah see, your locale function is async. You need to resolve the function first, then log it.
One second @vast oxide
Either by using await, or .then
might count as off-topic, but how do some bot pages have websites embedded in them?
e.g: dank memer
Use an iframe
@sudden geyser I deleted async and it works idk why, I never see an error like that but thanks
yeah you didn't need async in the first place but I don't know if that'll work in the long run
My bot is offline but no error in the logs. How can I start it up?
node botname.js?
?
if it says it's offline just restart it
How can I restart it?
how'd you start it the first time?
^
I just made it atm. it's a hangman bot.
Only use Utils.json and Hangman.js but I don't know how to start it
Assuming it's a nodejs project, use node mainfile.js
If you have a main prop in your package file, you may be able to do node .
in your case it would be node hangman.js most likely
oh but you might have to ctrl+c
I'ma go try it, hold on
How would I mention a channel in Python Would it be something like {channel. mention} like if I wanted it to mention the channel rules every time the command was ran
channel_object.mention
Or put <#id> in string
Thats not how f string work
have you tried: Reading the message next to that big red X with that lil pop up that you have to click on to do anything else on
i don't even understand the logic of that one 
also that indentation is 
I get it It says if there's nothing in it but I have put stuff there
How much would it cost to get a bot developed? Like would $200 be enough to get something with good quality?
People most likely charge much less than that
questionable quality tho
It'd be a pretty slightly complex trivia bot with a trusty database
I've paid $50 for one before and it was great quality, but not as intense
I mean you can order customization
I need some help, I'm actually building a website for my bot and I'm trying to make one image fade to another:
async function changeImg(element, iterator) {
if(iterator < image.length - 1) { iterator++ }else { iterator = 0 }
for(n = 255; n > 0; n--) {
await setTimeout(() => { element.style.opacity = (n / 255); }, 1000);
}
element.src = image[iterator];
for(n = 0; n < 255; n++) {
await setTimeout(() => { element.style.opacity = (n / 255); }, 1000);
}
return iterator;
}
This is called to change images, however, the delay doesn't exist
So you could dynamically add stuff on the go without paying the dev to add them
quick: easy, reliable, free, unlimited 
dont use javascript animations like that
use css transitions
animating with javascript like that is very inefficient
Can I call a CSS animation in the JS?
yes
Oh
but you dont even need to
define a transition in css, then swap the img opacity
the transition will do the rest
Ok I'll look into that
I found a bot on github and it was completely broken and didn’t have a license file, if i fixed it, can i put it on top.gg?
Sure
Ok thanks
Next time ask in #memes-and-media
Ok
This is more of a development questions channel
Wasn’t sure what is was related to
If a repository has no license, then all rights are reserved and it is not Open Source or Free. You cannot modify or redistribute this code without explicit permission from the copyright holder. @toxic plinth @split hazel
Public repositories on GitHub are often used to share open source software. For your repository to truly be open source, you'll need to license it so that others are free to use, change, and distribute the software.
copied bots arent allowed on the website afaik
think about this: if its broken if your gonna go through the effort fixing why even copy it in the first place
I could remake that bot in about 5 minutes
I need help using aiohttp to access the bot vote pages in discord.py. I mostly figured out how I'm supposed add a header, but it says it has to be a dict. I tried at least 10 combinations but I cant figure out how to authenticate it
you know theres a lib for dbl right
isnt it simply this in python? js headers: { Authorization: token }
its very simple
I'm meddling around with my code and I tried to make a bot suffix, would this code work (what I'm trying to do is when I go -ping. it will respond but without the full stop nothing happens?)
var SUFFIX = ".";
var prefix = "-"
bot.on("message", message => {
let args = message.content.substring(SUFFIX.length).split(" ");
let args = message.content.substring(prefix.length).split(" ");
switch (args[0]) {
case "ping":
message.reply("Pong!");
break;
}
});
tag me with a response please I'm not active here
but i thought i'd share the idea that theres a lib for it which most people have anyway with topgg
@still merlin that will simply error out because args is already defined
also wouldnt regex be better for that
how do I do it I go -ping. it will respond but without the full stop nothing happens then?-
just do js if(message.content.startsWith(prefix) && message.content.endsWith(SUFFIX)) { continue the code here }
ok thanks so much!
This is my code and it still doesnt work:
async def get_votes():
async with aiohttp.ClientSession() as session:
headers={'Authorization':'token'}
async with session.get('http://top.gg/api/bots/655157441612349453/votes', headers=headers) as r:
js = await r.json()
return js
and it says nauthorized
@quartz kindle so sorry for the tag the code you sent isnt working
he wasnt just gonna spoon feed u the code
...
also @hidden bone https://github.com/DiscordBotList/DBL-Python-Library/blob/b98e22d9e55f56c8417bc94ebbeb5beb6ab32745/dbl/http.py#L78
A simple API wrapper for top.gg written in Python. Contribute to DiscordBotList/DBL-Python-Library development by creating an account on GitHub.
Switching Command Line Args has me so confused
if you insist in not using the lib
@still merlin of course you still need to define your args
When exactly do DBL votes reset? I assume the first day of the month, but what timezone does that follow?
you can remove both ends from a string using .slice
for example: "1iwubeouweouhwoueh9".slice(1).slice(0,-1) = "iwubeouweouhwoueh"
@earnest phoenix i assume UTC
yeah I thought so too
I'll just assume they restart at that timezone then
Hey, someone wanna make a bot whit me? Then pls contact me! 🙂
Is it possible to do an eval to get the first 10 user joins?
first people who joined the server where you eval from?
First 10 people to join a server
you will need to fetch all members of the guild to be able to do that
which will cost a lot of memory and cpu if the guild is very large
then display the first 10 members?
yes
ooh ok ..
does anyone know whether you really need python2.7 and a cpp compiler for eris voice support?
you do to build its dependencies
that sucks
I updated my quick db to the latest version so i can now use db.delete and stuff like that, i have a command that is resetting the coins by fetching all members and settings for each one 0 coins.
Should i change it?
What is faster / better?
Is somebody using BDfD
its widely hated around here so you are not going to get useful answers
I updated my quick db to the latest version so i can now use db.delete and stuff like that, i have a command that is resetting the coins by fetching all members and settings for each one 0 coins.
Should i change it?
What is faster / better?
Asking again because idk if you can see it
i can see it i just went to do a quick google search
the faster and better way is to delete the table
haha noob

So is it like db.delete(message guild id)
lmao
Coins.delete(message.guild.id)?
yes
quick.db is a synonym of shit
Oh ok
Guess its better than fetching all users lmao
daily opinion spreading by turtle
hey im going to take a quick quick.db
I love quick.db

But thats kinda #memes-and-media
I'd rather git commit than use quick.db
quick.db = sqlite wrapper
just use
sqlite
they dont wanna bother learning sql
lol why do you hate it so much
quick.db is just a wrapper for better-sqlite3
and fucking shit
how is it a waste of time 
if people wanna go the easy way and struggle later, let them
you're better off learning sqlite and applying those skills to MySQL instead of learning how to use quick.db
future proof™️
sadly the easy way is also the shit way most of the time
i mean, better start with something simpler that works, than starting with a full database system and building it all wrong
alternatively instead of using MySQL which is slow as fuck, you use sqlite for testing systems then use postgres
I started with keyv at first, then moved onto raw sql
How do I get a url for the message author profile picture?
What is the difference between
DisplayAvatarURL
avatarURL
It gives me this link and I don't know how to use that format of image
https://cdn.discordapp.com/avatars/409859533691813889/aecc22c39339a66beb55bfb3347883bb.webp
probably
well it works here
okay thx
• Autoplay video or audio
So you're not allowed to put a muted html video that autoplays into your bot page? html (mp4) videos load better and filesize/quality is better. 🤔
a muted video is still a video
Is it possible to get information from a playing link in v12.1.1
what
Let say the bot is playing this link http://20103.live.streamtheworld.com/TLPSTR09.mp3. Is it possible to get information about what the bot is playing?
My code
bot.user.setActivity("watching for commands");
});
``` is coming out "playing watching for commands"
god
Playing is default
playing is the default activity type
there are 4 activity types
listening, playing, watching, streaming
{type:"WATCHING"}
Let say the bot is playing this link
http://20103.live.streamtheworld.com/TLPSTR09.mp3. Is it possible to get information about what the bot is playing?
@heavy marsh
playing as in presence-wise?
i don't get what you mean
be more descriptive with your goal
mp3 as presence?
define "information" that you want from the stream
Like say what is currently playing on that link
what
you can't
is that like a radio station?
then you cant
they need to provide you with an API which gives you the current playing song
any way to do it?
the stream is just sending audio data
^
Hi guys, I would like to set up a bot web dashboard. The fact is that I just know the basics of html / css. Do you guys think I can do it? Any advice?
then can I do something like this ...
!play <link> then i do !np - This will give the link that its playing.
Is that possible or should I store it?
@heavy marsh where are you supposed to get the information from?
probably not @opaque seal
i'd suggest first learning more about web development @opaque seal
check out this roadmap https://github.com/kamranahmedse/developer-roadmap
can i use xml instead of database?
that's equivalent of json, which is just as bad
exactly
So I need to change the database of my bot to something else? Is json that bad that I have to switch?
yes it is
json isnt even a database lol
you're more likely to experience blocking on data insertion and data corruption
its never made to
I mean I was looking for some examples and I so something like this
if (!station) message.error("An error occured.");
const broadcast = this.client.stations.get(station);
message.reply(`Playing **${broadcast.current.title}** on the **${station}** station.`);```
What would you suggest
i personally love using postgres for big scale
it's opensource and outperforms most databases out there
https://www.postgresql.org/ - This?
The official site for PostgreSQL, the world's most advanced open source database
yup
ooh
are u sure?
This tutorial introduces you to various PostgreSQL integer data types including SMALLINT, INTEGER, and BIGINT for designing tables.
wait, bigserial
i just found it
oh wait nvm, that just is bigint, but cut half
weird how "big int" is 8 bytes, that is signed
but bigserial is also 8 bytes but unsigned. but still has the same positive max range value
Do you have any idea on how to run multiple JavaScript files from one JavaScript file?
there's a billion ways to do that, what exactly do you mean?
the correct way depends on what you want to do
require()?
I want all my js files to load when I run the main js file
What would I put in the require() exactly?
filename
the file you want to load
Ok
the path to the file
Thanks you
for example const something = require("./file.js") if the file is in the same folder as your main file
ok to add on to my problem there is a .gradle directory and gradle-wrapper.properties is not in it
how would I make it so the bot reacts to its own message and if ppl react to it then it gets pinned
you mean like starboard?
kind of
assuming it's djs then you can just listen for a message reaction add event
i think
how does one find what version of node.js you're on?
did I screw up again 
also I can't find this anywhere in the docs, but there's no hasRole right
for Member
or GuildMember rather
@still merlin client is not defined
npm install discord.js
thats a problem in your code
that is the error lol
my code is
const Discord = require("discord.js");
const bot = new Discord.Client();
const token = "*my token*";
bot.login(token);
var prefix = "-";
client.on("ready", () => {
console.log("Bot is up and running");
});
bot.user.setActivity("for commands", {
type: "LISTENING",
});
bot.on("message", (message) => {
let args = message.content.substring(PREFIX.length).split(" ");
switch (args[0]) {
case "pfp":
message.reply(" message.reply(message.author.displayAvatarURL())");
break;
}
});
@quartz kindle possible to check if user is nitro?
ooh
yes
@still merlin change client.on to bot.on
my bot still is not coming on
whats the error?
none
show me
im not getting a error it wont turn on
show
if one of my arguments is a ping, i.e. @vernal basin, why does args[0].roles not work?
const Discord = require("discord.js");
const bot = new Discord.Client();
var prefix = "-";
bot.on("ready", () => {
console.log("Bot is up and running");
});
bot.user.setActivity("for commands", {
type: "LISTENING",
});
bot.on("message", (message) => {
let args = message.content.substring(PREFIX.length).split(" ");
switch (args[0]) {
case "pfp":
message.reply(" message.reply(message.author.displayAvatarURL())");
break;
}
});
bot.login('token')
@still merlin did you save the file and run again
its still showing the old error in the terminal
tim
what the heck
you still have client
is it possible to check if user is nitro
That's clearly wrong
oH
message.author.premium?
Hi all
I need some help
I want to create a bot which will choose one of the group of my friends who wrote a special command on the server
And after that bot randomly sends someone a private message that will include a code information
So i cant understand how to make the bot send direct messages to someone from the group
Sry for my broken english :(
Thank you in advance
probably a missing quote
connection.play(`http://20103.live.streamtheworld.com/TLPSTR09.mp3`);
message.channel.send(` **Now Playing ...**\n**Radio Station:** 538 Non-Stop`);
The bot joins starts playing and stops. I have not got any errors on the console
@royal portal you cant check for nitro with discord.js
aw
how do u add a slowdown to a command in discord.js so a user can use it only once every hour
pls dont ban me for cross posting in general as well
It’s under cooldown when you define the command
So like commands.command(cooldown=)
.js not .py
In python not sure about js sorry
Oops!
me?
👀
No one can help me?
Im using python
untethered can
cooldown per user?
me, yes
@bitter nexus what do you need help with
create a pool of users when the last user has used that command and check how much time since that command has been used
Hi all
I need some help
I want to create a bot which will choose one of the group of my friends who wrote a special command on the server
And after that bot randomly sends someone a private message that will include a code information
So i cant understand how to make the bot send direct messages to someone from the group
Sry for my broken english :(
Thank you in advance
@bitter nexus
uses all brain power to try to understand
@turbid bough can u show me how it looks like but dont spoonfeed me
@bitter nexus simply use member.send
i have group of my friends and i want to randomly choose one of them
And sent him direct message with some information
So get the member as a variable @bitter nexus
create an array, and do an if(member.time > time.now)
create an array of all users
how would I make it so if anyone is in a specific server then they have access to a command and if they aren't in the server, they get an error message
but my bot is in a 6k person server how
not all users lol
then which onez
just the ones who used that command
oh how to do that
When I open the bot (@earnest phoenix) , it opens late. But the other bot (Eagle's test) does not open late. What is the reason for it to open late? (the same infrastructure) (Note: Eagle has 767 server count.)
Yea that my problem
I cant create variable which contains someone of the group
@earnest phoenix it has to cache messages
how would I make it so if anyone is in a specific server then they have access to a command and if they aren't in the server, they get an error message
@royal portal
anyone know how
@bitter nexus DM me your code for that
what do you mean "opens late"
I think he means there is a delay
I don't know English so much
a delay in what? in logging in? in getting ready? in replying to messages?
Do you mean it takes some time to activate
Yeah logging and getting ready
Yes I believe that is due to the need to cache messages and fully initialise
how much delay?
@hardy vector when your command is used, just add the user to the list with data with time when the command was used.
then check how long ago it was since the bot was used, currentTime - user[id].time or something like that
Sometimes 5 minutes or later
discord.js?
Yes
v11 or v12?
Hmm 5 minutes seems very weird
not needed no
k
11.5.1
but only if you want to make it persist trough instances and reboots
@earnest phoenix https://github.com/discordjs/discord.js/issues/3956
nah not like that
Thanks 🙂
I guess I can't do it
Btw I love Eri 😄
if (message.guild.id !== 'ID') return (error message)
So, you initialzie an array at the start of the program, then once the command has run, you add user users.add(userid, time.current) if py has something like that,
then compare it when the command has been executed again
I mean if the user is in a specific server and uses command anywhere then it works but if they aren't then it says you don't have perms
ah
Also I am using Mongodb and it too many connections. How/can I fix it?
so if I'm in DBL then I can use cmd
you need to fetch it because they might not be cached
and if I'm not, it says I don't have perms
but how would I check if the user is in the server?
@turbid bough im using js
let member = await client.guilds.cache.get(guildID).members.fetch(userID).catch(() => false)
if(member) {
member is in the server
} else {
member is not in the server
}```
Also I am using Mongodb and it too many connections. How/can I fix it?
@earnest phoenix Haven't used Mongo, but for SQL you can fix by making sure you close connections after you are done with them. There is also a way to increase the 'max connections'. Might be the same for mongo
so I replace guildID with '2421712712741233213124'
var obj = {
userId: time
};
if(obj[id] == undefined || obj[id].time + delay < currentTime){
obj[id] = currentTime;
}
basically
i think
obviously var initialization on the start of the program
and the if statement in the command
ok
Can You Get A Members Tag? member.get(id).username works but is there a way to get the tag?
discriminator
discord.js
^
@earnest phoenix Haven't used Mongo, but for SQL you can fix by making sure you close connections after you are done with them. There is also a way to increase the 'max connections'. Might be the same for mongo
@lapis stirrup Frankly, I don't have much money, so I don't want to increase max connections. Closing the connections, it going into the bug.
Sorry for ping
discord js documentations isnt very googleable :/
Oh do you have to pay for more connections in mongo?
let member = await client.guilds.cache.get('4819248192481924129').members.fetch(userID).catch(() => false)
if(member) {
member is in the server
} else {
member is not in the server
}
would that work tim
discord.js documentation is one of the best documentations out there
I'm not too sure then, but I'm sure there are some answers on google
its so easy to find everything
Hamburger that should yeah
yeah you can find it when you are in discord.js docs
but not when searching it from google
There is an issue with discord.js that I don't know how to fix
it is reach max connections by opening and closing connections. And opening in the place where it will close and reaching the maximum connection again.
calling message.delete() works fine but saying message.delete(100) causes a crash. It's recent and I didn't see where the argument changed
Night! Sorry I couldn't help too much
you could try keeping a connection open all the time?
@fallow quiver
How do I remove the reaction of the user I collected from?
message.awaitReactions(filter, {max: 1}).then(collected => {
const reaction = collected.first()
if (reaction.emoji.name === "✅") {
message.reactions.remove(collected.user.id)```
It was already like that, Thaun
It's just a number right?
message.delete() would only delete the message you referenced
Correct
you would use something like channel.deletemessages or something if you want to delete multiple messages
Why would I delete a channel?
@fallow quiver options is an object
I just want a delay before the delete
@quartz kindle for the userID how would I make it so if the user uses the cmd it checks their servers
ok ok
delete(null, timeout)
Which saying message.delete(100) used to do
@gritty bolt you can try reaction.remove(userID)
Just pass a null obj?
or delete(timeout=100)
if that works
Yes
anyone know?
then give it an object
how do I get a user ID to use that with from the collector>
to check the userID of the person who used command
@royal portal message.author.id
Ok, but it is using message as the object, the crash was just happening from the delay
?
message.delete() takes an options object
message.delete({option1:value1,option2:value2})
the proper object for a timeout would be { timeout: <whatever> }
It's optional, right? So saying message.delete(timeout = 100) would work instead of passing an optional argument
no
@lapis stirrup I tried that and it says that userID is undefined
i dont know where to get the id from
.delete() takes an object so .delete({ timeout: 100 })
Ok
If collected.user.id works then you can use that, userID is just a placeholder
collected.user.id doesnt work though
collected user?
collected is a collection
get the first and get the id
collected user isnt a thing
can you give an example?
like collected.first()
so collected.first(id)?
yes
then you must know the difference between a property and a method
properties and methods have nothing to do with a library such as d.js
anyone know how to dm user if once they join a specific server
so like id 2491204210492104
and if user joins that then they get DM
You can check the users ID when the guildMemberAdd event is fired, and compare it against that ID
message.guild.voiceConnection.dispatcher.volume - Is this not vaild for v12.2.0
and then a 'verified' role in every server its in
@heavy marsh, I dont think so, if I remember correctly I think its .connection.voice now
Could be wrong
hmm let me check
bot.on('guildMemberAdd', member => {
if (member.guild.id === "ID") <send dm>
thank you
You mean embed?
yeah
js?
yep
is for my page, not for my bot
you can't do that with js
he means on youtube
read the link I sent @earnest phoenix
lmao
ok
has nothing to do with discord.js
Eris and Discord.js has the same functions right?
or embeds
what you want is metatags
it's OG tags
https://oliy.is-just-a.dev/qdjyib_3643.png he wants this
wrong link
@topaz fjord i mean like their functions like sending messages and stuff
@amber fractal yes
they are just different in function and properties names right?
but not for yt
wrong link lmao @earnest phoenix
oh
They're called OpenGraph tags
@topaz fjord so?
^
ok
I'm a bit slow and confused the names for some reason
so does Discord.js and Eris has all the functions that each other has but just at different places with different names?
they both offer full coverage of the discord api, I believe
if that's what you mean
yes thats what i mean
im working on a project that is recoding eris so it’s function and properties names are the same to save time for developers wanting to switch
what does eris lacks from discord.js?
like what does d.js has that eris doesnt?
that will take a lot of work, good luck
they're very different
they handle data very differently
that's not a simple task
ik
discord.js has a lot more helper functions and internal methods to make it easier to access certain things, they treat and process events differently as well
how does eris fetches users?
Eris doesn't have message collectors afaik
ok work, how i select the color? @topaz fjord
xd
haven't used them in a long time
select the color of the bar?
<meta name="theme-color" content="#7289DA">
its not the only one
theres also <meta name="twitter:card" content="summary_large_image">
it also supports this https://oembed.com/
neither did i, until now
@quartz kindle @topaz fjord ty
I have another stupid question for you awesome devs.
When I try using var myGuild = bot.guilds.cache.find(g => g.id == [Guild ID]); in a command it gives me this error Cannot read property 'guilds' of undefined
bot is undefined
So is this wrong const bot = require("../bot.js"); I have it to get bot from my main page were it is defined
@blissful scaffold
I have no experience with making JS bots, so I can't give you any details
All I did was reading the error message
ok
message.guild.voice.connection.dispatcher.speaking
``` - Can we check is the bot is speaking like this
Evaled it and got null
How can I make it get true or false
well
speaking is on the voiceconnection
not the dispatcher
but it returns a Speaking class, which is a bitfield
Then how could I check if the bot is speaking or not
what does guild.voice.connection.speaking return?
guild not defined
.connection.speaking also returns null?
what about .connection.speaking.serialize()
you forgot voice
When I try using var myGuild = bot.guilds.cache.find(g => g.id == [Guild ID]); in a command it gives me this error Cannot read property 'guilds' of undefined
well i guess that works
Then how to just get spreaking?
.serialize().SPEAKING
ah
the fastest way would be to simply do .connection.speaking.bitfield & 1
I have 0 knowledge of bitfields or bit operators
suppose I should learn at some point
basically bitfield & bit = if bit exists in bitfield
1 & 1 = true
2 & 1 = false
3 & 1 = true
4 & 1 = false
is there any way to get both a variable and function under the same name with a class
permissions are bitfields right?
ie.
thing.avatar // 'url.jpg'
thing.avatar() // 'url.png'```
I don't think so
i dont think so
yeah thought so
my idea was that using it alone would provide you with the hash but using it as a function provided the url
you could make one lowercase and the other uppercase
most people seem to simply prefix methods with get
this.avatar
this.getAvatar()
Getters 'n setters
oh ok
OK SO
..?
First of all, disable caps
Earlier, my friends and I made a server due to a joke on a different server.
So yeah
and uh
ever since I added most of the needed bots I've had no idea how to do the things with the moderation bots?? and I don't know what bots that I don't already have to get???
and also I'm dummy and can't figure out channel things dsuiu
Errr...what's your native language?
my native language is english I'm just tired haha
I have no idea what that is hahahha cries
js i'd assume?
me?
yeah
That's why I assumed JS
I've only used the node mongo driver, not mongoose so I wouldn't be able to help you with it specifically
Hey! I have a question
Can I have a bot.on("message", async (message) => { listener and a bot.on("messageReactionAdd", ({ message, emoji, count }) => { listener in the same line? If so.. How? 😛
i need to know how i should go by connecting to my mongodb and making a place to actually store stuff
its just for my economy
so i would like to store like money and id whatever
For making a db you can use the command line mongo tool
@coarse topaz you can, but there's no reason for that
also im using atlas
Since the latter will not execute
Oh
Uh then I guess you could use code to make the db
will probably localhost when it gets on a vps
What's happening is that i need to put a await in the messageReactionAdd listener but it sends me an error :/, @lyric mountain
so im looking at the mongoose npm page and is this how u would make a db
const Schema = mongoose.Schema;
const ObjectId = Schema.ObjectId;
const BlogPost = new Schema({
author: ObjectId,
title: String,
body: String,
date: Date
});
-play rave dos fluxos
@coarse topaz you can't await outside of async methods
^ @magic geyser bot commands only work in testing channels
but what about accessing it and storing data
Música
@coarse topaz you can't await outside of async methods
@lyric mountain Then, putting the messages and the reactions listeners in the same line could fix it?
@magic geyser comandos só podem ser usados em #commands ou #265156322012561408
#265156361791209475 rave dos fluxos
Don't really know anything about mongoose
@coarse topaz no, you shouldn't ever need nested listeners
But that looks more like you're making a schema not a db
wait whats the difference
What's your use-case for that listener?
If you don't need schemas then I'd just use the node mongo one
i just want to store and get data for my economy commands
I think it's just npm mongodb

Or you could use sqlite lol
@coarse topaz no, you shouldn't ever need nested listeners
@lyric mountain Ok, then I'll need to ask you something else then, x)
Is there a way to save the new Date(message.createdTimestamp).toDateString() thing of a message, and then include it in the messageReactionAdd listener?
i know sql but i want to use mongo
@coarse topaz just use a variable for that
moving to something bigger like mysql is a hassle
@coarse topaz just use a variablr for that
@lyric mountain Thank you! I'll try it 🙂
when i get to the point of where i have to
@coarse topaz remember that everything inside brackets will be run when that event is called
So no need to put everything in one line
@scenic kelp so does the example code make the db
That's a no, but as far as I can tell when you connect to a db and it doesn't exist, mongo will make it
coolio
then so long as you create a collection it should save it
So no need to put everything in one line
@lyric mountain I see...
Well, see this, I've tried it, and I know I'm doing it wrong, but, how should I figure it out then? 🤔
var createdDate = (Embed2).new Date(message.createdTimestamp).toDateString();
It's sending an error: Unexpected Token Date
(It's under the line of the message.channel.send(Embed2) thing)
Does anyone want to tryout for a goated team
@willow wasp please don't ask non channel related questions.
ur slow™️
@lyric mountain
if (message.content === `vm!vote`){ if (message.author.bot) return; message.delete() const Embed = new Discord.MessageEmbed() .setTitle(`Example Title`) .setDescription(`Example test`) .setColor('GREEN') message.channel.send(Embed) const Embed2 = new Discord.MessageEmbed() .setDescription(`Example test`) .setColor('YELLOW'); const m = await message.channel.send(Embed2) var createdDate = (Embed2). new Date(message.createdTimestamp).toDateString(); m.react("698687776421445654") const a = db.fetch("message") if(!a) db.set("message", [m.id]) else db.push("message", m.id) message.channel.send(`example test`) };
I don't think that's right
you're thinking correctly
You should send Embed, not Embed2
it works correctly, lol
Wait... Are you trying to delete the message it's responding to if it's a bot?
I only need to know what's the date the message was created, to use that variable in the reactions listener
It's supposed to send a first embed and then a second one
var createdDate = (Embed2). new Date(message.createdTimestamp).toDateString();
what are you trying to accomplish here
that's why I named it Embed2
literally makes no sense
Then it will take the Created Date from the second embed (Embed2)
@lyric mountain

I literally didn't understand what hector is trying to do lmao
i dont understand it either
from what i got they're trying to get the Date of the message creation
but they're doing it blindly without actually looking at what they're doing
But Creation of the second embed which is not even sent yet...
it is sent
and not the creation of the embed, the message
I mean yea that
they're also mixing async and sync code which is even worse
It's like a pile of spaghetti code
they're a help vampire 
Lol
@earnest phoenix wait a second... Why is he Creating the first embed when he only have to do something with the second one?
i dont even know
i dont question it
lol
Oh he is sending the first one... But I'm confusing about what he doing with it lol
what is even happening
Nothing
our second biggest airline just went into voluntary administration in Australia
^ virgin australia
tony this is development
love the code on that one

lmao
But Creation of the second embed which is not even sent yet...
@earnest phoenix Yep, it's sent at the same time than the first one
and not the creation of the embed, the message
@earnest phoenix ah... is there a way to get the embed creation date?
@earnest phoenix wait a second... Why is he Creating the first embed when he only have to do something with the second one?
@earnest phoenix The first one just gives an information, but the important one, is the second one x)
Oh lol
I literally didn't understand what hector is trying to do lmao
@earnest phoenix Haha lol, it sends a message > the bot reacts to the second embed sent > if the bot gets a specified amount of reactions, it sends a message > in that message the bot will send, i want to include the date of the first sent message :p
Well, would thank it a lot if someone could tell me how to get the creation date of an embed to be able to use it in another listener... Please ping me if you get it 🙂
I have no idea how to lmao
héctor, have you tried, idk, reading the docs?
maybe this could help? https://discord.js.org/#/docs/main/stable/class/MessageEmbed?scrollTo=createdAt
