#development
1 messages Β· Page 529 of 1
does it?
also the discord api is 100% on US east
only thing regions change is voice servers
yes
sharding is shard_id = (guild_id >> 22) % shard_count
if you connect multiple processes using internal sharding, will it remove guilds from one process and assign the to the other?
thats what im talking about
Hm k
sharding is only really useful to split the load between multiple tcp connections
and, depending on the language, across multiple cores
Will look more into sharding before I get more hosting servers
as far as bots are concerned
for discord it lowers the load because connections are split between possibly multiple machines
yeah thats what he wants to do
instead of having a huge bot overloading a single machine
sharding for bots won't lower latency
if you want low pings, get a server in US east
regions only matter for voice servers
I'm hosting on 3 servers in Amsterdam right now
hows the ping?
i get about 100ms api/gateway ping on amsterdam
Around 120ms
it's a little more involved to orchestrate across machines
So us East will really improve my latency
but small bots can easily have all shards on a single machine
api/gateway ping, yes, us east will help
you can specify total shards and current shards right?
total shards and shard id
so same amount of total shards on all machines, and manually set shard ids on each machine
the identify payload requires the total and current id
Okay will rent a server in us east and try
you have to use the same total shards for all connections btw
or you get OP9'd
aka invalid session
just make a command that edits/saves a config file containing the shard config
or use recommended shard count
if you have multiple machines you could have eg redis saving the shard count
i'm currently going with groovy's method fetching shard id
i just run one process so using recommended works for me
i might override it with a lower count tho
my goal is just to add a node to the network and it will find shard id to assign to itself
i'm planning on using lighthouse for that when i get to that point
What about lavalink how many resources it uses per server playing music? Approximately
can anyone reccommend a node module that emits an event when a streamer is live?
on twitch?
you can try this
that seems to be exactly what i need, thanks!
how can i make my bot ignore some roles when removing roles?
cuz it tries to remove all the roles (including the bot role) and gives me
DiscordAPIError : Invalid Role
it want the bot not to delete the bot role
how are you removing all roles?
if you're looping over them, just add a check to skip said role
i dont see why it wouldnt be
Is she cheating on you
why do you allow these scam ads
imagine having friends
this post was made by the antisocial gang
Lol
if you had a gf you wouldnt be here coding
yees
Ok
imagine memeing in the right channel
this post was made by the go to #memes-and-media gang

