#development
1 messages ยท Page 575 of 1
@amber fractal with images padding doesn't work
Because the content here is not centered
I set the padding to 0px 0px and it actually worked tho
I just need to re make the image
Okay I guess now
not*
resizing it did nothing
resized it with photoshop and just in the image
I literally hate html and css
I thought it'd be easier for me
but nothing is making any sense
๐
Framework is always an option if you don't want to make your own
Even if it's just an utility framework
I've done way too much to switch
I've been doing this since I got up this morning
I realize that doesnt sound like much
But for me using html
it's way too much
takes time to get use to I suppose
I liteally made the picture the exact size of the other elements and it's still too small
and if I remove my css its too big
padding: 0px 0px;
}``` but this is all the css is
Guess my nav bar isnt having a logo lmao
It's actually pissing me off now
Those extra like 15 pixels
Now it works but the image is tiny and it wont let me resize it
How would we make a bot send a message in another channel when a command is used for discord.py? Like with a suggestion feature
If you have an answer, a ping with it would be appreciated as I have to sleep soon so I might only see it when I wake up
If its anything like d.js, it should be like this: Get the channel id, unless you have the channel object somehow, then get the channel object, then send
Wait wrong link
I think, I'm not a py user tho
@compact mauve
Oh thanks
how can i do a input thingy
if someone says "100"
and the bots generated number is 100
then the user wins
how can i do that?
i did generated
now i need to do input
Was stuff like this redacted in discord.js because this seems to have broken. js let embed = new Discord.RichEmbed() .setColor(random.color) .addField("Field", value.value) .setFooter(`Made by some kool kid`)
UnhandledPromiseRejectionWarning: TypeError: Discord.RichEmbed is not a constructor
did u const it?
yes
correctly?
show full script
havn't changed it
if its too big do in haste bin
let messageAuthorLvlEmbed = new Discord.RichEmbed()
.setAuthor(message.author.username, message.author.displayAvatarURL)
.setColor(setting.embedColor)
.addField("Level", curlvl, true)
.addField("Xp", curxp, true)
.addField("Xp to next level up", diffrence, false)
.setFooter(`User requested is: DEAD BEAT ${user}`);
message.channel.send(messageAuthorLvlEmbed);```
i must be stupid
What version are you using
Master or stable?
i just did npm i discord.js
this is my embed
let cEmbed = new Discord.RichEmbed()
.setColor('#5780cd')
.setAuthor(`Cute CATS!`, message.guild.iconURL)
.setImage(body.file)
.setTimestamp()
.setFooter(`Requested by: ${message.author.username}`, message.author.displayAvatarURL )
message.channel.send({embed: cEmbed})```
do u have a command handler?
yes
yes
Try asking on the djs server
The djs server would know more
i want to know how to a args thingy xD
really?
so if someone says 1 and the bots generated number is 1 then the user wins
im making a guess bot
const args = message.content.slice(prefix.find(p => message.content.startsWith(p)).length).trim().split(/ +/g);
const cmd = args.shift().toLowerCase();
//console.log(cmd);
//console.log(args);
let cmds = client.commands.get(cmd) || client.commands.get(client.aliases.get(cmd));
if (cmds) {
cmds.run(client, message, args, setting, prefix); //checks if command is real, runs said command if so
}```
nice copy and paste found online
?
that is a cmd handler
this is mine
let prefix = botconfig.prefix;
let messageArray = message.content.split(" ")
let cmd = messageArray[0].toLowerCase();
let args = messageArray.slice(1);```
?
it works
has some limits
let guessNum;
let max = args;
if(args == "")
{
guessNum = Math.floor(Math.random() * 1000) + 1;
message.channel.send(`${emoji('guess')} **| Generating a new random number!**\nGuess the number between 1 and 1000!`)
console.log(guessNum)
}
else
{
guessNum = Math.floor(Math.random() * args) + 1;
if(isNaN(guessNum))
{
message.channel.send(`${message.author}, ${args} is not a valid number`).then(msg => msg.delete(2000));
}
else
{
message.channel.send(`${emoji('guess')} **| Generating a new random number!**\nGuess the number between 1 and ${max}`)
}
}
if(args == guessNum)
{
message.channel.send(`${emoji('hypertada')}**| Hooray! ${author} has guessed the number ${guessNum}`)
}
function emoji(name) {return bot.emojis.find(emoji => emoji.name === name)
}
}```
see
kk
wdym
PREFIX()COMMAND arg1 arg2 arg3 arg4
?
yes
let prefix = [setting.prefix, `<@${client.user.id}> `, `<!@${client.user.id}> `, `<@${client.user.id}>`, `<!@${client.user.id}>`];
if (!message.content.startsWith(prefix.find(p => message.content.startsWith(p)))) return;
if (message.author.bot) return;```
simple
soooo much fun
idk why im helping
thats kool
then remove the prefix.find(p => message.content.startsWith(p))
ok
???
let guessNum;
let max = args;
if(args == "")
{
guessNum = Math.floor(Math.random() * 1000) + 1;
message.channel.send(`${emoji('guess')} **| Generating a new random number!**\nGuess the number between 1 and 1000!`)
console.log(guessNum)
}
else
{
guessNum = Math.floor(Math.random() * args) + 1;
if(isNaN(guessNum))
{
message.channel.send(`${message.author}, ${args} is not a valid number`).then(msg => msg.delete(2000));
}```
its doing the else
when i do -create
you would replace args == "" with !args[0]
ok
so on so forth
๐คฆ
?
if(!args[0] || args[0] == "help")
would be if
. help
f
me
or
. help help
......
so many dms
how would i make something like this for music
|------โซ-------------------------------|
i use lavalink
Ok, how would one make a bot DM a specified user in discord.py? More specifically, how would I use a player's ID to create a DM? I already checked https://discordpy.readthedocs.io/en/rewrite/api.html#dmchannel , but it isn't much help
Ping with answer kthnx
You just send the message targeting the user object, it's that simple
How I set thumbnail in richembed in eris?
@earnest phoenix add thumbnail: { url: 'url here' } to the embed object
ie.
channel.createMessage({
embed: {
thumbnail: { url: 'some.site/image.png' },
title: 'Image'
}
});
Hello , I recently added Music feature in my bot but whenever I use the +play command the bot replying well , all things we select what song to play But the bot joins the voice channel for 3 seconds then the bot left it automatically
kindly ping me if you can help me out
Ok I will do it
my bot gives error to others
my bot gives error to others
hello ๐ I currently have a bot online and deployed, but i want to carry on developing on it whilst it is deployed. I can do this, but if i run a local version of my bot, ill get the responses from my deployed bot and my local version of the bot(which is inconvenient). Is the resolution to this to create a 'dev' version of my bot on discord? or do you guys go about it a different way
help vampire?
@earnest phoenix um you can make 2 instances and run one as a "test" environment and have on "master" environment
oh. make another bot profile

