#development

1 messages · Page 948 of 1

earnest phoenix
molten coral
#

🤔

pale vessel
#

or just use an api lul

earnest phoenix
copper cradle
#

@slender wagon that has nothing to do with command handlers whatsoever

amber fractal
#

much slower

pale vessel
#

slow as regex

amber fractal
#

and teaches you nothing

#

well the api would probably use regex

earnest phoenix
#

^

pale vessel
#

even slower

amber fractal
#

so it's regex + round trip

#

when it could just be regex

earnest phoenix
#

so use regex and only regex

pale vessel
#

5Head

earnest phoenix
molten coral
#

°-°"

wet iron
#
bot.once ('ready', () => {
     console.log('Ready!');
     bot.user.setPresence({
        status: "dnd",
        game: {
            name: "Type $help for help!",
            type: "WATCHING"
        }
     })
});```
#

can someone help me?

#

the status wont show up

pale vessel
#

what version of discord.js?

wet iron
#

^12.2.0

pale vessel
earnest phoenix
#

I made a clearwarns command but if i do !clearwarns nothing happen, any idea why? the warns are stored on mongoDB

wet iron
#
bot.once ('ready', () => {
     console.log('Ready!');
     
     bot.user.setActivity('Do $help for help!', {type: 'Watching'});
});``` set it to this and it wont work yet
#

the line is broken to another one cause it cant fit discord

slender wagon
#

wdym @copper cradle, i'm basically new to everything commands handlers and alot of stuff, and also i never used async before

copper cradle
#

weird

earnest phoenix
#

I just use a JS for my warning system 4Head

copper cradle
#

@slender wagon async/await has nothing to do with command handlers

slender wagon
#

yes ik

copper cradle
#

alr

slender wagon
#

i used to write everything in the main file

copper cradle
#

@earnest phoenix do I have to guess what your code looks like, what errors you get, or are you gonna show your code?

#

alr

wet iron
#

can anyone help me?

#
bot.once ('ready', () => {
     console.log('Ready!');
     
     bot.user.setActivity('Do $help for help!', {type: 'Watching'});
});``` set it to this and it wont work yet
#

the status wont show up

pale vessel
#

WATCHING

wet iron
#

ok

#

lemme try

#

thanks

copper cradle
#

what's the problem

wet iron
#

im dumb af xD

copper cradle
#

ah

earnest phoenix
#

@copper cradle i forgot to send the code 😅

#

So, the data is stored in data base and this code should delete the warns from data base, but it doesn't ```js
warns.deleteOne({ User: wUser.id, Guild: message.guild.id })

digital ibex
#

i dont think thats the correct way to do it

#

wait

#

what is warns @earnest phoenix

earnest phoenix
#

const warns = require("../../models/warns");

let Schema = new mongoose.Schema({
  Warns: Array,
  User: String,
  Guild: String,
})

module.exports = mongoose.model("warns", Schema)```
digital ibex
#

ok

#

then idk

#

u can try

#

wait, no

#

yeah, idk

earnest phoenix
#

@earnest phoenix warns.findOneAndRemove({...}) you can try

#

Ok

#

@earnest phoenix nothing :/

#

impossible.

wet iron
#

does anyone know how I can make the bot send a message to everyone in the server?

#

like do $broadcast message

#

and it sends a message to everyone

#

i tried this bot.on ('message', msg => { if (msg.guild && msg.content.startsWith('$broadcast')) { let text = msg.content.slice('$broadcast'.length); msg.guild.members.forEach(member => { if (member.id != client.user.id && !member.user.bot) member.send(text); }); } });

digital ibex
#

use a for loop

wet iron
#

but it wont work

digital ibex
#

any errors?

wet iron
#

yes

digital ibex
#

whats is it

modest maple
#

who who who

#

stop

#

dont do that

earnest phoenix
#

?

digital ibex
#

well, if he wants to do it

#

¯_(ツ)_/¯

modest maple
#

i mean no

wet iron
#

msg.guild.members.forEach is not a function

modest maple
#

Dont tell someone how to break ToS

#

@wet iron Do do mass DMs or Mass message

earnest phoenix
#

V12?

modest maple
#

its against ToS and will get both you and your bot banned

wet iron
#

i mean no
@modest maple Dude i wont publish the bot Im making my bot for my private server

digital ibex
#

🤷

modest maple
#

@wet iron That doesnt change anything

slender thistle
#

Might want to use a role mention or @everyone

digital ibex
#

if its private its allowred right?

modest maple
#

NO

wet iron
#

bruh not on this server

#

my bot isnt on this server

earnest phoenix
#

@wet iron v12?

wet iron
#

yes

slender thistle
#

It's discouraged overall

modest maple
#

why the fuck would it being private make it allowed?
Mass Dms are still ToS breaking

#

Discord doesnt care if your bot is private or public

digital ibex
#

chill dude

modest maple
#

they do not allow Mass DM bots, it is ToS breaking in every form

#

if you want to tell everyone about somthing use the @everyone mention

#

it exists for a reason

tight plinth
#

hi there. So I made a quick function in js which is supposed to fill userstatus.customstatus with something, but the problem is that the output of userstatus.customstatus is empty, but if I execute the code via a eval command it works just fine. Any idea why?
https://cdn.lumap.me/jn6uzviw.png

#

yes

earnest phoenix
#

what mistake guys

tight plinth
#

show code @earnest phoenix

earnest phoenix
tight plinth
#

show full error

earnest phoenix
#

hi

#

can anyone help me

#

??

amber fractal
#

@tight plinth How does that even return an empty string, shouldn't it be "No Custom Status" if there was nothing anyways?

earnest phoenix
tight plinth
#

idfk

earnest phoenix
#

enable-pnpm

amber fractal
#

Do you alter it elsewhere?

tight plinth
#

@earnest phoenix install the module 🤦

#

nope, not at all

earnest phoenix
#

@earnest phoenix modüller yüklüyse enable çek

#

@earnest phoenixhi bro can u help me

#

plz

tight plinth
amber fractal
#

didnt see the else

earnest phoenix
#

tuRkİsh İN #OffTOPİC SmH

#

@earnest phoenix yüklü yav kafayı yicem

#

düzelmiyor

pale vessel
#

lumap, you need to define userstatus.customstatus first in order to concatenate it

earnest phoenix
#

can u help me plz

amber fractal
#

they probably do

#

just not shown

pale vessel
#

unless you did

amber fractal
#

which is why it's an empty string

#

I'd assume anyways

tight plinth
#

i did

pale vessel
#

well then

earnest phoenix
#

@amber fractalbro i want my bot to show its guild info like number of servers etc

#

can u help me plz

#

i dont know how to code that

#

@earnest phoenix yüklü yav kafayı yicem
@earnest phoenix try enable-pnpm in console

tight plinth
#

@earnest phoenix we're not gonna give you code. if you want people to help you develop the bot, we're not gonna help you

earnest phoenix
#

@tight plinthi have coded the bot and its ready . i just wanted to know that how to input the guild info

amber fractal
#

after let activity = ... just try to console.log the activity, that's where I'd start

tight plinth
#

read the docs

earnest phoenix
#

plz i request

cinder patio
#

what have you done so far regarding the guild info command, hype?

#

have you tried creating it?

winter basalt
#

you wont get anywhere if you just ask for help for every single code you need

tight plinth
#

it doesnt seems to log anything...

amber fractal
#

Is it with your presence?

tight plinth
#

oh sec

#

restarted the bot

#

it logs the presence

#

and presence.activites exists

#

yes it's my presence

#

and after a restart it seems to work

#

what the

#

cache is trash

#

grab args and put args as description

#

message.content

#

but

#

wait

pale vessel
#

you define args by splitting message content by spaces

tight plinth
#

what is IVC(message,"poll")

#

is that a command handler or something?

pale vessel
#

what an interesting method

tight plinth
#

you already use message.content, and I assume you know how to split strings in javascript. just do that

#

like

#

.split(prefix.length+cmdName.length).trim()

#

this should give you args

#

should

pale vessel
#

not quite

#

you mean slice?

tight plinth
pale vessel
#

lumap

tight plinth
#

yes, slice

#

thats why i said that it should work, i wasnt sure

pale vessel
#
const args = message.content.slice(prefix.length + cmdName.length).trim().split(/\s+/);```
#