Heya! I was wondering if anyone knows a good js library for searching similar strings. I used string-similarity currently but I donβt think they do numbers quite well
string similarity with regex will be hell
@earnest phoenix you can try a weighted levenshtein algorithm, giving numbers a weight of zero/very low
@inner jewel have you used levenshtein? Is it any better than string similarity or are they just similar to each other
Use canvas
Use canvas
Not specific tutorials for welcome images but if you Google canvas tutorials you will find
@earnest phoenix what lang
So Im nearing the end of what I need to do for my bot. I'm soon to move it over to an ec2 server, but before I do that I was going to move it over to a github to be safe. Before I do that, I was wondering what all needs to be in the .gitignore to make it work with javascript. The reason is bc I have the token in another file (which I think I named config.json)
node_modules/
Alright, thanks!
tfw your / key fails
Is there a way to get guild names where the bot is in
like if the bot is in server A it gets the name of server A
nvm im dumb
Lol
@earnest phoenix yes but it gets all the server names
client.guilds.size
wait no
Client.guilds.map(g=>g.name);
i think
message.guild.name
i used client.guilds.array()
@marble elm
what does this mean? SyntaxError: import declarations may only appear at top level of a module
idk
message.guild.name Gets the current guilds name, like they stated
@marble elm client.guild.size gets the count
yes
and why do u need the name
π€
do imports even work in browser js
Every time I post my bots server count my bots memory goes up by 20mb, how can I fix this?
with module as type it outputs TypeError: Error resolving module specifier: speech-to-text
and whats that mean
why not webpack it into a bundle?
uhh, idk how?
i thought it'd work in node.js at first lol
yeah if you crosspile it then ofc you can use imports
but look at the code he showed
Well it can but with special args when running i think
it's directly in a script tag
ah in chrome it shows Uncaught TypeError: Failed to resolve module specifier "speech-to-text". Relative references must start with either "/", "./", or "../".
but anyway
node --experimental-modules my-app.mjs
using webpack/etc also allows your code to run in browsers that don't support the feature
that's how u use imports in node
there is requirejs
you don't
or use webpack like natan said
just webpack + babel it so you can have code full of requires, imports, etc
while still having compat for old as hell browsers
okay
time to go learn all this then
at HTMLButtonElement.onclick (index.html:46)```
how do you fix this tho
it is defined
how is this wrong
!eval client.members.get("274284493043531776").addRole('518601743324545037')
I haven't really messed with channel permissions in dotnet before. Is there a way for me to inherit all the current permissions for a role and change just one of them?
I tried changing one of them and it set all the other permissions back to the default value
var overrides = new OverwritePermissions(sendMessages: PermValue.Deny);
await channel.AddPermissionOverwriteAsync(role, eoverrides);
does upvote still post user id?
yes
not seeing it in the request payload
aaaaaaaaaa
how can I submit a captcha form and do something right after it is checked? like the discord bot invite captcha
I don't want to have a submit button
or something extra like that
captcha might have a done event
maybe not sending because im getting a 401 error
How can i make it to where it shows the latest voter and to see if the person has voted for the bot?
Is it possible to use an EJS variable in a js file referenced by <script>?
@obsidian badger what lib?
discord.js
if(command === "summon"){
if(message.member.voiceChannel){
if(message.guild.voiceConnection){
message.member.voiceChannel.join()
.then (message.reply("successfully joined"))
}
}
else{
message.reply("you need to be in a voice channel for me to be summoned!")
}
}
that doesnt work for some reason
^
uhhh........... im smart arent i?
what's a "tweenie"
basically twelvie for 13s
a word only "tweenies" use with their low levels of intelligence
jk
tf is a twelvie
youie cantie justie putie "ie" afterie everythingie
yesie youie canie
teenagers?
guys what is the best way to keep track of how much your app is beimg used
Analytics
analytics?
can you be more precise
what do you mean?
all i need is a simple way to keep usage of a bot
how can i achieve that
like how many messages does it send
if(command === "summon"){
if(message.member.voiceChannel){
if(!message.guild.voiceConnection){
message.member.voiceChannel.join()
.then (connection =>{
message.reply("successfully joined");
})
}
else{
message.reply("you need to be in a voice channel for me to be summoned!")
}
}
}
can someone make that work
ive been trying for like, hours
you have triple === in the first line
yes....
it shall be ==
it is now
=== is fine
wait in python you use === as ==?
javascript
javascript
still not working
wdym? i dont know these big words. i know them but dont
what doesnt work there is there an error
these are variables in discord.js or something idk
can yo show me the error
there is no error
im not familiar with js but ill try to help
it just doesnt join
ahh
i did install opus
what is that?
operating sys?
vsc
yee
i mean operarign systwm
wut? like w10???
omg yes
i think you need libsodium
more like libtardium
what do i need?
cuz ffmpeg keeps failing
i need ffmpeg.binaries apparently
but it keeps failing
(-_-)
π
there is a discord.js server you know
no i didnt know
and this is the error:
npm ERR! code E404
npm ERR! 404 Not Found: ffmpeg.binaries@latest
i know why! its ffmpeg-binaries not ffmpeg.binaries
https://discordapp.com/invite/bRCvFy9 is the link to the discord.js server
ty. once i get the vc join and music working, what else should i add?
Are we able to use 3.7 now?
3.7 of what
python
for
I don't see why not
it used to not work
the requirement says Python 3.4.2+
so I'm assuming anything beyond would work
looks like there's some compatibility issue with 3.7
They said you should use 3.4-3.6.
looks like it's the async reserve word issue
Oof
this is an old bot
So, I bet it uses an async branch, aye?
there
And can you do pip show discord.py in your command line
0.16.12 is async, Python 3.7+ not supported
Fishy told me it was
Try downgrading to 3.5 and try again
3.5.4?
That'll do
k deleting 3.7 files
@slender thistle the fuck, then I said it wasn't
it's literally within the same construct
I read the requirement, didn't see a maximum version
then I read some issues and mentioned the async keyword
DArk is for homos get Reed
hmm
const DBL = require('dblapi.js');
const express = require('express');
const http = require('http');
const app = express();
const server = http.createServer(app);
const dbl = new DBL(yourDBLTokenHere, { webhookAuth: 'password', webhookServer: server });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running with path ${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
app.get('/', (req, res) => {
// ...
});
server.listen(5000, () => {
console.log('Listening');
});```
is that js?
thanks @slender thistle It fixed
yeah its js
im new to JS
ive been coding for 6 months
obtained very little
try something unusual
ok i need some help. this wont work:
if(command == "avatar"){
let user = message.metions.users.first() || message.author;
let embed = new Discord.RichEmbed()
.setAuthor(`${user.username}`)
.setImage(user.displayAvatarURL)
message.channel.send(embed)
is it throwing promise errors
yes. sigh
and that error is...?
like every other error i get
i think an embed needs a body, can't remember
.send can take embed directly
.setDescription is the body im p sure
${user.user.username}
you don't need to construct it
maybe it needs a title?
what's the error first
(node:16320) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:16320) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
liek that?
perhaps do some then and catch around send
ok
my server info works. does this help?
if(command == "serverinfo") {
let embed = new Discord.RichEmbed()
.setTitle(`$(msg.guild) infomation`)
.addField("Id", message.guild.id)
.addField("Owner", message.guild.owner)
.addField("Owner Id", message.guild.ownerID)
.addField("Roles", message.guild.roles.size)
.addField("Region", message.guild.region)
.setThumbnail(message.guild.iconURL)
message.channel.send(embed)
}
From what I remember, an embed needs at least a description or fields
Your avatar example only has author and image
o ok
yeah I can't find the doc for that, you'll going to have to try it
this might help ['uncaughtException', 'unhandledRejection'].forEach(err => { process.on(err, async (reason) => { console.log(`${err}: ${reason}`); //process.exit(0); }) })
in .setTitle() you forgot to construct something
if(command == "avatar"){
let user = message.metions.users.first() || message.author;
let embed = new Discord.RichEmbed()
.setAuthor(`${user.username}`)
.setImage(user.displayAvatarURL)
message.channel.send(embed)```
this is the problem
I was thinking of linking my bot commands to a mysql table so I can link them to web easier
would that be efficient or should i just do it manually
reapplying my bot
it was offline last time i did it
what language
dblapi
and lib
js
i mean
for your bot
what lib is the bot written in
js
thats a language
lmfao
im having trouble with getting votes for the bot/
const DBL = require('dblapi.js');
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});```
what does vote return again?
look at the docs
thats what im doing but my internet is slow as fuck
replace vote.user with client.users.get(vote.user).username that should work
thanks but i think i sent the wrong code
if the user isnt cached that'll return undefined
use fetchUser on stable and users.fetch on master
dbl.hasVoted("95579865788456960").then(voted => {
if (voted) console.log("Tonkku has voted!!!")
});```
im confused on how i can turn this into a message
this shows the .hasVoted
im trying to do where it says !vote and it shows if the person voted or not
wait fetchUser can get the data even if there are no mutual servers??
i mean
since youre trying to run it as a command
just do the authors username?
idk?
wait yeah
i think
@mossy vine but how can it check if the person that did !vote coted.
voted*
cause that code shows that if that id has voted
replace Tonkku with ${message.author.username} ig
but its ran in a command, isnt it? so you already have the message author
so let userid = message.author.id
and js dbl.hasVoted(userid).then(voted => { if (voted) message.channel.send("You have voted") if (!voted) message.channel.send("You have not voted") });
or should i use an else
you could use else, or be a fancy es6 boi with
voted ? message.channel.send("You have voted") : message.channel.send("You have not voted")```
const voted = await dbl.hasVoted(msg.author.id);
msg.channel.send(voted ? 'You have voted!' : 'You haven\'t voted :(');
a ? : is basically a simplified else
i'm planning to make a web dashboard for my bot eventually, does anyone have good resources on how to get started with this kind of stuff
statement ? if true : if not true
glitch
imagine using glitch
honestly the free website i know so far is glitch, weebly, or wix
glitch
we're talking oauth2 and whatnot so weebly and wix wont cut it 

this is #development
Hey guys, so when i try and play a age restricted video the song auto skips and sends undefined in the console
here's the code^
@mossy vine the tertiary operator has been in javascript for years, so it's not an es6-only feature
@molten edge cuz ytdl cant download age-restricted, nothing you can do about that
π’
just add a warning
how?
Oh
@valid frigate Well you need to learn front end (html, css, js) and a back end of your choice
Preferably the same as your bot's
Plsgivemoney
Problem
Im trying to make a vote command
But it says 401 Unauthorized
As the error
//To check the dblapi
const dbltoken = process.env.DBL
const DBL = require('dblapi.js');
module.exports.run = async (bot, message, args, ops) => {
const dbl = new DBL(dbltoken, { webhookPort: 5000, webhookAuth: 'password' });
const voted = await dbl.hasVoted(message.author.id);
message.channel.send(voted ? 'You have voted!' : 'You haven\'t voted :(');
}
module.exports.help = {
name: "vote"
}```
Please ping me if u have an answer
@earnest phoenix Do you have access to port 5000?
dbltoken is invalid
did you require('dotenv')
otherwise process.env.DBL is probably not gonna return anything
based on the horrible indentation i assume this is glitch, which makes this stuff automatically work
I dont think itsa good idea to make a new websocket on each command run

not wrong
moved my database, redis and bot server to us east for better api response times
ping is now 63ms instead of 150
if (msg.content.search(/@covert dove/) >= 0 && msg.content.search(/@covert dove/) >= 0) { ...
any advice on how to improve this
what language is that
When it doubt, Use a regex 
if (msg.content.match(new RegExp(`^<@!?${client.user.id}>`))) {
msg.chanel.send('hi')
};
how did you use it tho
u sure it isnt working?
i dont get any response
lemme doublecheck my implementation
also is footer.text right or is it footer.name
I dont see any reason for it not to work
if (msg.content.match(new RegExp(`^<@!?${client.user.id}>`))) {
const parse = !args[1] ? undefined : args[1].toLowerCase();
if (!parse)
return await Mentioned.noticed(client, msg, config);
else if (parse === 'settings')
return await Mentioned.settings(client, msg, config);
else return;
};
I double checked it because I may have misspelled something but I dont thing there is

First, 500? Second, Its correct Third, what do i call it?
@hoary sphinx @sick cloud @tight heath
Alright ill try
Using glitch
- that wasnt a problem
I logged in a webhook instead of the actual dbl
π sorry
;-;
Can u help me test something?
@tight heath
Took me 3 hours on mobile to see if it works π
oof
What is RegExp
Regex expression
Whats that?
right, forgot about the first part
okay so i know this is kinda spoonfeeding but can someone link me to a simple guide on how to set up a github pages with an actual domain?
you can do that on the settings page as well
Alright Imma sleep heres my code.
i mean like, make it appear on an actual domain instead of blabla.github.io
but the settings creates CNAME file for you
@mossy vine thats how
oh ok
//To check the dblapi
const DBL = require('dblapi.js');
let Discord = require('discord.js')
module.exports.run = async (bot, message, args, ops) => {
let novote = new Discord.RichEmbed()
.setColor(0x36393f)
.setDescription("You have not voted! Please vote by clicking [here](https://discordbots.org/bot/508122813299818511/vote)")
.setFooter(`Recent Voter: undefined`)
let yesvote = new Discord.RichEmbed()
.setColor(0x36393f)
.setDescription("You have voted! Thank you for supporting Void! Heres a cookie.. :cookie:")
.setFooter(`Recent Voter: undefined`)
const dbltoken = process.env.DBL
const dbl = new DBL(dbltoken, bot);
const voted = await dbl.hasVoted(message.author.id);
message.channel.send(voted ? yesvote : novote);
}
module.exports.help = {
name: "vote"
}``` Ping me if u have the answer. My error is that even tho I voted it says i didnt. K gn
Shit 4:21 byee
why wont the leaderboard part of this go in order of xp?
ping me
why is this not working?
if(message.content.startsWith("!give")) {
if(!message.author.id === message.guild.owner) return message.reply("You're not the boss of me, you can't do that!");
var args = message.content.substring(prefix.length).split(" ");
const user = message.mentions.users.first() || client.users.get(args[0]);
if(!user) return message.reply("You must mention someone or give their ID!");
const pointsToAdd = parseInt(args[1]);
if(!pointsToAdd) return message.reply("You didn't tell me how many points to give...");
const key = `${message.guild.id}-${user.id}`;
client.points.ensure(key, {
user: message.author.id,
guild: message.guild.id,
points: 0,
level: 1,
lastSeen: new Date()
});
client.points.math(key, "+", pointsToAdd, "xp");
message.channel.send(`${user.tag} has received ${pointsToAdd} points and now stands at ${client.points.get(key, "xp")} xp.`);
}
It says i did not say how much points to give even though i did
how about you add some debug lines
It says fetched is not defined, where am I going wrong?
const Discord = require("discord.js");
const ytdl = require("ytdl-core");
const opusscript = require("opusscript");
exports.run = async (client, message, args, ops) => {
if(!message.content.startsWith("/")) return;
if (!fetched) return message.channel.send("**I am not playing anything!**");
if (message.member.voiceChannel !== message.guild.me.voiceChannel) return message.channel.send('**Please be in the same voice channel as Apollo!**');
if (isNaN(args[0]) || args[0] > 200 || args[0] < 0) return message.channel.send('**Please insert a number less than 200!**');
fetched.dispatcher.setVolume(args[0]/100);
message.channel.send(`**Succesfully set the volume of ${fetched.queue[0].songTitle} to ${args[0]}**`);
}```
How do I define it?
you set it equal to something?
How are you making this without knowing what defining is
What?
maybe your reading the wrong file
i read the correct one
im not sure if canvas can read fies
node-canvas does have a loadImage method
screenshot how you're putting in the server IDs
hey
bot.on('guildMemberAdd', member => {
if (member.guild.id !== serverStats.guildID) return;
let ifbot = member.guild.members.filter(m => !m.user.bot).size
bot.channels.get(serverStats.TotalMemberID).setName(`Total Members: ${member.guild.memberCount}`);
bot.channels.get(serverStats.memberCountID).setName(`Humans: ${ifbot}`);
member.send("Welcome to Bob!!! \n There sure are many discord servers out there, but Bob is a special one. \n Welcome to our family and community! We've noticed that people join then they just leave, but if you must leave, here is an invite back! https://discord.gg/XGNeFYd \n Might as well tell you the details of this server! \n Our server is based on art, anime, gaming, fun, and much much more! \n First, please check out [#459671870598283275](/guild/264445053596991498/channel/459671870598283275/) to make sure you don't do anything bad! ")
});
``` thisworks eh?
Try it?
yup ok
ads
A d S
a
d
s
"sda".split("").reverse().join("");
"cipot-ffo# ot og".split("").reverse().join("");
"sda".split("").sort((a,b) => a.localeCompare(b)).join("")
Hello
I was looking to maybe in the deleted messages log (a channel where my bot shows all the deleted messages) to also include who deleted them
audit logs
I am pretty sure you need to access the Audit logs yeah
Cant find the documentation on how to do that in Python though
Could anyone help me with finding that info?
How do I get the total amount of commands the bot uses? - Discord.js
You find the size of the array/object/collection/etc where you stored them
@empty owl could you remove the invite code in your message, just so we dont have the invite embed :p
Sure
How do we find the highest role of a user? is it member.roles.highest in d.js
read the docs
RTFM
i see lot of bot have level up thing. If someone free can someone teach me how to do the level up in mongodb cuz now i only have xp
if you read the docs you would see this
yeah i did, but it is returning undefined
i never heard a youtube call york
i said it returned undefined and did not say it's not there
code rn?
hello. I"'m a beginner in the bot dev. Someone can say me how to know if a msg is embed ?
programming language?
Js
return boolean ?
you can use it as a boolean
if there's no embed it returns null
or undefined
which evaluates to false
that pfp tho...
if there is an embed, it returns an object
my eyes
which evaluates to true
@earnest phoenix That's probably not the best pfp
Ok ty for your help.
what if someone was though?
ok i'll try later
What would you do then
see you later
ok
understandable have a nice day
try {
message.channel.send(createEmbed(message.author))
} catch (err) {
message.channel.send('Something went wrong. Make sure I have the `Embed Links` Permission!')
}```
why does this not catch if there is no embed links permission
hello anyone know where can i host a discord bot for free ?
glitch
ok thx
google gce, but you need a credit card to create an account
@west raptor if you won't see my pp animation, juste don't pass your mouse on it
or
block me (no problem i understand)
Guys?
Is this the SRC of DBL?
An API wrapper for https://discordbots.org/api/docs that works in Java - DiscordBotList/DBL-Java-Library
A Java wrapper for the discordbots.org API```
in html, lol
So if I copy it and upload it on my Webserver will it be the DBL?
what the fuck
My own Site
its a java wrapper for the dbl api
not public
of course not, its not open source
Why are there no tutorials on how to make a own discord bot list on yt
smfh
because its not a simple thing
oh yea i forgot it has to be an open source to be a src
There are just how to program Discord bot tutorials
you need to be a full stack developer to make a bot list
or do nothing and hire volunteers to do it for you
yeet
a discord bot only involves one language in one environment
a website involves several languages and systems
hypothetically it has like about 5 most used languages for a website
Sry that I wrote oof
just find some other open source listing site and add all that oauth crap to make it for discord bots
ez pz
Which site
There are no sites with open source @earnest phoenix
you can look to find a js version of it
"there are no sites with open source"
github pages
https://github.com/AlexFlipnote/alexflipnote.github.io
question how do i implement css into Dbl like make the profile of the bot move?
move in what way?
@mossy vine I mean bot list site
^
css is mainly made to style the website. if your asking about like effects i suggest you look up w3schools for website tutorials
30 already?
ofc we do
finna make a bot list on paper :bigbrain:
@earnest phoenix css animations
where would i put the css?
look up w3schools for css and look for animations
in your html description
waiting for another botlist to dethrone dbl
ooo
how to get title of an embed msg ? (js)
https://www.w3schools.com/css/default.asp look at this doc @earnest phoenix
message.embeds
i havent found the method for get title in embeds
.setTitle
message.embeds returns an array of embeds
mmm mm mmm
lol
Hey, how you made that ur bot is responding with text like that:
TEST2
TEST3
TEST4```
Also what about this little color square at the left side.
message.channel.send(`TEST2\nTEST3\nTEST4`);
love
i saw it
shame on you
π
π
i realized that if you did ` it would be came an object string(i think thats what its called, i know it allows you to enter a object in a string, lol)
template literal
template literal, lol, thats already a confusing name, are they trying to be confusing, lol
Btw, what about this color thing? How to create it?
well, its a literal code, like an array literal, string literal, object literal
.setColor
its called template because it allows templating/presetting/building
or whatever a template means
xD
oh if you put it in that way, it makes more senses, lol
Is it possible to make bot put custom icons from server? I can't do this.
yes
are asking like adding a emoji to the server, or using an emoji from the server?
Using emoji.
if you put a \ in front of the emoji you want in discord you get a useable character like this \πΌ
idk if it works on custom, i don't have nitro you can try it if you have nitro
But It should work with custom emojis at my own server?
try it
dud you put a \ in front of the emoji?
Ye, it's still don't works.
@high raft its in the docs https://discord.js.org/#/docs/main/stable/class/Emoji
Ok, I will check it.
my message.embeds is empty, however i've create an embed
what is the error?
no error, just
client.on('message', message => {
if(message.embed !== 'null'){
message.reply(message.embeds.find(function(element) {
return element.title}));
}
if (message.content === 'how to embed') {
const embed = new RichEmbed()
.setTitle('A slick little embed')
.setColor(0xFF0000)
.addField('hey', 'hello', true)
.addField('111','222', false)
message.channel.send(embed);
}```
he retun nothing
its const embed.content = new Discord.RichEmbed()
wait no content
but i want just get title of embed
i saw the message.content then put embed.content TwT
=)
but you have to have it = new Discord.RichEmbed()
In fact, i want check if title === 'theTitle', then do it
hi
hows the trouble
i want do something like this:
if(message.embed.title === 'thetile'){
DO...
}
But the embed array is empty
however before i've creted an embed
its because it needs to equal a new Discord.RichEmbed not new RichEmbed.
i don't care about this part, focus on:
client.on('message', message => {
if(message.embed !== 'null'){
message.reply(message.embeds.find(function(element) {
return element.title}));
}
}```
ask tim, he knows more than me on that
he's inactive mode
ok
what library
discord.js @earnest phoenix
k
it could be something like this
client.on('message', message => {
if(message.embeds !== null) {
message.reply(message.embeds[0].title)
}
})
title not definied
strange
pls show full error
C:\Users\Elève\Desktop\Bot\index.js:13
message.reply(message.reply(message.embeds[0].title))
^
TypeError: Cannot read property 'title' of undefined
at Client.client.on.message (C:\Users\Elève\Desktop\Bot\index.js:13:53)
at Client.emit (events.js:182:13)
at MessageCreateHandler.handle (C:\Users\Elève\Desktop\Bot\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
at WebSocketPacketManager.handle (C:\Users\Elève\Desktop\Bot\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65)
at WebSocketConnection.onPacket (C:\Users\Elève\Desktop\Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (C:\Users\Elève\Desktop\Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
at WebSocket.onMessage (C:\Users\Elève\Desktop\Bot\node_modules\ws\lib\event-target.js:120:16)
at WebSocket.emit (events.js:182:13)
at Receiver._receiver.onmessage (C:\Users\Elève\Desktop\Bot\node_modules\ws\lib\websocket.js:137:47)
at Receiver.dataMessage (C:\Users\Elève\Desktop\Bot\node_modules\ws\lib\receiver.js:409:14)```
oh
theres no embeds
wait
do if(message.embeds)
oh
i dont think it ever returns null
it returns undefined
oh
but about title ?
if (message.content === 'how to embed') {
const embed = new RichEmbed()
// Set the title of the field
.setTitle('A slick little embed')
// Set the color of the embed
.setColor(0xFF0000)
// Set the main content of the embed
.addField('hey', 'hello', true)
.addField('111','222', false)
// Send the embed to the same channel as the message
message.channel.send(embed);
}
});
i creat this, but always nothing
did you define RichEmbed?
if you dont define RichEmbed separately, you have to use it with Discord.RichEmbed
afaik
const { Client, RichEmbed } = require('discord.js');
const { Client, RichEmbed } = require('discord.js');
const client = new Client();
client.on('ready', () => {
console.log('I am ready!');
});
client.on('message', message => {
if(!message.embed){
message.reply(message.reply(message.embeds[0].title))
}
if (message.content === 'how to embed') {
const embed = new Client.RichEmbed()
// Set the title of the field
.setTitle('A slick little embed')
// Set the color of the embed
.setColor(0xFF0000)
// Set the main content of the embed
.addField('hey', 'hello', true)
.addField('111','222', false)
// Send the embed to the same channel as the message
message.channel.send(embed);
}
});```
but i got eroor with Client.Richembed
the same*
message.embeds
and remove the exclamtion point
you defined RichEmbed at the beginning already, you dont need to use Client.RichEmbed
just RichEmbed ?
if(!message.member.permissions.has("MANAGE_SERVER") || message.author.id !== process.env.OWNERID) return message.channel.send("Not enough perms")
``` Says invalid string... tried almost everything
Tim, he keep going to say me that the length is 0
wut
no
if (message.content === 'how to embed') {
const embed = new Client.RichEmbed()
// Set the title of the field
.setTitle('A slick little embed')
// Set the color of the embed
.setColor(0xFF0000)
// Set the main content of the embed
.addField('hey', 'hello', true)
.addField('111','222', false)
// Send the embed to the same channel as the message
message.channel.send(embed);
}
});```
i wrote how to embed
the created it
message.embed checks if the message the user sends is an embed
it does
so...
so basically
how to checks if the message the bot sends is an embed
you wrote "how to embed"
and your bot send an embed
and it stays embed length is 0?
yh
on the embed message?
yh u creted this method
if (message.content === 'ah') { message.reply(message.embeds.length)}
before 0 after 0
Between "how to embed"
but the message content is not ah
that code will only execute on messages that are ah
and the embed doesnt have ah
you're checking the embeds length of the current message, not the one before
the current message is just ah
ohh
wait i try something
doesn't work
maybe i can try with id message or something
//To check the dblapi
const DBL = require('dblapi.js');
let Discord = require('discord.js')
module.exports.run = async (bot, message, args, ops) => {
let novote = new Discord.RichEmbed()
.setColor(0x36393f)
.setDescription("You have not voted! Please vote by clicking [here](https://discordbots.org/bot/508122813299818511/vote)")
.setFooter(`Recent Voter: undefined`)
let yesvote = new Discord.RichEmbed()
.setColor(0x36393f)
.setDescription("You have voted! Thank you for supporting Void! Heres a cookie.. :cookie:")
.setFooter(`Recent Voter: undefined`)
const dbltoken = process.env.DBL
const dbl = new DBL(dbltoken, bot);
const voted = await dbl.hasVoted(message.author.id);
message.channel.send(voted ? yesvote : novote);
}
module.exports.help = {
name: "vote"
}``` my vote command aint working π
any help to fi
i hate to be picky but you could change novote and yesvote to const 
why lol
yo guys anyone in here using MySQL? I just reinstalled MySQL on my computer to further develop my own bot in a safe environment (not my Raspberry Pi) and whenever I try to query something it gives me this error:
https://gyazo.com/7341376bca8689fd0fde28f81d5e4174
it's MySQL 8.0
did the commands change or something?
look at the error
I am
I was for quite some time
and I see nothing wrong with it. that's why I am asking
has anything changed?
obviously
I mean my bot is working fine on Raspberry Pi and it has plenty of those queries...
I've also checked the documentation on MySQL 8.0 and the query I've issued seems valid
well it is
oh nope that was just a little mistake of mine
but
any idea?
how to edit a line? you use the left and right arrow keys or home and end keys
then backspace/del
@knotty steeple in bash?
js
use the process out and in things
const write = (str = '') => {
process.stdout.cursorTo(0);
process.stdout.clearLine(1);
process.stdout.write(str);
}``` a function like this works
it clears the current like and writes there
pratically editing
oh ok
could anyone inform as how to be able to give a person a role as soon as they join the server?
for starters maybe first give information what programming language youβre using and what package
I canβt exactly guess that, yβknow
(also, sarcasm just in case)
discord.js or discord.js-commando?
discord.js i believe
nah itβs all good, you need to start somewhere
yup
assuming your Discord Client is called client
it is indeed
In the documentation, there is a whole list of Events that can be used with client.on β> https://discord.js.org/#/docs/main/stable/class/Client?scrollTo=channelCreate
To execute code when someone joins the server, the guildMemberAdd Event should be used
Unless the bot is server specific
or it creates the role when joining the guild
but sill, will cause errors, yeah
and that
"Prune members becomes useless"
prune members is always useless
true
an export* 
I'm using a separate script to preset embeds the bot will use.
oml
exports.embeds = {
aEmbed: {
title: '',
description: '',
fields: [{}, {}, {}]
},
logEmbed: (content, author) = {
}
}
you cant do that
Im hoping that with logEmbed, with this its possible to pass those params to the object after
hm
logEmbed: function(myargs) {}
oh it has to be a function
alright
a function can return it ofc
thanks for the tip
np
can bot DM "general" channel in all servers it is in?
i can actually
well dont
also i dont think u get what dming is
you dont dm a channel
you dm a person
you get the point