What is the eval command to make a bot join a voice channel ( Discord.js?)
I forget it
VoiceChannel.join()

yeah
my bot gives error to others (does not give myself error) HELP!
Example?
@earnest phoenix we cannot help you without an example
My friends give me an error, but I don't.
They encounter 404 Found Error when they enter the site of my work @flint trellis

@earnest phoenix
If you get an error while viewing a bot on discordbots.org:
404: the bot wasn't submitted/was deleted/doesnt exist
403: the bot has been submitted but still needs to be approved by moderators (only the owner can view the bot during that time)
@quick matrix did you define voicechannel
@sick cloud no
thats ur issue
voicechannel.join
VoiceChannel.join()
Just type this?
nope
get the voice channel
the voicechannel itself
K
How long will my website be approved?
website approved? wot
if(message.content == gussNum){message.channel.send(`${emoji('hypertada')}**| Hooray! ${author} has guessed the number ${guessNum}`)}
it wont work
What error are you getting?
no error
the command wont work
well not command
ill show u the whole command
its inside module.exports.run thingy
let guessNum;
let max = args;
if(args == "")
{
guessNum = Math.floor(Math.random() * 1000) + 1;
message.channel.send(`${emoji('guess')} **| Generating a new random number!**\nGuess the number between 1 and 1000!`)
console.log(guessNum)
}
else
{
guessNum = Math.floor(Math.random() * args) + 1;
if(isNaN(guessNum))
{
message.channel.send(`${message.author}, ${args} is not a valid number`).then(msg => msg.delete(2000));
}
else
{
message.channel.send(`${emoji('guess')} **| Generating a new random number!**\nGuess the number between 1 and ${max}`)
}
}
if(message.content == gussNum){message.channel.send(`${emoji('hypertada')}**| Hooray! ${author} has guessed the number ${guessNum}`)}
function emoji(name) {return bot.emojis.find(emoji => emoji.name === name)
}```
see
idk what i did what
it seems fine
message.content == gussNum
probably should be
message.content === guessNum
around 5th line from the bottom
real question is how is he not getting any errors
i just got a error now
nvm
spelling error
it wont work
if i type the generated number
nothing happens
Of course it's not working, guessNum returns a false value
It's defined but it doesn't do anything
then what do i do?
let max = args;
if (args == "") {
guessNum = Math.floor(Math.random() * 1000) + 1;
message.channel.send(`${emoji('guess')} **| Generating a new random number!**\nGuess the number between 1 and 1000!`)
console.log(guessNum)
}
else {
guessNum = Math.floor(Math.random() * args) + 1;
if (isNaN(guessNum)) {
message.channel.send(`${message.author}, ${args} is not a valid number`).then(msg => msg.delete(2000));
}
else {
message.channel.send(`${emoji('guess')} **| Generating a new random number!**\nGuess the number between 1 and ${max}`)
}
}
if (message.content == "gussNum") { message.channel.send(`${emoji('hypertada')}**| Hooray! ${author} has guessed the number ${guessNum}`) }
function emoji(name) {
return bot.emojis.find(emoji => emoji.name === name)
}```
Cleaned up your code and try that
ok
Does the code even get run at all?
yes
when i generate the number
with -create
it says
generated number out of 1 - 100- guess it
if u say the number
nothing happens
the generated number is in my console btw
if (args == "") {
guessNum = Math.floor(Math.random() * 1000) + 1;
message.channel.send(`${emoji('guess')} **| Generating a new random number!**\nGuess the number between 1 and 1000!`)
console.log(guessNum)
}```
So this gets run
if (args == "") {
guessNum = Math.floor(Math.random() * 1000) + 1;
message.channel.send(`${emoji('guess')} **| Generating a new random number!**\nGuess the number between 1 and 1000!`)
console.log(guessNum)
}
else {
guessNum = Math.floor(Math.random() * args) + 1;
if (isNaN(guessNum)) {
message.channel.send(`${message.author}, ${args} is not a valid number`).then(msg => msg.delete(2000));
}
else {
message.channel.send(`${emoji('guess')} **| Generating a new random number!**\nGuess the number between 1 and ${max}`)
}
}```
that all runs
anything below it doesnt
expect the emoji function cause that works
args is an string
Lemme just be dumb here
ok
the first thing under module.exports.run?
Like you had it before
So you want to generate a number and then get them to guess that number? correct?
Are you using stable or master?
wdym
So you're using the library discord.js?
indeed
So what you actually need to do is fetch the messages in the channel
What you're doing won't work
ok
I suggest you take a look at that
So it gets triggered by !vote and it awaits the given time for a message
?
// Await !vote messages
const filter = m => m.content.startsWith('!vote');
// Errors: ['time'] treats ending because of the time limit as an error
channel.awaitMessages(filter, { max: 4, time: 60000, errors: ['time'] })
.then(collected => console.log(collected.size))
.catch(collected => console.log(`After a minute, only ${collected.size} out of 4 voted.`));```
This is the code the docs provde
So what it does is when it gets triggered it waits for a max of 4 messages in the timespan of 6000
message.channel
I would believe so
ok
So what I would do is
i set the time as - 10000000000000000000000000000000000
to make it last a long time
if (message.content.startsWith("create") {
// Await !vote messages
const filter = m => m.content.startsWith('!vote');
// Errors: ['time'] treats ending because of the time limit as an error
message.channel.awaitMessages(filter, { max: 4, time: 60000, errors: ['time'] })
.then(collected => console.log(collected.size))
.catch(collected => console.log(`After a minute, only ${collected.size} out of 4 voted.`));
}```
what does vote have to do?
You can change that
define the vote
So thats the response you're looking for
?
like this?
message.channel.awaitMessages(filter, { max: 10000000000, time: 10000000000000000000000000000000000, errors: ['time'] })
if (message.content.startsWith("gussNum")) { message.channel.send(`${emoji('hypertada')}**| Hooray! ${author} has guessed the number **${guessNum}**`) }
or did i do it wrong?
One sec
i am learning js pretty well
yesterday i helped someone
ik like 10-15% rn
gotta keep learning
Let me install stable
ok
So what you do is set the filter to what you want the answer to be
const filter = m => m.content.startsWith(guessNum);```
yeah
like this?
module.exports.run = async (bot, message, args) => {
const filter = m => m.content.startsWith(guessNum);```
did i do it wrong?
One sec
module.exports.run = async (bot, message, args) => {
if (message.content.startsWith('start')) {
const filter = m => m.content.startsWith(guessNum)
message.channel.awaitMessages(filter, { max: 1, time: 1000, errors: ['time'] })
.then(collected => {
message.channel.send(`${collected.first().author.tag} Got it right`)
})
.catch(collected => console.log(`After a minute, only ${collected.size} out of 4 voted.`));
}
}```
So when they say start it will trigger it
So create the random number below start
ok
like this?
module.exports.run = async (bot, message, args) => {
let guessNum = false;
let max = args;
if (args == "") {
guessNum = Math.floor(Math.random() * 1000) + 1;
message.channel.send(`${emoji('guess')} **| Generating a new random number!**\nGuess the number between 1 and 1000!`)
console.log(guessNum)
}
else {
guessNum = Math.floor(Math.random() * args) + 1;
if (isNaN(guessNum)) {
message.channel.send(`${message.author}, ${args} is not a valid number`).then(msg => msg.delete(2000));
}
else {
message.channel.send(`${emoji('guess')} **| Generating a new random number!**\nGuess the number between 1 and ${max}`)
}
}
if (message.content.startsWith("gussNum")) { message.channel.send(`${emoji('hypertada')}**| Hooray! ${author} has guessed the number **${guessNum}**`) }
if (message.content.startsWith('create')) {
const filter = m => m.content.startsWith(guessNum)
message.channel.awaitMessages(filter, { max: 10000000000, time: 10000000000000000000000000000000000, errors: ['time'] })
.then(collected => {
message.channel.send(`${emoji('hypertada')}**| Hooray! ${author} has guessed the number **${guessNum}**`)
})
.catch(collected => console.log(`After a minute, only ${collected.size} out of 4 voted.`));
}
function emoji(name) {
return bot.emojis.find(emoji => emoji.name === name)
}
}```
is that right?
if (message.content.startsWith('create')) {
let guessNum = false;
guessNum = Math.floor(Math.random() * 1000) + 1;
message.channel.send(`${emoji('guess')} **| Generating a new random number!**\nGuess the number between 1 and 1000!`)
console.log(guessNum)
if (message.content.startsWith("gussNum")) { message.channel.send(`${emoji('hypertada')}**| Hooray! ${author} has guessed the number **${guessNum}**`) }
const filter = m => m.content.startsWith(guessNum)
message.channel.awaitMessages(filter, { max: 10000000000, time: 10000000000000000000000000000000000, errors: ['time'] })
.then(collected => {
message.channel.send(`${emoji('hypertada')}**| Hooray! ${author} has guessed the number **${guessNum}**`)
})
.catch(collected => console.log(`After a minute, only ${collected.size} out of 4 voted.`));
}
function emoji(name) {
return bot.emojis.find(emoji => emoji.name === name)
}
}```
ohhh
if (message.content.startsWith('create')) {
let guessNum = false;
let max = args;
if (args == "") {
guessNum = Math.floor(Math.random() * 1000) + 1;
message.channel.send(`${emoji('guess')} **| Generating a new random number!**\nGuess the number between 1 and 1000!`)
console.log(guessNum)
}
else {
guessNum = Math.floor(Math.random() * args) + 1;
if (isNaN(guessNum)) {
message.channel.send(`${message.author}, ${args} is not a valid number`).then(msg => msg.delete(2000));
}
else {
message.channel.send(`${emoji('guess')} **| Generating a new random number!**\nGuess the number between 1 and ${max}`)
}
}
const filter = m => m.content.startsWith(guessNum)
message.channel.awaitMessages(filter, { max: 10000000000, time: 10000000000000000000000000000000000, errors: ['time'] })
.then(collected => {
message.channel.send(`${emoji('hypertada')}**| Hooray! ${author} has guessed the number **${guessNum}**`)
})
.catch(collected => console.log(`After a minute, only ${collected.size} out of 4 voted.`));
}
function emoji(name) {
return bot.emojis.find(emoji => emoji.name === name)
}
}```
is that right?
yeah
One sec
you didnt add this
}
else {
guessNum = Math.floor(Math.random() * args) + 1;
if (isNaN(guessNum)) {
message.channel.send(`${message.author}, ${args} is not a valid number`).then(msg => msg.delete(2000));
}
else {
message.channel.send(`${emoji('guess')} **| Generating a new random number!**\nGuess the number between 1 and ${max}`)
}
}```
if (message.content.startsWith('create')) {
let guessNum = false;
let max = args;
if (!args) {
guessNum = Math.floor(Math.random() * 1000) + 1;
message.channel.send(`${emoji('guess')} **| Generating a new random number!**\nGuess the number between 1 and 1000!`)
console.log(guessNum)
}
else {
guessNum = Math.floor(Math.random() * args) + 1;
if (isNaN(guessNum)) {
message.channel.send(`${message.author}, ${args} is not a valid number`).then(msg => msg.delete(2000));
}
else {
message.channel.send(`${emoji('guess')} **| Generating a new random number!**\nGuess the number between 1 and ${max}`)
}
}
const filter = m => m.content.startsWith(guessNum)
message.channel.awaitMessages(filter, { max: 10000000000, time: 10000000000000000000000000000000000, errors: ['time'] })
.then(collected => {
message.channel.send(`${emoji('hypertada')}**| Hooray! ${author} has guessed the number **${guessNum}**`)
})
.catch(collected => console.log(`After a minute, only ${collected.size} out of 4 voted.`));
}
function emoji(name) {
return bot.emojis.find(emoji => emoji.name === name)
}
}
You can add prefix if you want
under the command is
module.exports.config = {
name: "create",
description: "create a wonderful guessing game for you server!",
usage: `${prefix}create`,
accessableby: "Moderators",
aliases: ["guessmake", "makeguess", "createguess", "funguess"]
}```
Oh then no need
above command
const Discord = require("discord.js")
const botconfig = require("../botconfig.json");
const prefix = botconfig.prefix
module.exports.run = async (bot, message, args) => {```
Ah i see hold on
So it already gets run on that
Okay so remove
if (message.content.startsWith('create')) {}
From your code
done that
Send all your code rn
let guessNum = false;
let max = args;
if (!args) {
guessNum = Math.floor(Math.random() * 1000) + 1;
message.channel.send(`${emoji('guess')} **| Generating a new random number!**\nGuess the number between 1 and 1000!`)
console.log(guessNum)
}
else {
guessNum = Math.floor(Math.random() * args) + 1;
if (isNaN(guessNum)) {
message.channel.send(`${message.author}, ${args} is not a valid number`).then(msg => msg.delete(2000));
}
else {
message.channel.send(`${emoji('guess')} **| Generating a new random number!**\nGuess the number between 1 and ${max}`)
}
}
const filter = m => m.content.startsWith(guessNum)
message.channel.awaitMessages(filter, { max: 10000000000, time: 10000000000000000000000000000000000, errors: ['time'] })
.then(collected => {
message.channel.send(`${emoji('hypertada')}**| Hooray! ${author} has guessed the number **${guessNum}**`)
})
.catch(collected => console.log(`After a minute, only ${collected.size} out of 4 voted.`));
function emoji(name) {
return bot.emojis.find(emoji => emoji.name === name)
}
}```
Try the code
@keen drift can you give me an invite link for the reaction role bot?
for some reason
if its default so no args it doesnt say 1 out of 1000
just says 1 out of
how do i fix?
Anyone help me!?
do i get rid of the first part?
let guessNum = false;
guessNum = Math.floor(Math.random() * 1000) + 1;
message.channel.send(`${emoji('guess')} **| Generating a new random number!**\nGuess the number between 1 and 1000!`)
console.log(guessNum)
const filter = m => m.content.startsWith(guessNum)
message.channel.awaitMessages(filter, { max: 10000000000, time: 10000000000000000000000000000000000, errors: ['time'] })
.then(collected => {
message.channel.send(`${emoji('hypertada')}**| Hooray! ${author} has guessed the number **${guessNum}**`)
})
.catch(collected => console.log(`After a minute, only ${collected.size} out of 4 voted.`));
function emoji(name) {
return bot.emojis.find(emoji => emoji.name === name)
}
Use that
First change the time to something smaller
Cause it's going to wait forever
and change the max to 1
wdym?
message.channel.awaitMessages(filter, { max: 10000000000, time: 10000000000000000000000000000000000, errors: ['time'] })
for example, my bot joined the server ooo my founder came to say how? [MY ENGLฤฐSH BAD]
message.channel.awaitMessages(filter, { max: 1, time: 5000, errors: ['time'] })```
Change it to that
Or i cant?
@earnest phoenix wdym
what?
if i type the generated number nothing happens though
Discord.js
@earnest phoenix Yes
why doesnt it make the user win when they say the generated number?
let guessNum = false;
let max = args;
if (!args) {
guessNum = Math.floor(Math.random() * 1000) + 1;
message.channel.send(`${emoji('guess')} **| Generating a new random number!**\nGuess the number between 1 and 1000!`)
console.log(guessNum)
}
else {
guessNum = Math.floor(Math.random() * args) + 1;
if (isNaN(guessNum)) {
message.channel.send(`${message.author}, ${args} is not a valid number`).then(msg => msg.delete(2000));
}
else {
message.channel.send(`${emoji('guess')} **| Generating a new random number!**\nGuess the number between 1 and ${max}`)
console.log(guessNum)
}
}
const filter = m => m.content.startsWith(guessNum)
message.channel.awaitMessages(filter, { max: 1, time: 5000, errors: ['time'] })
.then(collected => {
message.channel.send(`${emoji('hypertada')}**| Hooray! ${author} has guessed the number **${guessNum}**`)
})
.catch(collected => console.log(`After a minute, only ${collected.size} out of 4 voted.`));
function emoji(name) {
return bot.emojis.find(emoji => emoji.name === name)
}
}```
let guessNum = false;
let max = args;
guessNum = Math.floor(Math.random() * 1000) + 1;
message.channel.send(`${emoji('guess')} **| Generating a new random number!**\nGuess the number between 1 and 1000!`)
console.log(guessNum)
const filter = m => m.content.startsWith(guessNum)
message.channel.awaitMessages(filter, { max: 1, time: 5000, errors: ['time'] })
.then(collected => {
message.channel.send(`${emoji('hypertada')}**| Hooray! ${author} has guessed the number **${guessNum}**`)
})
.catch(collected => console.log(`After a minute, only ${collected.size} out of 4 voted.`));
function emoji(name) {
return bot.emojis.find(emoji => emoji.name === name)
}
Okay and?
Any errors?
Show me your code
the code part or whole command?
Whole command
const Discord = require("discord.js")
const botconfig = require("../botconfig.json");
const prefix = botconfig.prefix
module.exports.run = async (bot, message, args) => {
let guessNum = false;
let max = args;
guessNum = Math.floor(Math.random() * 1000) + 1;
message.channel.send(`${emoji('guess')} **| Generating a new random number!**\nGuess the number between 1 and 1000!`)
console.log(guessNum)
const filter = m => m.content.startsWith(guessNum)
message.channel.awaitMessages(filter, { max: 1, time: 5000, errors: ['time'] })
.then(collected => {
message.channel.send(`${emoji('hypertada')}**| Hooray! ${author} has guessed the number **${guessNum}**`)
})
.catch(collected => console.log(`After a minute, only ${collected.size} out of 4 voted.`));
function emoji(name) {
return bot.emojis.find(emoji => emoji.name === name)
}
}
module.exports.config = {
name: "create",
description: "create a wonderful guessing game for your server!",
usage: `${prefix}create`,
accessableby: "Moderators",
aliases: ["guessmake", "makeguess", "createguess", "funguess"]
}```
it just consoles something
nothing
.catch(collected => console.log(`After a minute, only ${collected.size} out of 4 voted.`));```
What do you have the error defined as
nothing
Where are my bot :(
You are catching the error with .catch() and you are projecting as?
const filter = m => m.content.startsWith(guessNum)
message.channel.awaitMessages(filter, { max: 1, time: 5000, errors: ['time'] })
.then(collected => {
message.channel.send(`${emoji('hypertada')}**| Hooray! ${author} has guessed the number **${guessNum}**`)
})
.catch(collected => console.log(`After a minute, only ${collected.size} out of 4 voted.`));
@coral trellis my bot verified but i cant see my bot +_+
@earnest phoenix https://i.imgur.com/bnb5FUU.png
@unreal junco Read what I have said
ok
selamรผn aleykรผm
@brave sentinel #memes-and-media for turkish
Ne alaka ya
Unless he's asking for help he needs to chat in #memes-and-media
it makes no scenes
ok
i havnt got to learning the catch errors yet
Okay
promise.catch(this => {})```
So here you define the output or whats returned from the catch
?
channel.send("lol").catch(yes => {channel.send(yes)})
is that what i do?
I am teaching you
So if there is an error
yeah
You will catch it with the .catch() as a fallback
.catch(e)
Right
or just .catch()
.catch(e)
console.log(e)
Right
is that what i do?
The way I would do it is
.catch(e => console.log(e))```
Now look at your code
const filter = m => m.content.startsWith(guessNum)
message.channel.awaitMessages(filter, { max: 1, time: 5000, errors: ['time'] })
.then(collected => {
message.channel.send(`${emoji('hypertada')}**| Hooray! ${author} has guessed the number **${guessNum}**`)
})
.catch(collected => console.log(`After a minute, only ${collected.size} out of 4 voted.`));```
i change .catch(collected => console.log(After a minute, only ${collected.size} out of 4 voted.));
to
.catch(e => console.log(e))
right?
the error says
if (message.content.startsWith('start')) {
let guessNum = false;
guessNum = Math.floor(Math.random() * 1000) + 1;
message.channel.send(`${emoji('guess')} **| Generating a new random number!**\nGuess the number between 1 and 1000!`)
console.log(guessNum)
const filter = m => m.content.startsWith(guessNum)
message.channel.awaitMessages(filter, { max: 1, time: 6000, errors: ['time'] })
.then(collected => {
message.channel.send(`${emoji('hypertada')}**| Hooray! ${message.author} has guessed the number **${guessNum}**`)
console.log(collected)
})
.catch(collected => {
console.log(`After a minute, only ${collected.size} out of 4 voted.`)
console.log(collected)
});
function emoji(name) {
return client.emojis.find(emoji => emoji.name === name)
}
}

how do i make the number turn into this number
`${emoji('HyperTada')}**| Hooray! ${message.author} has guessed the number ${guessNum}**````
but atleast it works though
`${emoji('HyperTada')}**| Hooray! ${message.author} has guessed the number` + "`" + guessNum + "`"```
i never knew that
so that what i do
u learn something new everyday
i learnt alot today
how to catch errors, and that with the `
so now thats done how do i do the args stuff?
or is it the same i did b4
This you should you be able to figure out
ok
i did IT!!!
nvm
only works for 1
i did half but now its not working ๐ญ
i think i'll do a seperate command
to make life easier
yep it works
Error: Cannot find module './mรผzikconfig.js'
whats the problem?
what
my name why no unicode ty#0083 ? <@&304313580025544704>
Because your name has unicode stuff
Dont ping all mods for this and this is a development channel.
Dont ping all mods
@coral trellis i fixed sa-as and auto dm join message
pls add my bot again sorry :/
@gleaming glen tรผrk misin
Um yea
@gleaming glen benim botu sa as yanit verdiฤi iรงin mutelediler. onu kaldฤฑrdฤฑm. Birde giris mesajฤฑ attฤฑฤฤฑ iรงin atmislar onu da kaldrdim tekrar ekleyemzsn?
eren how are you
how would i do something like this
โถ โฌโฌ๐โฌโฌโฌโฌโฌโฌโฌโฌโฌ [00:36 - 03:19]:loud_sound:
i use lavalink
Idk, google it
How would i save user input on my website (register form) into a sqlite database?
@split hazel google
the viability of that play bar is questionable if you ask me. you throw one request every second at discord's api to edit a message. If 100 people are using your bot at the same time you're already at 100 requests a second just to update a playing timer
i've seen people doing 5 second updates instead, i think its fine with 5 seconds
the rate limit is per major route
reminds me when I forgot to add a sleep on my infinite loop, even the lib was not capable of handling the ratelimits until discord was spamming my console with failed requests
that was like a one time thing, and that kinda affected how my bot was functioning in future sessions to the point when not all users were cached or even normal messages were excessively slow
So can a bot not get accepted because it has a command that changes its result whether or not the channel is NSFW?
if it says the command is nsfw locked it should be fine
It actually has a SFW and NSFW version of it baked into the same command.
It just checks the channel type and it's internal guild settings and outputs accordingly.
I don't, it only mentions it on my own wiki and if you use the help command.
Should be fine then
Okay I guess I'll have to try again and probably talk to someone.\
Who Can help me With add a pages to command?
what?
then ask in shadbot's server
ok
this server isn't about whatever that bot does
this is where smart nerdy programmers who code discord bots come to hang out
ok
Pages Embed...
How would I use an emoji in this?
.setThumbnail()
you need a picture of the emoji then
hm ok. ty
wdym by pages embed, and what library @earnest phoenix
How can I put the bot on status Do not disturb but is also on the status of listening?
@earnest phoenix depends on library
but on d.js it's
<client>.setStatus("dnd")
And for listening
<client>.user.setActivity(`to music`, {type: "LISTENING"});
What This <client>?
how you defined client
what you defined as your client
Ok
also always direct to the docs
or he can just actually learn js ^
His native language isnt english.
fixed the bot i have
it was where the client connects
nvm
mfw i have an error for an unexpected input and i can't find it

https://hastebin.com/ililuviwek.js it starts line 12 before line 3-10 is finished, and i can't await since nedb doesn't return promises, i'm not sure what i should do?
you install the prerequisites on your computer
what is the prerquisites
visual studio?
things you need to install before using discord.js
i used to work with visual studio
@mossy vine can you come to dm
no
oh my.
which glitch?
im not going to dms with you when all you need to do is install simple shit on your computer
oh i thought you found smth wrong with this:
https://hastebin.com/ililuviwek.js it starts line 12 before line 3-10 is finished, and i can't await since nedb doesn't return promises, i'm not sure what i should do?
there should be a how to
I can see something wrong with that file, it's missing semicolons in some places
what is nedb?
probably a db
mongo but local

let prefix= false
@zinc pawn because its asynchronous or however you spell it
That's actually spelt correct
im mr englishman
no im the englishman here
the global prefixes in the array work
its just line 3-10 isn't finished by the time line 12 starts
yes because its async
how do i prevent that
remove async from the lambda function?
that would break everything? its the message event which uses async (bot, message) => {...
mk..
hey yall where's the discord.js document where it shows you the perms of a guild
like MANAGE_MESSAGES, ADMINISTRATOR etc
Thanks! :)
help?
let guessNum = false;
let max = args;
guessNum = Math.floor(Math.random() * 1000) + 1;
message.channel.send(`${emoji('guess')} **| Generating a new random number!**\nGuess the number between 1 and 1000!`)
console.log(guessNum)
const filter = m => m.content.startsWith(guessNum)
message.channel.awaitMessages(filter, { max: 1, time: 6000, errors: ['time'] })
.then(collected => {
message.channel.send(`${emoji('HyperTada')}**| Hooray! ${message.author} has guessed the number** ` + "`" + guessNum + "`")
console.log(collected)
})
.catch(collected => {
console.log(`After a minute, only ${collected.size} out of 4 voted.`)
console.log(collected)
});
function emoji(name) {
return bot.emojis.find(emoji => emoji.name === name)
}
}```
this works fine
but how can i add the args part in it?
let max = args;
if(args == "")
{
guessNum = Math.floor(Math.random() * args) + 1;
if(isNaN(guessNum))
{
message.channel.send(`${message.author}, ${args} is not a valid number`).then(msg => msg.delete(2000));
}
else
{
message.channel.send(`${emoji('guess')} **| Generating a new random number!**\nGuess the number between 1 and ${max}`)
console.log(guessNum)
}```
cause when i try it wont work
How can i play a local track using lavaplayer and JDA?
@unreal junco Maybe, if you provide the error, we might help you better 
@cloud peak You don't
Anyone know why it looks fine on chrome, but not edge, or where I can go to figure out how to fix it?
The one that's messed up is edge
They use different html renderers
I know this, but how would I fix this
How can i play a local track using lavaplayer and JDA?
@amber fractal edge has an element inspector, you can use it to figure out whats wrong. possibly some rule that edge doesnt support
welp, get a pc with edge
you use browser prefixes
And
edge doesnt support it
edge does
block-size is an experimental rule
@cloud peak You. Don't.
edge doesnt support it
-ms is for edge
I've already told you
oh
then just put an error
ez
or just forget about edge
because edge is moving to chromium
so it will use the same renderer as chrome soon
How soon?
when msft gets off their ass
what are you trying to use block-size for? im 100% sure you can achieve the same without it
So not soon
they're supposed to release an insider preview soon
okay okay hold on hold on
My question is
Why the fuck does it matter if the site doesn't work on Edge?? Like, no one without old people uses Edge
It doesn't matter
people do
No, Edge suuuuucks
without the block size, this happens
just because you don't doesn't mean other don't
Just make sure it works on both Chrome and Firefox, if it does @amber fractal then you're fine
@amber fractal use width/height/padding
I tried
with vertical-align?
no
When I remove block size, I get the same issue they were having, obviously, so just resize the image?
That didnt work last time
send link in dms
just check if their browser is edge or or ie, if it is block them from the site and force them to use a proper browser :^)
It was a user of mine, I dont want to do that
that was sarcasm
@amber fractal percent height and width are relative to closest parent fixed height/width
so if parent element is height 50px, height 10% = 5px. if there is no parent element with fixed height, height 10% = 10% of entire page/window
your image is ridiculously oversized, but you should either give the image fixed dimensions, or give the entire top bar a fixed height, so its children can use percentage heights
@amber fractal i presume ur using the w3school navbar
You'd be correct
they have a responsive nav example iirc
you can use css media queries
I do
It is responsive
if you open it on your phone its a menu instead
Well now it looks like this on edge for some reason
who uses edge
The user who sent me this
so what
our parents 
dbl doesnt support edge
^
Well as of the current moment it isnt outdated.
you should rewrite your top bar
for this problem?
you want the icon to not be included in the mobile menu?
i can think of a gazillion ways to solve the problem, but it all depends on how exactly you want it to behave
because every solution will create a certain outcome that might not be what you want, and will require you to rewrite other things to fix it
welcome to css hell
but basically try rewriting your top bar using only basic css, and not any kind of experimental css, that will make it more cross browser compatible
No I want it on mobile
it works on mobile
just not edge
I've tested firefox, chrome, edge and safari
edge is the only one giving me problems
I fixed it
i still don't understand why you won't use a css library
Mainly because I dont know what that means, and I fixed it
Who have any help for me ? I've test 5 commands for args and, it doesn't work, who can help me ( API: Discord.js )
const filter = m => m.content.startsWith(guessNum)
message.channel.awaitMessages(filter, { max: 1, time: 600000000, errors: ['time'] })
.then(collected => {
message.channel.send(`${emoji('HyperTada')}**| Hooray! ${message.author} has guessed the number** ` + "`" + guessNum + "`")
console.log(collected)
})
.catch(collected => {
console.log(`After a minute, only ${collected.size} out of 4 voted.`)
console.log(collected)
message.channel.send("Sorry you took to long please say -create to try again!")
});```
how do i make this last 1 month?
cuase its only lasting 6 mins
and if i make the number bigger
it last 1 second
if smaller
last 1 second
help?
Thats higher than the max for a 32 bit signed integer
The max time is 2,147,483,647
not just time
the max 32 bit signed integer
you dont have to rewrite everything lol, using a css lib is literally just applying class names to elements, you can set up a functional website made with bootstrap in under 10 minutes
I know that committing changes to sqlite database after every sqlite command is not a good idea, what are the better alternatives that I can use? At first I was thinking of an infinite loop that commits like every couple of seconds, is that a good practice?
cache and sync perhaps?
Anyone here who does nodejs dev have any experience with pm2 forking process randomly? I normally host things containerized, but since I'm still working on my bot pretty actively I just have it set up as a pm2 service currently.
...but it seems to fork the process occasionally for no reason. Both copies are stable, nothing in logs ... it just decides I need 2 bots every now and then
it doesn't happen if I'm just running the bot directly in a terminal, so I assume its pm2 related
im trying to make everything proxypass to a local address but then one part go to a different file only under that location
listen 443 ssl;
server_name WEBSITE;
ssl_certificate server.crt;
ssl_certificate_key server.key;
location /cp {
try_files $uri C:/website/hueboi/index.html;
}
location / {
proxy_pass "https://192.168.0.123:443";
}
}```
i tried this logic but it doesnt seem to work
that's not how it works
message.channel.send(`${emoji('HyperTada')}**| Hooray! ${message.author} has guessed the number** ` + "`" + guessNum + "`")```
message.author is tagging the user who made the command
how to i change it to the person who says the winning number?
Wdym the winning number
That's not much context
You'll need to send the whole command
And explain what it does
How do I save contents of a .json file in hosting?
Cause I have js fs.writeFile("./exp.json", JSON.stringify(exp), (err) => { if (err) console.log("Writing to exp.json failed: " + err) })
But when you restart/deploy the bot all data inside of the json resets because it just replaces the file w/ {
}
again
dont use json
@sterile hedge Do you know how to work w/xml?
what is the json for?
why does it get replaced when you restart the bot?
use a database
writing to json is bad practice
if you need basics you can try sqlite or mysql
etc
this is the whole command
google.com/search?q=how do i use a database
let guessNum = false;
let max = args;
if(!args == "")
{
guessNum = Math.floor(Math.random() * args) + 1;
if(isNaN(guessNum))
{
message.channel.send(`${message.author}, ${args} is not a valid number`).then(msg => msg.delete(2000));
}
else
{
message.channel.send(`${emoji('guess')} **| Generating a new random number!**\nGuess the number between 1 and ${max}`)
console.log(guessNum)
}
}
const filter = m => m.content.startsWith(guessNum)
message.channel.awaitMessages(filter, { max: 1, time: 2147483647, errors: ['time'] })
.then(collected => {
message.channel.send(`${emoji('HyperTada')}**| Hooray! ${message.author} has guessed the number** ` + "`" + guessNum + "`")
console.log(collected)
})
.catch(collected => {
console.log(`After a minute, only ${collected.size} out of 4 voted.`)
console.log(collected)
message.channel.send("Sorry you took to long please say -create to try again!")
});
function emoji(name) {
return bot.emojis.find(emoji => emoji.name === name)
}```
how+do+seach+on+google
message.channel.send(`${emoji('HyperTada')}**| Hooray! ${message.author} has guessed the number** ` + "`" + guessNum + "`")```
message.author is tagging the user who made the command
how to i change it to the person who says the winning number?
console.log(`After a minute, only ${collected.size} out of 4 voted.`)
try not copy pasting the code from a tutorial
?
i said dont copy your code from examples or tutorials, and maybe learn
the function returns a "collected" parameter
one of the mods in the server was helping me and teaching me how to catch errors and learn new ways
which is the users that reacted /etc
Get the message author of the last message sent in the channel ?? idk
it literally provides the user
idk how to do that xD yet
collected.first().author
Well this is a new one
I mean my bot is online
its all working, but what is this 
a shard died
jksdfsbhdjfdk
@earnest phoenix Please keep random text or random stuff in #memes-and-media
It died before it launched? ๐ค
It died before the ready event
How do I code stuff
Learn a programming language
I did but what site
??
Wdym
You can code it in a code editor on your computer and host it on a server
Or use https://glitch.com
a!botinfo
help
how can i make the bot delete all non numbers in a command
cause when i tried it did it once
it only did it when the command was triggered
please ping me
We donโt even know what programming language you are using
But Iโd assume JavaScript from your earlier messages
js
so i have express to handle http requests
server.get("/", (request, response) => {
How would i log the request the initial server sent?
Nevermind, I just made the express handle post requests and then parse them
"Unexpected token ๏ฟฝ in JSON at position 3" why do I see this message guys? I tried to put the command 'node bot.js'
go to your json file
go to line 3
line 3 and fix it
or if you have no idea paste line 3 here
package.json?
auth.json
ah
at JSON.parse (<anonymous>)
at Object.Module._extensions..json (internal/modules/cjs/loader.js:708:27)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (C:\Users\conan\OneDrive\Desktop\DiscordBOT\bot.js:3:12)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)```
did you put a space at the end of your auth.json?
If yes delete it
if no check again
thats strange it should not be happening
so what should I do now?
one sec
okay!
when trying your json, i did get a json error but on line 2
JS Eris
Using client.getMessageReaction will the order always be the same?
What is the order based on?
@near lotus put
"token": "your token"
}```
exactly that except replace your token with well your token.
and when referring to token :
(how you defined requiring your json file).token
how?
file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.
At line:1 char:1
+ const auth = require("./auth.json")
+ ~~~~~
+ CategoryInfo : ObjectNotFound: (const:String) [], CommandNotFoundExce
ption
+ FullyQualifiedErrorId : CommandNotFoundException
auth.token : The term 'auth.token' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the name, or if a
path was included, verify that the path is correct and try again.
At line:2 char:1
+ auth.token
+ ~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (auth.token:String) [], CommandNotFoun
dException
+ FullyQualifiedErrorId : CommandNotFoundException```
sorry i don't know anything about this
what are you even trying to do
i've never seen such error
it isn't even a node error
I try to active my bot on my Discord
I mean run the bot
I follow these steps on https://medium.com/davao-js/tutorial-creating-a-simple-discord-bot-9465a2764dc0
why does everyone use that tutorial
@near lotus thats a very very very old and outdated tutorial
idk
thats stupidly old and uses discord.io
so what should I do?
and maybe learn javascript?
yeah, I think I should
Any documentation for the discord js?
How can I discourage my bot @jade garnet
@near lotus this looks like a nice and simple tutorial https://www.devdungeon.com/content/javascript-discord-bot-tutorial
^
you guys know any good lavalink docs? I keep getting connection refused error an trying to figure out how to fix it
(function (exports, require, module, __filename, __dirname) { const client = new Discord.Client()
^
ReferenceError: Discord is not defined
at Object.<anonymous> (C:\Users\conan\OneDrive\Desktop\DiscordBOT\my_bot.js:1:78)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)```
what is the problem now?
you need to define Discord
define the discord js module
before making bots, it's recommended to have at least basic javascript knowledge
okay! Thank you!
read the docs
yeah
ik how to addrole
but this add role is different
if someone guesses the number it gives them a role
wait i think i got it
cannot read property 'addRole'
i presume u need to learn js
once someone guesses a number how can the bot auto pin message?
read the fucking docs yo
also dont pin message just because someone guessed the fucking number
Hi all ๐
I'm using Discord JS to build a caretaker bot. Can someone recommend a better approach to processing a message rather than a huge if/else:
https://github.com/andrewjdick/lurch-bot/blob/master/commands/processMessage.js
put commands each in their own file
The commands themselves have their own file
discordjs.guide
read the command handler guide
Thanks
ugh
node/discord.js
i type node server.js and websocket is not a constructor
what does that mean?
how do i fix?
we need a "how to ask technical questions 101" pin ๐ฉ
do i need to npm install websocket?
How to ask a technical question 101:
What is your problem?
Can you give us any details on your problem?
Can you provide the language or library/framework you are using?
If you have any images relating to the problem post them. Be sure to post the error or actual problem instead of just "it isnt working"
@marble needle does that work

ok:
no you need to specifiy what the difference between a lib and a language is. i stopped counting how many threw "javascript" at me when i asked for their lib
discord.js
their problem
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/constructor read up on constructors, review your code and find out what you're doing wrong
well it was working fine before and now its not
so im confused
(node:8160) UnhandledPromiseRejectionWarning: TypeError: WebSocket is not a constructor
at WebSocketConnection.connect (C:\Users\\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:254:26)
at new WebSocketConnection (C:\Users\\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:89:10)
at WebSocketManager.connect (C:\Users\\node_modules\discord.js\src\client\websocket\WebSocketManager.js:75:25)
at client.rest.methods.getGateway.then.res (C:\Users\\node_modules\discord.js\src\client\ClientManager.js:45:22)
at process._tickCallback (internal/process/next_tick.js:68:7)
well what would this even need?
^
Sounds like WebSocket wants to be returned as an object rather than formed as one
how do you use groups in discord.py?
Would anyone want to get paid to make a web scrapper for me? o-o
its a bit complicated
depends, how much you're offering? what kind of things do you need to scrap?
@ruby dust Groups?
there's commands.command and there's commands.group
I have an idea how it works but idk how to execute it
@commands.group(invoke_without_command=True)
async def your_command_name(self, ctx):
do_your_functions()
@your_command_name.command()
async def sub_command_name(self, ctx):
do_your_subcommand()
await self.your_command_name()?
yes, how can that be useful to me
for example yes
[p]your_command_name sub_command_name
well that I know, but what's the reason behind both of these being functions? can I use the group function as a global check to be used by server managers, for example?
- If you wanna execute stuff even if no subcommand was used, probably
- I bet yes if it returns booleans, according to https://discordpy.readthedocs.io/en/rewrite/ext/commands/commands.html#global-checks
Tfw you know next to nothing about Python. Smh
You don't need to judge someone or yourself for not knowing something
I know, I was judging myself in a sense. Never picked up Python
there's always room to learn more
I hope to learn it though!
It's not too hard, good luck though
^^ Thanks!
just to let you know, python is best for scripting than anything else
Yeah, so I've heard!
It sounds quite fascinating with a wide range of uses.
If anything, adding more skills to ones list is never a bad thing
it's well known for being one of the easiest languages and for being used by large companies, like google
Yeee
That sounds neat!
How could I go about removing the trailing , at the end of the commands list?
output += `\`${c.help.name}\`, `;``` is how I have it now.
yeah, joining is the clean solution
Join them/check if last entry/check if first entry
@earnest phoenix store all members in a variable to prevent api abuse, and loop through the statuses
I aint gonna fucking spoonfeed you
best way to do that would be to enable getting all users, if your library has that option. but keep in mind that doing so will increase your bot's resource usage and load time
So am 13 and i am currently making a simple bot
all my friends want to use it in their servers
so how do i publish it?
wym
you are making a bot but you don't have the application yet?
bot's application https://discordapp.com/developers/applications/me
Integrate your service with Discord โ whether it's a bot or a game or your whatever you wildest imagination can come up with.
oh yeah i have that