this would be ideal

#

you can also separate the command from the args by using args.shift()

wispy jasper
#

Helli

#

sa

pale vessel
tight plinth
#

i mean, define them

pale vessel
#

it would be cmdName on your case

#

oh

merry edge
#

does bulkDelete still work?

#

idk clause my clear command doesnt work

grizzled raven
#

just do message.react() twice

#

i made my own function that does that but

#

also which is better,

for (...) {
  await promise().catch(handle)
}
// or
Promise.all([promise1, promise2].map(p => p.catch(handle))
``` ?
spice smelt
#

[JS] hi! I'm switch to mongo, and I would like to know how to get one specific value of a matching object. I know how to get the whole object with smth like .findOne({type:'covid'}), but idk how to get only one of its values

EDIT: wait I just realized how stupid my question is. just smth = col.findOne(stuff); smth2 = smth.smth2. but is there still a way to to what I asked quicker?

tight plinth
#

one line>* @grizzled raven

grizzled raven
#

one line isnt always the case tbh, they both look nice on its own, its really only when its in a block of code

#

@spice smelt you could do (if this isnt py 😳) const { smth2 } = await col.findOne(stuff)

amber fractal
#

object deconstruction for the win

spice smelt
#

@grizzled raven wait I didn't understood. wdtm?

grizzled raven
#

is this js or is this py

spice smelt
#

its js

grizzled raven
#

do you know how to use async/await?

amber fractal
#

when you const {x} = some object it will set x to the value assigned to the key x in some object

spice smelt
#

@grizzled raven I do

grizzled raven
#

have you done ```js
const { Client } = require("discord.js")

spice smelt
#

so in the mongo object, the key that will be named x has to already be named x ?

grizzled raven
#

it can be anything

amber fractal
#

well it doesnt matter what it's called

#

it's just deconstructing the object into single variables

grizzled raven
#

it will assign a variable from an object with that variable name

spice smelt
#

@grizzled raven actually no x) ```js
const client = new Discord.Client();

grizzled raven
#

for example,

const { Client } = require("discord.js")
const Client = require("discord.js").Client
``` these are the same but one is cooler
amber fractal
#

It works either way, but deconstruction saves a line... lmao

spice smelt
#

well I'll read the MDN docs, but I still don't understand how this can find the right key if the names don't have to be the same

grizzled raven
#

see look

eternal furnace
#

@grizzled raven actually...yes

amber fractal
#

well in your example, smth = col.findOne(stuff); smth2 = smth.smth2., you could just do const {smth2} = col.findOne(stuff) you'd have to await it ofc so like await col.findOne(stuff) etc

grizzled raven
#

you can do any of the following - ```js
const { prop } = await col.findOne({id: 123})

const prop = await col.findOne({id: 123}).then(d => d.prop)

const prop = await col.findOne({id: 123})
prop = prop.prop

amber fractal
#

or, const prop = (await col.findOne({id: 123})).prop mmLol

grizzled raven
spice smelt
#

I think I've understood. But in that case : ```js
MONGO:
{
id: 1,
object: {
az: 0,
er: 1,
ty: 2

}
}
js
{ ui } = collection.findOne({id:1})

Would this work? Or has `ui` to be `az` or smth?
grizzled raven
#

wait so you're trying to get az and assign it to ui?

spice smelt
#

exactly. I guess it won't work, right?

grizzled raven
#

yeah you can do that but it may get a bit more complicated for new people

spice smelt
#

how?

grizzled raven
#
// az is the property, ui is a new variable
const { az: ui } = await col.findOne({id: 123})
spice smelt
#

great! I got it

#

and if we name the ui const az, then would this be ok? js const { az } = await col.findOne({id:123})

grizzled raven
#

think of it this way:

// a normal js object
const object = {
  key: "value"
  // key is the key,
  // "value" is the value
}
const { key: variable } = object
// key is the key, 
// variable is the value (of the key in the original object)

// we get the value of the key "key" in the object
// now you can do stuff with variable
spice smelt
#

I see

#

well thanks for your help!

grizzled raven
#

np

#

hope that makes sense

wet iron
#

I need help

#

embed wont work

#

the bot crashes

#

i get the error

#

Range [EMBED_FIELD_VALUE] MessageEmbed field values may not be empty

amber fractal
#

value cant be an empty string

wet iron
#

Did I say that im dumb? cz_xd

brave rover
#

you can use blank characters \u200b

wet iron
#

now I have a other error

#

cause channel.send(Embed)

#

channel is ont defined

sudden geyser
#

did you define it or did you mean to get the channel on the msg object

timid anvil
#

Adversiting????

sudden geyser
#

no

timid anvil
#

Yes

sudden geyser
#

Negative.

amber fractal
#

and he attempted

timid anvil
#

What is this

sudden geyser
#

I assume they mean the discord invite

wet iron
#

oh

#

in the code

#

i will delete it

#

sry

#

forgot xD

timid anvil
#

Deletrd XD

earnest phoenix
#

how i can turn on my bot on ruby?

#
require 'discoruby'

client = Discoruby::Client.new()

client.on :debug do |message|
  puts("[DEBUG]: #{message}")
end

client.on :error do |err|
  puts("[ERROR]: #{err}")
end

client.on :ready do
  puts("[LOG]: Bot Ready!")
end

client.on :message do |message|
    puts("#{message.author.tag}: #{message.content}")
end

client.login('token')
```i have that
celest shard
#

for how much time does discord show the "I'm new to Discord, say hi" thing in a new profile?

still merlin
earnest phoenix
#

Hope my bot gets approved

white anvil
#

@celest shard a week

celest shard
#

@celest shard a week
@white anvil tysm

earnest phoenix
#

How can I find out which Invite link the user used to join my server Discord.js?

wary kraken
#
    if (command == 'vote') {
        if (userData[sender.id].voted == 0) {
            botData[botId].votes = botData[botId].votes + 1
            userData[sender.id].voted = 1
            
            let voteEmbed = new Discord.RichEmbed()
            .setDescription('Vote')
            .addField('Voted', `You have voted, there has been ${botData[botId].votes} so far.`)
            
            message.channel.send(voteEmbed)
        } else {
            let voteEmbed = new Discord.RichEmbed()
            .setDescription('Vote')
            .addField('Error', ' Already Voted.')
            
            message.channel.send(voteEmbed);
        }
    }

How can I make this where the data actually loads and saves?

#
    if (command == 'votes') {
        let votesEmbed = new Discord.RichEmbed()
        .setDescription('Sync')
        .addField('Votes', botData[botId].votes)
        
        message.channel.send(votesEmbed);
    }
#

Only shows 0 even if it has a vote

earnest phoenix
#

use a database

wary kraken
#

I am

#
    if (!userData[sender.id]) userData[sender.id] = {
        messagesSent: 0,
        warnings: 1,
        money: 100,
        jobDelay: 0,
        level: 0,
        xp: 0,
        job: 0,
        voted: 0,
        annoying: 0
    }
    if (!userData[botId]) botData[botId] = {
        upvotes: 0,
        votes: 0,
        commands: 18,
        commandsSent: 0,
        messagesSentTotal: 0
    }
``````js
var userData = JSON.parse(fs.readFileSync('Storage/userData.json', 'utf8'));
var statsData = JSON.parse(fs.readFileSync('Storage/stats.json', 'utf8'));
var otherData = JSON.parse(fs.readFileSync('Storage/otherData.json', 'utf8'));
var serverData = JSON.parse(fs.readFileSync('Storage/serverData.json', 'utf8'));
var botData = JSON.parse(fs.readFileSync('Storage/botData.json', 'utf8'));
{}

( ^ Database Files )

earnest phoenix
#

json oh god

wary kraken
#

yes works fine for my work command

#

but not my vote command

unique nimbus
#

JSON should not be used as a database

#

It can get corrupted

#

and then all the data is gone

#

Use Mongo or SQL

wary kraken
#

._.

#

It runs on heroku in github

#

and it works well with my work command for json

#

and Mongo if you scroll down a bit it litterly says : "Rich JSON Documents"

#

and its not corrupt even if I rebuild it it doesnt work

mossy vine
#

fun fact: mongodb is an actual db unlike a json file

#

not to mention it uses bson

#

not json

unique nimbus
#

The more your bot gets used the higher the chance the JSON files will be corrupted

wary kraken
#

._.

#

Im not talking about corruption
Im talking about the code

#

I can handle that later

#

but im trying to fix the code

#

not sign up for a subscription for database storing

mossy vine
#

what

#

you selfhost mongodb

#

not pay for it

#

lul

#

same with literally everything thats sql

#

plus what use is working code if your "db" gets corrupted

wary kraken
#

bruh its on github if it gets corrupted it wont corrupt the file

#

it will corrupt the heroku file

#

then I can rebuild it

unique nimbus
#

and lose the data

mossy vine
#

heroku cant even write to json

wary kraken
#

yes

#

its on a seperate server

modest maple
#

this big brain right here lmao

earnest phoenix
#

lol

#

the process is just runing on a vm which contains the processes

#

it's why the storage is ephemeral

modest maple
#

I hAs UnLimItEd BaCkUpS uSiNg GlItcH aS mY rAiD SyTEm

earnest phoenix
#

get a proper host

#

otherwise deal with the good old "you get what you pay for"

wary kraken
#

bruh Im not paying I cant even pay for one

earnest phoenix
#

congrats you got the point of my message

#

you're having way too big expectations from something you're using for free

wary kraken
#

Im just trying to make a simple bot for my servers and maybe a few other servers

#

I would never expect it to be used for like 1k servers

#

and im not using glitch

#

I code for fun not to pay for its not a full time job :/

earnest phoenix
#

so do 90% of people here

balmy knoll
#
let counter = Object.keys(result).length - 1;
console.log(`Channels counter in ${oldState.guild.name} are now ${counter}`)
let guild = oldState.guild;
let updateChannel = guild.channels.cache.get(mainChannel);

updateChannel.setName(`Crea Canali 👷 [${counter}/30]`)
 .then(newChannel => {
                            /* Some Code */
 })
 .catch(console.error);

I have a problem with discord.js: in this code the bot cannot set the channel name with the correct value contained in the COUNTER variable. The variable contains the right value and I can confirm this from the console.log.

earnest phoenix
#

how often are you changing the name

balmy knoll
#

@earnest phoenix The name is changed circus twice a minute. But I know this feature I'm recreating is used in other bots that change it even faster. And anyway with the same code until yesterday it worked.

earnest phoenix
celest shard
#

uhm, how do I check a users's current client? e.g Desktop Discord.

#

(discord.js)

warm marsh
#

@earnest phoenix Have you tried console logging the channel?

wet iron
#
client.on('messageReactionAdd', async (reaction, user) => {

    if(reaction.emoji.name === ':star:') {
        if(reaction.message.partial) {
            const fetchedMsg = await reaction.message.fetch();

            const Embed = new MessageEmbed()
                .setAuthor (fetchedMsg.author.tag, fetchedMsg.author.displayAvatarURL())
                .setURL(fetchedMsg.url)
                .setDescription(fetchedMsg.content)
                .setFooter(fetchedMsg.createdTimestamp)

            const starboard = client.channels.cache.find(channel => channel.name.toLowerCase() === 'starboard');
            if(starboard) {
                starboard.send(Embed);
            }
        }
    }
}```
#

can someone help me

#

this is my code for starboard

#

and it wont send the embed

#

to the starboard channel

clever tree
uncut token
lyric mountain
#

just a sec, gonna read the error

#

update to 4.1.1_140

#

it's an error connecting to discord's gateway

#

compile group: 'net.dv8tion', name: 'JDA', version: '4.1.1_140' if you're using gradle

#

@uncut token note that the new constructor is like that:```java
JDA client = JDABuilder.create("YOUR INTENTS")
.setToken("YOUR TOKEN")
.setChunkingFilter(ChunkingFilter.NONE) //IF YOU DON'T HAVE GUILD_MEMBER GATEWAY
.disableCache(CacheFlag.ACTIVITY, CacheFlag.CLIENT_STATUS) //IF YOU DON'T HAVE PRESENCES GATEWAY
.setMemberCachePolicy(MemberCachePolicy.NONE) //IF YOU DON'T HAVE GUILD_MEMBER GATEWAY
.build()
.awaitReady();

uncut token
#

I already have new constructor but thx man!

nocturne dagger
#

How can I set a guilds icon

#

discord.js

#

i couldent find it in docs

#

probobly just missed it

#

i saw it in the docs

#

as guild.setIcon

#

could i do message.guild.setIcon("url") cas it didnt work

ripe epoch
#

Anyone got any tips on getting people to use my bot? I have no money to bid on tags 😦

#

I’m probably using wrong channel too

lyric mountain
#

Anyone got any tips on getting people to use my bot? I have no money to bid on tags 😦
@ripe epoch make a good/useful bot, join servers and become active until you get a chance to talk about your bot, make a cool bot page, be very detailed in your bot's description, etc

#

just remember

#

NEVER

#

EVER SPAM

wet iron
#
  client.on('messageReactionAdd', async (reaction, user) => {
    if(reaction.emoji.name === '⭐') {
      if(reaction.message.partial) {
        const fetchedMsg = await reaction.message.fetch();
        const embed = new MessageEmbed()
          .setColor('#0xEEC649')
          .setAuthor(fetchedMsg.author.tag, fetchedMsg.author.displayavatarURL())
          .setDescription(fetchedMsg.content)
          .setFooter(fetchedMsg.createdTimestamp)
        const starboard = client.channels.cache.find(channel => channel.name === 'starboard');

        if (starboard) {
          starboard.send(embed);
        }
      }
  }
``` This is my code for the starboard but the bot wont send the message to the channel
earnest phoenix
#

i made a custom welcome channel message and the bot is not sending any message, i got no errors and if i do console.log i got Promise { <pending> } undefined help ?

lyric mountain
#

only talk about your bot IF the context allows it

ripe epoch
#

Yeah

nocturne dagger
#

Is there any way to get a file to a link like upload it to a image hosting site or somethign

wet iron
#

can anyone help me?

lyric mountain
#

Is there any way to get a file to a link like upload it to a image hosting site or somethign
@nocturne dagger use some image hosting site's api

wet iron
#
  client.on('messageReactionAdd', async (reaction, user) => {
    if(reaction.emoji.name === '⭐') {
      if(reaction.message.partial) {
        const fetchedMsg = await reaction.message.fetch();
        const embed = new MessageEmbed()
          .setColor('#0xEEC649')
          .setAuthor(fetchedMsg.author.tag, fetchedMsg.author.displayavatarURL())
          .setDescription(fetchedMsg.content)
          .setFooter(fetchedMsg.createdTimestamp)
        const starboard = client.channels.cache.find(channel => channel.name === 'starboard');

        if (starboard) {
          starboard.send(embed);
        }
      }
  }
``` This is my code for the starboard but the bot wont send the message to the channel

anyone help?

lyric mountain
#

i made a custom welcome channel message and the bot is not sending any message, i got no errors and if i do console.log i got Promise { <pending> } undefined help ?
@earnest phoenix that's a promise, you gotta handle it

nocturne dagger
#

any suggestions?

#

for the site

wet iron
#

bruh

#

any help for my bot

#

damn

teal badger
#

pp

#

pp

lyric mountain
#

@nocturne dagger https://apidocs.imgur.com/

pale vessel
#

what if the message isn't a partial lol

nocturne dagger
#

ok

wet iron
#
  client.on('messageReactionAdd', async (reaction, user) => {
    if(reaction.emoji.name === '⭐') {
      if(reaction.message.partial) {
        const fetchedMsg = await reaction.message.fetch();
        const embed = new MessageEmbed()
          .setColor('#0xEEC649')
          .setAuthor(fetchedMsg.author.tag, fetchedMsg.author.displayavatarURL())
          .setDescription(fetchedMsg.content)
          .setFooter(fetchedMsg.createdTimestamp)
        const starboard = client.channels.cache.find(channel => channel.name === 'starboard');

        if (starboard) {
          starboard.send(embed);
        }
      }
  }
``` This is my code for the starboard but the bot wont send the message to the channel

Anyone help please?

pale vessel
#

i did

#

stop reposting

wet iron
#

w8

#

about that error

#

i mean

#

it doesnt pop up anything

#

it wont send the message on the starboard

pale vessel
#

you're using fetchedMsg and that's only a thing when the message is a partial

quartz kindle
#

@balmy knoll discord changed the rate limits

#

you can only change channel name and topic 2 times in 10 minutes

balmy knoll
#

Yes i saw. Now i contacted the discord staff because now my bot can't work properly

wet iron
#

you're using fetchedMsg and that's only a thing when the message is a partial
@pale vessel what do you mean partial? I dont understand

pale vessel
#

did you code that

wet iron
#

ooh i see im dumb

#
  client.on('messageReactionAdd', (reaction, user) => {
    if (reaction.emoji.name !== '⭐') return;

    let starmsg = message;
    let channel = reaction.message.guild.channels.cache.find(c => c.name == 'starboard');

    let starEmbed = new Discord.MessageEmbed()
    .setAuthor(message.author.tag)
    .setColor("#FFFC00")
    .addField(":star:", starmsg);

    let limit = 4;
    if (channel && reaction.emoji.name == '⭐' && reaction.count >= limit) {
      client.channels.cache.find(channel => channel.name === 'starboard').send(starEmbed)
  };
``` Ok I changed the code and I thought it worked perfectly but if you star a message but there are more messages beneath it it will star those messages and eventualy it turns into spam
#

any help?

toxic jolt
#

help please

#
      throw new TypeError("question is empty / undefined");
      ^
TypeError: question is empty / undefined
#

error

nocturne dagger
#

Is there any way to have the bot send a image, and then get the discordapp link from that image

quartz kindle
#

just await the message, then get its attachment url

sudden geyser
#

@toxic jolt check what's on line 320

wet iron
#
  client.on('messageReactionAdd', (reaction, user) => {
    if (reaction.emoji.name !== '⭐') return;

    let starmsg = message;
    let channel = reaction.message.guild.channels.cache.find(c => c.name == 'starboard');

    let starEmbed = new Discord.MessageEmbed()
    .setAuthor(message.author.tag)
    .setColor("#FFFC00")
    .addField(":star:", starmsg);

    let limit = 4;
    if (channel && reaction.emoji.name == '⭐' && reaction.count >= limit) {
      client.channels.cache.find(channel => channel.name === 'starboard').send(starEmbed)
  };
``` Ok I changed the code and I thought it worked perfectly but if you star a message but there are more messages beneath it it will star those messages and eventualy it turns into spam

any help for me?

nocturne dagger
#

@quartz kindle sorry i don't follow

quartz kindle
#

you need to send the message

nocturne dagger
#

so i have the attachment

quartz kindle
#

and wait for the return value

nocturne dagger
#

    const attachment = new Discord.Attachment(canvas.toBuffer(), 'pride.png');
message.channel.send(attachment)
#

what would I do after that

quartz kindle
#

either await or .then()

nocturne dagger
#

i mean inside of that

#

is it jsut message.attachmentURL?

quartz kindle
nocturne dagger
#

how would i set that as a variable though

#

like .then(let url = message.attachments)

#

i'm sorry if im anoying you at all

quartz kindle
#

message.attachments is a collection of attachments, since a message can have more than one attachment

#

you're only sending one, so its safe to use .attachments.first()

#

then you get the .url property from it

nocturne dagger
#

can you give me a example

quartz kindle
#

sentMessage.attachments.first().url

nocturne dagger
#
    const attachment = new Discord.Attachment(canvas.toBuffer(), 'pride.png');
   

message.channel.send(attachment).then(
let url = sentMessage.attachments.first().url
)
    
}
#

?

quartz kindle
#

you need to define the return value of the .then

#
.then(bla => {
  bla.attachments.first().url
})
nocturne dagger
#

ok

wet iron
#
  client.on('messageReactionAdd', (reaction, user) => {
    if (reaction.emoji.name !== '⭐') return;

    let starmsg = message;
    let channel = reaction.message.guild.channels.cache.find(c => c.name == 'starboard');

    let starEmbed = new Discord.MessageEmbed()
    .setAuthor(message.author.tag)
    .setColor("#FFFC00")
    .addField(":star:", starmsg);

    let limit = 4;
    if (channel && reaction.emoji.name == '⭐' && reaction.count >= limit) {
      client.channels.cache.find(channel => channel.name === 'starboard').send(starEmbed)
  };
``` Ok I changed the code and I thought it worked perfectly but if you star a message but there are more messages beneath it it will star those messages and eventualy it turns into spam

If anyone knows to help me just ping.

earnest phoenix
#

So, I am attempting to make like a fast spotify playlist to music queue system for lavalink. I did this easily in ytdl, but I built the queue system much diffrently there. I could basically just add the name to the queue and it would load it when its going to play.

But for lavalink, it has to be loaded while in the queue, right. So my first attempt was a slow one, because I loaded each track 1 after another, causing the load time for like a 14 song playlist be like 15 seconds. So I decided that maybe it would work if I basically loaaded em all at the same time inside of a forEach and then placed them right, however I have no idea how to replace songs in the lavalink queue system, etc. Please help me, thank u!

mystic violet
#

Any idea how I would make categories for commands in html

#

(basically a table dropdown menu that opens another table)

fallow steppe
#
const { Events } = require('util/Constants');

module.exports = (client, packet) => { const { old, updated } = client.actions.MessageUpdate.handle(packet.d); 

if (old && updated) { /** * Emitted whenever a message is updated - e.g. embed or content change.
 * @event Client#messageUpdate
 * @param {Message} oldMessage MSG
 * @param {Message} 
newMessage MSG 
*/ client.emit(Events.MESSAGE_UPDATE, old, updated);
 } };```
amber fractal
#

why is it all one line

fallow steppe
#

Didnt copy well

#

Anyway, I have this as whatever is being used to make the bot listen to edited messages

#

Not sure where it actually goes

quartz kindle
#

did you just copy that from somewhere?

fallow steppe
#

Yes

quartz kindle
#

that will never work

#

it relies on internal code that can only be used from inside wherever you copied it from

fallow steppe
#

Is there anywhere I can use to see and learn / use what requires to do that?

quartz kindle
#

you need to use the messageUpdate event

nocturne dagger
#

Hey tim. So I got the mesage link to work

#

but, I got another error

#
message.channel.createInvite().then(invite => {
    
    let embed = new Discord.RichEmbed()
        .setTitle("New server joined Mission Pride")
        .setDescription(invite.url)
        .setFooter("Mission Pride 2020")
        .setThumbnail(message.guild.iconURL)
    
    client.channels.get('715623522218672158').send(embed)
})

.get isnt defined

quartz kindle
#

cannot read send of undefined?

amber fractal
#

well is that on v12?

#

if so add .cache

#

or fetch the channel instead

quartz kindle
#

looks like v11

#

using RichEmbed

amber fractal
#

Oh yeah that as well

#

I just got that from .get isnt defined

quartz kindle
#

v12 would say get isnt a function

#

pretty sure

nocturne dagger
#

(node:3581) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'get' of undefined

#

meant to send that with it

quartz kindle
#

then the problem is client.channels

#

for some reason client.channels is undefined

#

where are you getting that client from?

nocturne dagger
#

wdym

#

the const client = new Discord.client() thing

amber fractal
#

Did you wait for client.on("ready")?

#

well yeah it's in a message

fallow steppe
#
console.log(oldMessage);
await oldMessage.fetch();
console.log(oldMessage); 
});```
amber fractal
#

that's really weird then, what version of d.js do you use?

fallow steppe
#

This only logs edited message in terminal, but doesn't respond to edited message

#

Is there something missing?

quartz kindle
#

@nocturne dagger is this on the main file or on a separate file?

nocturne dagger
#

main

quartz kindle
#

is it inside an event?

nocturne dagger
#

and version 11.3.2

#

no

#

oh

#

the one in the command file is in then .then()

quartz kindle
#

@fallow steppe you need to apply the same logic from your message event to it

#

ie: check if newMessage starts with prefix, if its a valid command, etc...

fallow steppe
#

How so? I'm new to d.js sorry about it

quartz kindle
#

@nocturne dagger are you doing client = new Discord.Client() in your command file?

nocturne dagger
#

no

fallow steppe
#

I edited the message from !ping to !help, but no response from the bot, only messages being logged

quartz kindle
#

good

nocturne dagger
#

want to see the whole command?

quartz kindle
#

i guess

nocturne dagger
quartz kindle
#

@fallow steppe how did you code your commands?

#

the same thing you did in your message event

#

you need to do the same in messageUpdate event

#

@nocturne dagger thats your command file right?

#

delete the bot = new Discord.Client() part

#

show how you use that command in your main file

nocturne dagger
#

yea

#
et prefix = ".";

    let msg = message.content.toLowerCase();
    let args = message.content
      .slice(prefix.length)
      .trim()
      .split(" ");
    let cmd = args.shift().toLowerCase();

    if (!message.content.startsWith(prefix)) return;

    try {
      let commandFile = require(`./commands/${cmd}.js`);
      commandFile.run(Discord, client, message, args);
graceful dock
#

Is it possible to mention someone with his name and discriminator ?
or to get his client id

clever tree
#

Could someone help me please ? I have a music bot. He played well every day. But today i tried .play and he joined the voicechannel. he joined, had a green circle but didnt have any audio. I restarted the bot and the pc but the problem is still not solved. Also I tried to update some things. Still the problem. I used the code from crawl music bot tutorial. So the code is clean. Obviously he worked all the days beofre. I catched the video and the song in my console. And yeah he got the link and everything he needs. But the problem is the ytdl-core. I have the core 2.1.3 and discord.js 11.6.4. Didnt change anything.

quartz kindle
#

@nocturne dagger you're doing .run(Discord,client,message,args)

#

but your command is .run = async (client, member, message)

graceful dock
#

Restarting your pc will do nothing about your problem KappaLUL

quartz kindle
#

message arguments are passed by order, not by name

nocturne dagger
#

ok

quartz kindle
#

the first argument is Discord, so in your command file, the first argument is also Discord, meaning you gave it the name client but it is actually a copy of Discord

nocturne dagger
#

changed that

fallow steppe
#

@quartz kindle sorry for late response, I code bot on glitch, and I have the command separately in commands folder. I posted this code in server.js file

digital ibex
#

hi

#

so

#

i have js client.getRESTUser(guild.moderations.filter((e) => e.kick.user === message.member.id).map((e) => e.kick.mod)) and i'm getting user_id: Value "475371795185139712,475371795185139712,475371795185139712" is not snowflake. ik what the error means and why i'm getting it, but i don't know how to fix it. if anyone can help that'd be great :)

sudden geyser
#

You can get it by specifying a single user. Are you trying to get all moderators who punished the user?

digital ibex
#

no @sudden geyser

#

i only have the mods id, and i'm trying to get their username

#

wait, yeah. i am trying to get all the mods who punished the user

magic jackal
#

I cant figure out what is causing this error

#

nightmare of an API

earnest phoenix
#

is there a way to get the name of the currentfile you’re in? (discordjs v12)

mossy vine
#

???

amber fractal
#

like the root directory of the project?

earnest phoenix
#

yes or just the filename

digital ibex
#

u can do __dirname.split('\\').pop()

earnest phoenix
#

oke imma try that

digital ibex
#

wait

#

no

#

thats gonna giv u the folder its in

#

it would be __filename.split('\\').pop()

compact kite
#

use os.getcwd() to get the working directory *in python

#

if thats what you want

digital ibex
#

he's using js

compact kite
#

Ah'

#

Very similar in looks sometimes

clever tree
#

So i have discord.js. My Discord bot worked well for 3 weeks with no changes on the script. But today he play no audio. He finds the video, get the url, joins the channel but plays no audio. So he has the audio. He knows which audio he plays. He lights green but has no sound. And i didnt get any errors. So I think the issue is the ytdl-core with dispatcher. Could someone help me pls ;)
discord.js = 11.6.4
ytdl-core = 2.1.3

wary kraken
#

Is it a music bot?

clever tree
#

ye

mossy vine
#

no thats not why it plays audio from a youtube url

wary kraken
#

FFmpeg

clever tree
#

I installed ffmpeg, ffmpeg-binaries, ffmpeg-statics. And it worked well for 3 weeks. Today I updated them after i got this issue

wary kraken
#

You would need FFmpeg so the bot can convert yt vids into playable music files that the bot can play

mossy vine
#

well then revert the updates

#

@wary kraken did you read the message

clever tree
#

@mossy vine ffmpeg and binaries have the same version like 2 weeks before. Got no updates since 1 year or something i gues.

wary kraken
#

Nothing helpful just trying to get me to use other stuff for save the files even though thats not the problem, it works with my work command, and I use github with heroku so if I rebuild it the files will not be corrupted so its not helpful.

#

And @clever tree What is it running on?

clever tree
#

node.js

wary kraken
#

K

#

Ill send you a download file that got my FFmpeg to work

#

I had the same problem

#

It was a heroku buildpack

#

but heroku buildpacks are just code added onto your project

mossy vine
#

43 seconds ago wut

clever tree
#

So maybe this is a hint. I got a error this day with saving my index. It told me that the file is newer then on my pc. After i didnt save my file ig ot that error.

wary kraken
#

?

clever tree
#

I got this error. Randomly after changing some normal things. Also i didnt have my bot on any websites, only on my pc.

wary kraken
#

Try to revert to before that err message

clever tree
#

I was not able to revert. I turned my pc off yesterday when i got that error. So after i got this error i deleted the original index.js and copy and pasted the code into a new one

wary kraken
#

Game.ts?

wet iron
#
module.exports = {
    name:'announce',
    description:'announce',
    execute(msg) {
        const Discord = require('discord.js');
        const client = new Discord.Client();

        if (!msg.member.roles.cache.find(r => r.name === "Staff")) return msg.channel.send('You dont have permission! :angry:');
        let text = msg.content.slice('$announce'.length);
        
        const Embed = new Discord.MessageEmbed()
        .setColor('#C21807')
        .setTitle('Announcement!')
        .setAuthor(msg.author.tag, msg.author.displayAvatarURL())
        .setThumbnail("https://us.123rf.com/450wm/dragomirescu/dragomirescu1902/dragomirescu190200619/116454959-stock-vector-grunge-blue-white-alphabet-letter-combination-bc-b-c-on-black-background-suitable-as-a-logo-for-a-co.jpg?ver=6")
        .setDescription(text);
        
        const announcements = client.channels.cache.find(channel => channel.name.toLowerCase() === 'announcements')
        
        announcements.send(Embed)        
}
}
``` `Error: Cannot read property 'send' undefined` can someone help me?
earnest phoenix
#

if (!announcements) return

clever tree
#

@wary kraken what do u mean with game.ts ?

earnest phoenix
#

add to your code, 200 iq

wary kraken
mystic violet
#
app.get("/", (req, res) => {
    //The actual discord stuff

    console.log("url: " + req.url)``` for some reason req.url outputs `/` when its suppost to output `/?code=blah`
clever tree
#

@wary kraken a screenshot from web xd
Not mine. xd

mystic violet
#

any idea why?

earnest phoenix
#

idk

mystic violet
#

its Oauth2 (discord)

wary kraken
#

@mystic violet
Try

 `url: ${req.url}`
mystic violet
#

its not the string, the thing is. the value itself is "/"

wary kraken
#

And app.get("/"

mystic violet
#

this is how oauth2 responds

#
https://flexiboat.ga/?code=fR1YZozx3Maz3UQlXX2vsljxm8G2JV```
wet iron
#

@earnest phoenix Now it wont send... and the channel exists

earnest phoenix
#

@wet iron remove toLowerCase() and try

wet iron
#

ok

#

nope

#

still nothing

earnest phoenix
#

Wait wait..

#

why you're creating new client?

wary kraken
#

You can try

`Url: ${req.url}`

If its only sending the https://flexiboat.ga/?code=fR1YZozx3Maz3UQlXX2vsljxm8G2JV
But if its not try to change it to

app.get("", (req, res) => {
    //The actual discord stuff

    console.log("url: " + req.url)
digital ibex
#

what

#

no

wet iron
#

why you're creating new client?
@earnest phoenix cause then it wont detect the client, cause i created the command handler

digital ibex
#

client is message.client

earnest phoenix
#

yeah

wary kraken
#

And @earnest phoenix In Discord.js whenever a message is sent in discord.js it can be like

const Discord = require('Discord.js');
const bot = new Discord.client();
wet iron
#

oh

earnest phoenix
#

@wary kraken shut , i know it.

wary kraken
#

My bot works with new

digital ibex
earnest phoenix
#

I know , i am not a new user.

wet iron
#

client for me is a constant equal to new Discord.client()

fallow steppe
#

I got a command like this:

message.channel.send("Hi! My prefix here is ${prefix}")
}``` But is not working, why so?
wary kraken
#

Do `` instead of ""

earnest phoenix
#

You can't use message.client ?@wet iron

wary kraken
#

@fallow steppe

if (message.content == "@dusky veldt") {
  message.channel.send(`Hi! My prefix here is ${prefix}`);
}
#

Ok I gtg

earnest phoenix
#

@fallow steppe put client.user.toString() instead of your bot's id and try im sure it will work.

wet iron
#

You can't use message.client ?@wet iron
@earnest phoenix I dont understand you now

fallow steppe
#

Okay, Ill see

earnest phoenix
#

@wet iron so, I mean define msg.client instead of creating new Discord.Client()

fallow steppe
#

No, still isn't working

#

@wary kraken This isn't what I mean, the first line is what I have issue with

wet iron
#

@wet iron so, I mean define msg.client instead of creating new Discord.Client()
@earnest phoenix I dont understand it even more now, i tried to do const client = msg.client but nope

#

oh

#

i realized now

#

i did new msg.client

#

instead of msg.client

earnest phoenix
#

wHaT

wet iron
#

im dumb xD

earnest phoenix
#

WTF!?

#

interesting

wet iron
#

its my first time creating a bot in js

#

i mean

#

its the second

#

the first one got sh*t on

earnest phoenix
#

@fallow steppe can you try if (message.isMentioned(client.user)){ //... }

fallow steppe
#

Actually

earnest phoenix
#

yes actually

fallow steppe
#

The terminal says this: "message" is not defined

earnest phoenix
#

ooF

#

msg

clever tree
#

added 156 packages from 99 contributors and audited 859 packages in 27.27s
found 27 vulnerabilities (7 low, 10 moderate, 10 high)
run npm audit fix to fix them, or npm audit for details

could someone help me ?
How could i fix this issues completly. If i type npm audit fix the issues come again if i install something new

fallow steppe
#

Ayy ok

earnest phoenix
#

@fallow steppe did you fixed?

fallow steppe
#

No, still same thing

lofty grove
#

it detects some songs but not some music Bot has a problem, how can I eliminate this problem, is there someone to help?

hardy vector
#
client.on('message', async message => {
    const args = message.content.slice(prefix.length).split(' ');
    if (message.content.startsWith("!fortnite")) {
        let username = args[1]
        let platform = args[2]
        fortnite.user(username, platform).then(console.log);
        let embed = new Discord.MessageEmbed()
        .setTitle(`${username}'s Lifetime Stats`)
        .setColor("RANDOM")
        .addField("Matches Played",lifetime.matches)
        message.channel.send(embed)
    }
})``` i get this error (node:2004) UnhandledPromiseRejectionWarning: ReferenceError: lifetime is not defined
wet iron
#
module.exports = {
    name:'clear',
    description:'clear',
    execute(msg, args) {
        const Discord = require("discord.js");

        if (!msg.member.hasPermission("MANAGE_MESSAGES")) return msg.channel.send("You dont have permission! :angry:")
        if (!args[0]) return msg.channel.send("oof.")
        msg.channel.bulkDelete(args[0]).then(() => {
            msg.channel.send(`Deleted ${args[0]} messages`).then(msg => msg.delete(3000));
        })
    }
}
``` I have this giant error `UnhandledPromiseRejectionWarning: TypeError [MESSAGE_BULK_DELETE_TYPE]: The message must be an Array, Collection, or number.`
#

can someone help?

digital ibex
#

have both of you tried expanding ur javascript knowledge?

wet iron
#

well...

#

I see the error but idk where i screwed over

pliant needle
#

Fuck, what was the code for grabbing an avatar url again? discord.js

digital ibex
#

@pliant needle ^

pliant needle
#

Tyvm based friendo

#

Forgot they had documentation

copper cradle
#

you guys should actually try to learn

#

ya don't know what you're doing

#

@hardy vector where did you define lifetime

#

it isn't defined

#

try to like

#

read the error

mystic violet
#
https://flexiboat.ga/?code=blahblah doesn't work (for req.url)

http://localhost:1000/?code=KRRolAMtTeF4AxPdtkOfx30YFYFAjw works
for some reason``` any idea why?
#

probably cloudflare?

#

im so confusedl ol

copper cradle
#

did you setup the domain

mystic violet
#

Yes

#

the domain works

earnest phoenix
#

sorry i dont want to just jump in but i wonderd how to sort bots from people like in this example image in my bot, i would also like to know how theyre getting users previouse name history too

mystic violet
#

just the callback dont

#

:/

earnest phoenix
#

hi

copper cradle
#

you do realize that this server has nothing to do with the discord team right

earnest phoenix
#
https://flexiboat.ga/?code=blahblah doesn't work (for req.url)

http://localhost:1000/?code=KRRolAMtTeF4AxPdtkOfx30YFYFAjw works
for some reason``` any idea why?

@mystic violet have you tried to remove the s on https it might not be able to establish secure connection try just http on your first example

mystic violet
#

ok

earnest phoenix
#

you do realize that this server has nothing to do with the discord team right
@copper cradle i was just wondering man chill

open oracle
#

why do i have to keep reopening console

#

i mean

#

whenever i have no errors with my java script it sends "Ready!" and i cant type anymore

opaque seal
#

Is there any basic guideline out there on the internet on how to create a web dashboard for a discord bot?
I've searched but couldn't find much about it

mossy vine
#

not really

open oracle
#

rip

opaque seal
#

I'm gonna have to search more general stuff then

mossy vine
#

once you are familiar with the required concepts its not hard

opaque seal
#

Yeah, the only thing related to discord is the login stuff

open oracle
#

whenever i have no errors with my java script it sends "Ready!" and i cant type anymore
@open oracle anyone?

#

what diggy u keep adding reactions but not saying anything xD

#

-_-

quartz kindle
#

@open oracle thats how cli programs work

digital ibex
#

cant type where?

open oracle
#

oh...

#

on console

quartz kindle
#

once the program is running, the command line will show you that is running

digital ibex
#

oh then ^^

quartz kindle
#

if the command line returns control, it means the program ended

open oracle
#

oof

#

ok

#

thx

quartz kindle
#

you can force it to close with ctrl+C

clever tree
#

Could someone help me please ? My ffmpeg for my music bot does not convert into audio. Everything works but the bot plays no audio. I reinstalled ffmpeg and ffmpeg-statics but it still dont work. No error. This issues start today after 3 weeks of working well with no problems.

earnest phoenix
#

h,,,,,

open oracle
#

you can force it to close with ctrl+C
u just saved me xD

hardy vector
#
client.on('message', async message => {
    const args = message.content.slice(prefix.length).split(' ');
    if (message.content.startsWith("!fortnite")) {
        let username = args[1]
        let platform = args[2]
    let data = fortnite.user(username, platform)
        let embed = new Discord.MessageEmbed()
        .setTitle(`${username}'s Lifetime Stats`)
        .setColor("RANDOM")
        .addField("Matches Played",data.lifetime.matches)
        message.channel.send(embed)
    }
})```node:2148) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'matches' of undefined
quartz kindle
#

lifetime is in stats

hardy vector
#

oh so data.stats.lifetime.matches

quartz kindle
#

yes

hardy vector
#

now i get this

#

(node:2175) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'lifetime' of undefined

quartz kindle
#

did you console.log(data)?

hardy vector
#

i dont need to right? if im just getting the json stats

amber fractal
#

logging is usually the first step to debugging

open oracle
#

how would i tell if the message was sent by a bot?

amber fractal
#

in what lib

gritty bolt
#

does js support times with AM and PM for date functions

#

like converting to unix?

amber fractal
#

.toLocaleString() should

open oracle
#

wdym lib

amber fractal
#

library

open oracle
#

normal message

amber fractal
#

the thing you use to communicate with the discord api

#

no like

open oracle
#

OH

#

uh

amber fractal
open oracle
#

one sec

#

discord.js

#

that

clever tree
#

Anyone knows why ffmpeg stoped working without changes after 2 weeks ?

earnest phoenix
#

hey

sinful belfry
#

what lib r u using

#

i may be able to help

earnest phoenix
#

i got my bot muted due to "Responds to other bots" any fix anyone, ping me

clever tree
#

discord.js
node.js

amber fractal
open oracle
#

thx

sinful belfry
#

@clever tree ah it is the high water mark thing im pretty sure

#

to do with ytdl

clever tree
#

@sinful belfry const dispatcher = ServerMusicQueue.connection.playStream(ytdl(song.url, { filter: 'audioonly', quality: 'highestaudio', highWaterMark: 1 << 25 }))

sinful belfry
#

is that what you currently have?

clever tree
#

yes

sinful belfry
#

oh umm

#

what error message r u getting

clever tree
#

Thats the problem: I didnt get any error. I did no changes. So it just stoped form nothing xd

quartz kindle
#

maybe you're getting rate limited by youtube but the error is being swallowed somewhere

clever tree
#

I reinstalled all of the ffmpeg packages. i have ffmpeg and ffmpeg-static. When this error started i had ffmpeg and ffmpeg-binaries. The bot joins in the channel, gets the video light up green but has no audio.

#

:/

#

@quartz kindle What should i do now xd

sinful belfry
#

ah okay

#

i remember, i got this problem a while ago

#

but i really cannot remember what i did

#

which is irritating

clever tree
#

ok. I could not find any result in web so i dont know what to do now xd
But how could a code break without changeing anything. Especially ffmpeg after almost a year.

open oracle
#

why does this not work there are no errors

client.on('message', message => {
    if (message.content === 'GG') {
        if(message.author.bot) return;
            message.channel.send(':tada:')
}})
earnest phoenix
#

I keep getting unexpected token but I have already reset my token and only happens in discord.js v12

glossy elk
#

@earnest phoenix check if the command author is a bot

drowsy grail
#

Zod, try doing this instead:

client.on('message', message => {
  if (message.author.bot) return;
  if (message.content === "GG") return message.channel.send(":tada:");
}

quartz kindle
#

@earnest phoenix that error has nothing to do with your token

open oracle
#

ok

drowsy grail
#

woops sorry forgot to end it

quartz kindle
#

that error is caused by running an older node.js version

open oracle
#

its alright

quartz kindle
#

discord.js v12 requires node.js v12 or higher

earnest phoenix
#

Oh yeah oof forgot that

glossy elk
#

Why don’t you guys learn the basics first

#

Like people are asking

#

Stupid questions

open oracle
#

@drowsy grail it still doesnt work for the bot

drowsy grail
#

hmm... ok

open oracle
#

wait

drowsy grail
#

I tried doing the code you did on a test bot and it worked

open oracle
#

it works for both

#

srry

#

xD

drowsy grail
#

oh its fine

#

lol

earnest phoenix
valid frigate
#

you ran your js file twice

earnest phoenix
#

Let me see

open oracle
#

oh god another hoister no hoisting

valid frigate
#

either that or you forgot to terminate a process

open oracle
#

xD

ember lodge
earnest phoenix
#

@earnest phoenix check if the command author is a bot
@glossy elk ill have a look thank you

glossy elk
#

bruh u just made me think my bot was approved

#

;-;

#

aaaa-a

open oracle
#

f

#
client.on('message', message => {
  if (message.author.bot) return;
  if (message.content === "GG") return message.channel.send(":tada:");
});
```anyone know why this works with a bot and a user?
ember lodge
#

This is the code to post in how much servers my bot is in?

      setInterval(() => {
        dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total);
    }, 1800000);
earnest phoenix
#

SHOOT

#

so i noticed

#

i have 2 commands as a prefix, how do i get rid of one?

#

its hosted on a vps

terse thunder
#

How i can upload video of hackers to be banned ?

wary kraken
#

@terse thunder
On what?

earnest phoenix
#

“hackers” = ppl you gave admin that abused it

#

or that gained admin thru a bot that had its token leaked

wary kraken
#

K

earnest phoenix
#

discord is a secure platform and no one is able to gain access to your server without you giving them access @terse thunder

#

(except the discord staff team)

wary kraken
#

And also if the token is leaked on the internet discord sends you a message (I had one sent to me too)

earnest phoenix
#

nope

#

only on github

#

misconfigurated glitch projets do the job too

wary kraken
#
Hey ___

Safety Jim here! It appears that the token for your bot, ___ has been posted to the internet. Luckily, our token-scanning gremlins noticed, and have reset your bot's token - hopefully - before anyone could have maliciously used it! 

Your token was found here: ___

Be more careful in the future, and make sure to not accidentally upload your token publicly!

Obtain a New Bot Token: ___
open oracle
#

yes

wary kraken
#

@open oracle

earnest phoenix
#

then they have multiple services in support now

open oracle
#

?

earnest phoenix
#

when I got my token leaked it was only github

wary kraken
#

What do you mean by "why this works with a bot and a user?"

coral dragon
#

how do i make the bot make an invite in the channel i want?
like, when someone joins my server it auto goes to a specific channel that isnt available yet due to verification, how can i fix that and make it go to a certain channel?

wary kraken
#

Lol mine was just accidently put on public

open oracle
#

if i say "GG" it sends 🎉 and same with the bot

earnest phoenix
#

@coral dragon channel.createInvite

#

you cant change the channel the user is selecting

open oracle
#

message.channel.send(channel.createinvite)

wary kraken
#

@open oracle

if (message.content.includes('GG')) return message.channel.send(':tada:');
earnest phoenix
#

@open oracle what the fuck

open oracle
#

i want it uppercase so can i remove the to lowercase

#

what

wary kraken
#

There

open oracle
#

ok

#

thats what i thought

earnest phoenix
#

.createInvite(inviteSettings) returns a promise

wary kraken
#
if (message.content.includes('GG')) return message.channel.send(':tada:');
open oracle
#

oh ok

wary kraken
#

Is to fix

open oracle
#

srry xD

#

same thing

#

srry it took so long to respond had to do somethin

#

@wary kraken?

#

welp they are gone

#

xD

#
 if(message.author.bot) return;
 if (message.content.includes('GG')) return message.channel.send(':tada:');

anyone know why this works for user messages and bot messages?

wary kraken
#

Im back

#

Ok

open oracle
#

oh ok

wary kraken
#
if(message.author.bot) return;
if (message.author.id !== '(Your Bot Id)') return;
if (message.content.includes('GG')) return message.channel.send(':tada:');
open oracle
#

thx

#

let me try it

#

same thing

wary kraken
#

._.

#

Did you replace (Your Bot ID) with your bots id?

open oracle
#

yes

gritty bolt
#

I keep getting this from this code, any idea on what could be wrong?

    at C:\Users\Samst\IdeaProjects\ClockMaster\index.js:64:41
    at Array.forEach (<anonymous>)
    at C:\Users\Samst\IdeaProjects\ClockMaster\index.js:61:16
    at FSReqCallback.oncomplete (fs.js:155:23)
module.exports.help = {
    name: "wcsetup"
}```
```js
jsfile.forEach((f, i) => {
            let props = require(`./Commands/${f}`);
            console.log(`${f} loaded!`);
            bot.commands.set(props.help.name, props)
        })
    });```
clever tree
#

ok. yeah. I think I wont get my ffmpeg working again. So idk. Maybe it will fix it by itself. Lets wait some days haha. Idk what went wrong, but my bot definitly wont play audio again except of playfile xd

wary kraken
#

module.exports.help = {
name: "wcsetup"
}

gritty bolt
#

?

#

oh

#

wait

#

no i still dont get it

#

@wary kraken \

wary kraken
#

is it your bot?

#

or someone elses bot that is say GG

gritty bolt
#

my bot

open oracle
#

OKBoomer does the bot id have to be MY bot?

copper cradle
#

What does Your bot ID mean

#

if not your bot's id

open oracle
#
if (message.author.id !== '(Your Bot Id)') return;
copper cradle
#

??

open oracle
#

thats the bot id im talking about

copper cradle
#

is that what you have in your code

open oracle
#

yes

#

well

#

no

#

i replaced it

copper cradle
#

replace (your bot id) to your actual bot id then

#

lol

open oracle
#

with MEE6's ID

copper cradle
#

??

open oracle
#

im not THAT dumb

#

xD

copper cradle
#

I didn't

open oracle
#

wdym

copper cradle
#

no

#

wdym

#

what were you trying to do

#

I'm lost now

sick cloud
#

hi so do any of you know how to set up a way to generate my own snowflakes

#

(as in ids like 296044953576931328)

open oracle
#

????

#

im making it whenever MEE6 says someone has leveled up my bot says "stfu nerd"

#

xD

#

dont question it

#

zSnails?

knotty steeple
#

@sick cloud snowflakes are glorified timestamps

sick cloud
#

i know

#

and i want to know how to do them

#

unless you can suggest a better unique identifier system

knotty steeple
#

make ur own lul

#

newestid +1 always works

#

or actually uuid

fallow steppe
#

I have my commands in a folder called commands/, what do I write in server.js to make the bot listen to them?

open oracle
#
if(message.author.bot) return;
if (message.author.id !== '(Your Bot Id)') return;
if (message.content.includes('GG')) return message.channel.send(':tada:');
```anyone know why this works for user messages and bot messages?
fallow steppe
#

First if you have if(message.author.bot) return; then it ignores all bots, so the second line isnt useful

copper cradle
knotty steeple
#

found a library for it

sick cloud
#

cool

#

thanks

gritty bolt
#

I keep getting this from this code, any idea on what could be wrong?

    at C:\Users\Samst\IdeaProjects\ClockMaster\index.js:64:41
    at Array.forEach (<anonymous>)
    at C:\Users\Samst\IdeaProjects\ClockMaster\index.js:61:16
    at FSReqCallback.oncomplete (fs.js:155:23)
module.exports.help = {
    name: "wcsetup"
}```
```js
jsfile.forEach((f, i) => {
            let props = require(`./Commands/${f}`);
            console.log(`${f} loaded!`);
            bot.commands.set(props.help.name, props)
        })
    });```

@gritty bolt

#

can someone help with this

#

?

sick cloud
#

@knotty steeple so that works great but the ids are like in the 9800000000 region, how can i get them to start lower

earnest phoenix
#

that's completely normal lol

#

read Twitter's doc on snowflakes to see how snowflakes behave

#

it's in their archives i think

sick cloud
#

well this lib offers an offset

#

should i just set it to now

earnest phoenix
#

why tf that lib names everything in a retarded way

#

that's just the epoch

sick cloud
#

timeOffset : (Defaults to 0) Time offset will be subtracted from current time to get the first 42 bit of id. This help in generating smaller ids.

earnest phoenix
#

i know

#

you can set it to the first second of today or something, has to be a value that doesn't change if you want consistency

#

discords epoch is the first second of 2015

sick cloud
#

how would i get the first second of today then

earnest phoenix
#

you're a cert dev shouldn't you know that lol

sick cloud
#

being a cert dev != knowing literally everything

#

why would i need to know that

earnest phoenix
#

working with dates is like fundamentals but ok

sick cloud
#

i'll google it if all you want to do is call me an idiot

open oracle
#

oof

astral yoke
#

on glitch

#

my terminal is failing to open up

#

what should i do

pale vessel
#

by not usi-

#

refresh

astral yoke
#

still erroring

astral yoke
#

still wont open up

pale vessel
sharp pond
#

Hey is it hard to make a discord bot

pale vessel
#

depends

#

if you know a programming language, it shouldn't be hard

late egret
#

Hey is it hard to make a discord bot
@sharp pond It is not

#

I have made one and it is in approval

summer torrent
#

botghost !== coding bot

sharp pond
#

is it safe to use?

late egret
#

Yes

summer torrent
#

no

pale vessel
#

they said make though

late egret
#

you can just visit its website

pale vessel
#

xd

late egret
sharp pond
late egret
#

see this bot

summer torrent
#

botghost is not allowed on top.gg iirc

sharp pond
#

it says error

late egret
#

It does not say error

glad charm
#

Unmodified instances aren't allowed.

sharp pond
late egret
#

i have made 2 bots with botghosts

glad charm
#

Also @late egret no one can view that besides you / moderators as it's not yet approved/declined yet.

sharp pond
#

its from ghost bot

glad charm
#

@sharp pond yes it's safe. Most dashboards require that.

sharp pond
#

ok

late egret
pale vessel
#

don't suggest them that site

sharp pond
#

why

#

is it bad

pale vessel
#

it teaches you nothing

summer torrent
#

^

sharp pond
#

how do you like invite the bot to your server?

summer torrent
sharp pond
#

Does the botghost host it?

summer torrent
#

host what

sick cloud
#

hey so i have this sort of layout and was wondering how to get the side div to stick while the other div and it's content scrolls

#

so like there'll be a pinned sidebar

paper phoenix
#

@sick cloud - position: fixed

#

Or position: sticky

#

Read up on those

#

OR - use flex

#

Which is prolly easiest

sick cloud
#

cool ok

pure lion
#

how do i find a role by it's ID?

tight plinth
#

Like how you search a member/user by its id

summer torrent
#

get it from client/guild

pale vessel
#

try to avoid getting stuff from client

pure lion
#

alright

#

(node:8112) UnhandledPromiseRejectionWarning: TypeError: fn is not a function

#

(from the discord.js file)

#

what do

summer torrent
#

what is your discord.js and node.js version

tight plinth
#

Define fn

#

Smh

#

Or upgrade to node 12

earnest phoenix
#

Still Wondering how to get the user's nitro badges without the oauth2 authorization

#

How can I convert the "joinedTimestamp: 1590819577442" to a normal date?

summer torrent
#

use moment package

pure lion
#

How can I convert the "joinedTimestamp: 1590819577442" to a normal date?
message.member.joinedat

fiery stream
#
Traceback (most recent call last):
  File "C:\Python38\lib\site-packages\discord\client.py", line 312, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\Jassm\Desktop\Alpha\modules\core\error.py", line 18, in on_command_error
    ctx._ = functools.partial(ctx, cog="ErrorHandler")
TypeError: the first argument must be callable``` help
slender wagon
#

*60*60*1000
how can i change this to minutes

#

that's a hour

slender thistle
#

An hour is 60 minutes

slender wagon
#

so that's not an hour?

#

it adds 1 hour to my giveaway timestamp

#

but i need to only add 1 minute

slender thistle
#

I'm getting a feeling you're getting milliseconds there

slender wagon
#

yeah those are milliseconds

slender thistle
#

Well those calculations aren't needed

#

you're getting minutes (60), seconds (60), and then milliseconds (1000)

slender wagon
#

oh

#
.setTimestamp(Date.now() + (stated_duration_minutes *60*60*1000))```
#

wait i think i got it

#

yup fixed it

#

ty

#

i just left the milliseconds for a minute as the bot only works with minutes

sick cloud
#

if i have a string that's exactly true or false, how do i convert it to a boolean accurately, without using string checking

earnest phoenix
#

I just got this message from discord: It appears your bot, *bot name*, has connected to Discord more than 1000 times within a short time period. Since this kind of behavior is usually a result of a bug we have gone ahead and reset your bot's token. but I have no idea why, I haven't changed the code for a while so is it possible that this is a host issue?

nocturne grove
#

did you restart it really often?

#

how many times are you using this in your code?
new Discord.Client

whole knot
#

Hello, so I have a question regarding this guild list. Is there a way to add pages to this list as it does not show all the servers the bot is in?
Thanks for your help!

nocturne grove
#

yes you can make a for loop and first get guild 0-24 (max 25 fields), then 25-49 etc.

magic jackal
#

In discordjs is there a quick way to list a count of all voice connections

nocturne grove
#

yes, I think you can filter all guild members so you know which are connected a a voice channel

magic jackal
#

hmmm

earnest phoenix
#

How do I get total guild count for all shards using eris sharder?

oak imp
#

I mean, dunno if Eris screws this up/has some sort of thing that will make normal code break... but just do a broadcastEval and sum the results?

balmy knoll
#

Can a bot publish a news in a news channel? [discord.js]

nocturne grove
#

do you mean an announcement channel?