#development

1 messages · Page 635 of 1

split hazel
#

oh wait it booted!

#

how come it started working now GWeulixThonk

#

oh well, thanks for the help

real helm
#

who help me to do a mention prefix in discord.js?

warm marsh
#

Just check if message.content startswith your bots mention

#

Or prefix

real helm
#

better prefix

warm marsh
#

?

real helm
#

i need better define prefix

#

message.content startswith this no

earnest phoenix
#
var prefix = ‘!’
if (message.content.startswith(prefix + ‘command name here’)){
//run code here
}```
real helm
#

?

#

wtf

#

I need mention prefix, no how to do a command

earnest phoenix
#

Oh ok

real helm
#
if(command === "command name"){
//command code 
}
twilit rapids
#

What version of Discord.js are you using?

#

11.4.2?

real helm
#

11.5.1

#

@twilit rapids 11.5.1

twilit rapids
#

Alright

#

So you want a mention prefix, like @twilit rapids ping

real helm
#

yess

#

and like this /ping

earnest phoenix
#

I can’t get into my laptop rn to show you but start a message collector with a timer of 10000 milliseconds

real helm
#

mention and simbol prefix

#

XD

#

the simbol prefix I have it, but mention prefix no xd

twilit rapids
#

Alright, one second

real helm
#

#

if you prefere DM

earnest phoenix
#

I don’t get what you are trying to do, but ok

real helm
#

I try

warm flame
#

He wants to be able to use his bots mention as his prefix

#

Along side a normal prefix such a /

real helm
#

But don't work XD

twilit rapids
#

He wants it so you can do @some-random-bot ping and some-random-prefix ping.

warm flame
#

^^

real helm
#

@some-random-bot ping

#

mention bot + command

twilit rapids
#

I haven't looked into the change log of 11.5.2 so I am looking if anything in that stuff has changed before I can give an answer.

real helm
#

thanks 😃

earnest phoenix
#

Is it possible to have an embed field with only a name and no value?

warm marsh
#

Nope

twilit rapids
#

You could do ** ** as value to make it look empty.

warm marsh
#

But you can put an invisible character line below.

mossy vine
#

you can make the value a zws

hushed quarry
#

I just set the description of it to achieve that

earnest phoenix
#

The blank space looks untidy though.

stray gazelle
#

@sinful lotus hello buddy

twilit rapids
#

It's a space where there's supposed to be text. It's not really made for an empty space

loud salmon
#

just put a a zws there

twilit rapids
#

** ** works fine

stray gazelle
#

luca said>>>>
Your bot was declined. Reason: Your bot doesn't have a (working) help command or obvious point of entry. Please make sure your bot has a help command or has an explanation in the bot description.

warm flame
#

So make a help command or something

copper cradle
#

then

warm flame
#

¯_(ツ)_/¯

copper cradle
#

^^

earnest phoenix
#

I'll try that, thank you.

stray gazelle
#

but it has help command with command explanation

warm flame
#

Can't use a bot that doesn't have a help or list of commands

copper cradle
#

then re-submit

warm flame
#

Well then you didn't make it obvious what that is

stray gazelle
#

it has

warm flame
#

If they can't find it they can't use it lol. Just mention the help command on your bots description

stray gazelle
#

but in another way

warm flame
#

Well then mention that in the description

stray gazelle
#

lol

#

again 1-2 weeks

copper cradle
#

^

warm flame
#

Yup

stray gazelle
#

hmm...will retry

#

irony is, i was updating help command

#

right now

#

lol

twilit rapids
#

Was the help command unavailable during the submission?

#

If so, you picked a bad time to work on it.

stray gazelle
#

noope

sinful lotus
#

If your bot got declined, better ask the mod that declined it so that you will get more context on why it was declined

#

or at least make it respond when it is mentioned

stark beacon
#

does editing a BOT bump it to last place in the queue?

mossy vine
#

no

#

well

#

we dont know

#

queue is mysterious

stark beacon
#

Haha okay 😛

mossy vine
#

but i highly doubt it does

stark beacon
#

I could see it either way, just wasn't sure

pale marsh
#

Unless you remove your bot its position in the queue is the same

plucky sun
#

Hello, i have a problem :

client.users.get("302502292215693313").send("cc");

And return :

UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'send' of undefined

Can u help me ?

pale marsh
#

Should you await anything?

west spoke
#

@plucky sun python?

plucky sun
#

No discord.js

west spoke
#

Ah

pale marsh
#

Nope python doesn't use semicolons

#

Ah

west spoke
#

I didnt notice that GWfateeSip

plucky sun
#

😢

pale marsh
#

is get() awaitable?

west spoke
#

^

#

Was just gonna ask

pale marsh
#

If so await it first then send() on the result

slender thistle
#

@pale marsh it technically does

#

I mean, they work but they're not required

pale marsh
#

Python?

plucky sun
#

Discord.js

slender thistle
#

Yep, python

pale marsh
#

They work for single line commands iirc in the console

slender thistle
#

Works just fine whenever

pale marsh
#

Even in classes and stuff?

slender thistle
#

In classes, as in?

plucky sun
#

I saw what was wrong. Its good
thanks 😃

slender thistle
#

You mean send a message?

pale marsh
#

I would really advise against sending your logs to a channel

#

If you wanna log certain things like your bot joining/leaving a server, etc then it's fine

warm flame
#

Yeah idk about all logs. But I do have errors sent to a channel so I can easily see if something breaks

pale marsh
#

But if you're gonna log messages or commands I suggest to do that in the console if you don't wanna use a lot of bandwidth/get ratelimited if there's heavy usage on your bot

earnest phoenix
#

@plucky sun this error happened when the bot cant dm a user or when the id isn't valid

#

@woven sundial console log?

#

You mean error?

warm marsh
#

So my bot keeps going restarting when using music command, It used to work before coded bot with sharding.

#

Also the dispatcher doesn't set inside my map. discord.js

quartz hill
#

I'm gonna use Shard, but I have global values.The values ​​must be synchronous.
Because they are used to intervene in SQL.
What can I do?
Is there a detailed example? (nodejs (discordjs))

grizzled spruce
#

So let’ say I’m hosting my bot on Heroku using github. How do I get stuff to save

west spoke
#

Send the things to github

#

I believe

amber fractal
#

well

#

With heroku you cant really have persistent storage

quartz hill
#

was my question too difficult?
No answer.

#

😄

warm flame
#

someone will answer you if they can no need to mention that no one has answered your question in 5 messages

quartz hill
#

ok thx and sorry

earnest phoenix
#

how to use a lot of data as command

#

"prefix" : ["!", "#", "&&"]

#

in json file

#

this doesnt work

#

Json doesn't work like that

#

i read that i can use multiple values for one

#

i just dont know how to

#

create a data per server

#

i cant do that

amber fractal
#

you can

earnest phoenix
#

im currently hosting on heroku and it doesnt allow

amber fractal
#

oh

unique nimbus
#

oof

earnest phoenix
#

ill host on gcloud later

unique nimbus
#

Are you in python?

earnest phoenix
#

js

unique nimbus
#

ah

earnest phoenix
#

y did you ask

unique nimbus
#

Store it as a string
for my bot I did
G = ["G-", "g-", "@uncut widget ", "lazynekoisacutie "]
idk how it is in js

#

but yes

earnest phoenix
#

well you got a point

#

It's the same in js

#

i may store my prefix in file

#

not in config

#

but does json files work like i want?

#

No

unique nimbus
#

Do what I did idk

earnest phoenix
#

^

#

ill do that

#

and i saw i can actually

#

but its like

#

json["prefix"][value]

#

I have multiple prefixes in a json file but i think heroku doesn't give permissions to fs to write file

#

but i dont want it

#

i got my answer thanks

#

Np

onyx summit
#

Why does the dbl website show a different server count every time you reload?

earnest phoenix
#

Because the server count is increasing

#

If someone add/remove the bot

onyx summit
#

okay, Its showing 1785, I reload its showing 1780

#

and its my bot, It did not leave 5 servers, I can see in the logs

earnest phoenix
#

Maybe the cache

#

Ping a website mod

onyx summit
#

just saying but this is the same on every bot

earnest phoenix
#

So ping a website mod, maybe website mods can help you

heady zinc
#

@onyx summit DBL's infrastructure is sharded

#

and sometimes, some shards aren't up to date

#

making the count slightly inaccurate, but still close enough to be reliable

earnest phoenix
#

^ paradox has the rights words

onyx summit
#

is this also the reason why the upvote count is different in the card preview and in the bot page?

heady zinc
#

yes indeed

smoky mica
#

Hey, has anyone used Redis? If so can you briefly explain what it actually does and how to use it? @ me backs so i'm notified, thank you.

west spoke
#

Object storage

earnest phoenix
#

my bote's upvote count was like 15

#

then it decreased to 5 or 6 or less idr

west spoke
#

It probs reset

earnest phoenix
#

pls help I'm using discord.js and I try to make my bot connect to a voice channel and when I try to connect it says '.name is not defined' when it clearly is defined in the discord js documentation. Ideas?

#

console.log(user.voiceChannel.name)

#

ping me if you have a suggestion - I wont get mad

amber fractal
#

Common misconception

#

when it says that

#

voiceChannel is undefined

high lava
#

@earnest phoenix The way you wrote it is NOT defined in the documentation

#

msg.author.voiceChannel isn't a thing https://discord.js.org/#/docs/main/stable/class/User

#

author a.k.a "user" has no voiceChannel properties

#

you want to do msg.member.voiceChannel.name https://discord.js.org/#/docs/main/stable/class/GuildMember

earnest phoenix
#

@high lava Thanks! I was thinking that msg.author would return the name of the person who wrote it, and adding .voiceChannel would return the name of the voice channel that the author is in, if he is in one

also user was a variable - forgot to say that

high lava
#

Well author itself doesn't return anything. You have to use its properties to get anything out of it. But author doesn't have the .voiceChannel property so you wont be able to get any Voice info out of it

earnest phoenix
#

Oh ok

#

wait it still says that .name isn't defined, even when I put .member

high lava
#

can you get .id?

#

Also, are you IN a voice channel?

#

You have to be in one before it can return a name

amber fractal
#

Technically author returns a User object*

earnest phoenix
#

no, but that shouldn't matter. It shoud return undefined instead of a crash

amber fractal
#

Well

#

unhandled errors can crash the program

high lava
#

If you don't handle it, then there's nothing you can do

#

What's the code of the command you're using?

#

If it's not too big

earnest phoenix
#

discord js

#

its a simple console.log()

high lava
#

in what though?

earnest phoenix
#

now im confused

#

it works now, but you were right

#

it does crash if it cant read the name of the voice channel

#

thanks!

high lava
#

np

#

Although I'm still confused about how where you're using console.log, but as long as it's fixed. lol

earnest phoenix
#

Im using console.log() as a temporary debuging method. I will remove it if it works. 😀

high lava
#

Gotcha. I'm guessing you don't have a check to see if the user is in a channel first though. Try doing that to avoid errors if possible.
It should be as simple as ```js
if (!msg.member.voiceChannel) return msg.channel.send('Please connect to a Voice Channel.');

earnest phoenix
#

K

#

also, one more thing. I put a .catch() block with another console.log() and this is what it did:

high lava
#

Install FFMPEG

earnest phoenix
#

wha?

high lava
earnest phoenix
#

with npm install FFMPEG?

amber fractal
#

no

high lava
#

You'd have to do it in windows

earnest phoenix
#

I can't. No admin perms

high lava
#

Oh. well that's a rip

#

It wont work unless you install FFMPEG

earnest phoenix
#

It says promise rejection warning. So what I think is happening is that my catch block isn't doing what it's supposed to

idle basalt
#

it just says that

high lava
#

The real problem is that FFMPEG isn't installed and defined in the PATH of windows

earnest phoenix
#

K one sec

#

werid. I dowloaded ffmpeg via npm install ffmpeg in the exact folder where I run my API. It doesn't work

#

ok well I have to go. Good Night

obsidian shoal
idle basalt
#

i think most people use regex for mention prefix though

balmy lantern
#

hey um

#

patreon?

warm flame
#

What?

pearl jasper
#

How to make the profile float

pallid zinc
#

Can I set size of .setThumbnail

amber fractal
#

Chances are if it isnt in the docs

#

no

sinful lotus
#

I doubt that you can get it as well.

#

unless its user profile pictures

pallid zinc
#

Ok

#

Thanks

storm lion
#

Hello Mods?

warm flame
#

Yes?

storm lion
#

whats is Guild IDs

warm flame
#

On the website? Like when filling out your bot application?

storm lion
#

no

warm flame
#

Then what do you mean?

storm lion
#

Do not register the bot to add it to your page

warm flame
#

What?

#

Also this isn't development so go to #general please

earnest phoenix
#

Hey, so im new at using enmap as a db for my bot and when i run a guild prefix command my default prefix is undefined, i would really appreciate help from you guys.

twilit rapids
#

I think you have a default settings somewhere?

#

Like, when it joins a guild it sets the prefix for it

earnest phoenix
#

Yea

twilit rapids
#

Change your code, so it reacts to a prefix in your config, then you can use eval to set the prefix for every guild into the default settings. Then change the code again so it reacts to what is is supposed to

copper cradle
#

^

earnest phoenix
#

Change my code?

#

Like the prefix?

copper cradle
#

yes

#

this happened to me

#

(not using that db)

#

but I did that and it worked just fine

twilit rapids
#

Yeah, you now probably have guildSettings.prefix as prefix, change that to /config.prefix

copper cradle
#

then do ```js
client.guilds.forEach(guild => /Whatever the code for adding something to the db is/)

ofc if you're using JS (I think)
and if you named your client client
twilit rapids
#
client.guilds.forEach(g => client.guildSettings.set(g.id,clien. defaultSettings));
copper cradle
#

ew

#

use a code block

#

pls

#

thx

#

ily 3000

twilit rapids
#

.>

earnest phoenix
#

You mean /config.prefix = guildsettings.prefx

#

prefix*

twilit rapids
#

No, You probably have this somewhere

 const guildConfig = bot.guildSettings.get(msg.guild.id)
earnest phoenix
#

mm

#

Let me Check

twilit rapids
#

And then somewhere

guildConfig.prefix
#

e.g.

  if (msg.content.indexOf(guildConfig.prefix) !== 0) return;
copper cradle
#

^

earnest phoenix
#

let configfile = client.guildConfigurations.ensure(message.guild.id, defaultGuildConfigurations)
And i used configfile.prefix

twilit rapids
#

Yeah alright

earnest phoenix
#

Not the same way as u defined it

idle basalt
#

!msg.content.startsWith(guildConfig.prefix)

#

simpler

earnest phoenix
#

i used that

twilit rapids
#

then change configfile.prefix to client.config.prefix (You must have a config file set up and defined)

#

Then run the eval to change it in every server

#

Then replace it with configfile.prefix again

copper cradle
#

just use a goddamn string

#

'$'

#

and you're good to go smh

earnest phoenix
#

lol

#

Ok i get it now

#

aaah fuck I don’t have an eval command

twilit rapids
#

In how many servers is your bot

earnest phoenix
#

1

copper cradle
#

lol

twilit rapids
#

Do you have it set up that when it joins a guild, it set's the guild settings to the default settings

copper cradle
#

lmfao

earnest phoenix
#

Ye

copper cradle
#

that emote

twilit rapids
#

Then just kick it

#

and re add it

#

done

earnest phoenix
#

Kick what

twilit rapids
#

the bot

earnest phoenix
#

The bot?

copper cradle
#

the bot

twilit rapids
#

the both

copper cradle
#

lmao

earnest phoenix
#

@twilit rapids how do i define client.config.prefix?

twilit rapids
#

No no, kick the bot and re add, don't change any of the code

earnest phoenix
#

Oh ok

twilit rapids
#

Since it's only in one guild

earnest phoenix
#

The eval command wont run because the prefix is still undefined

#

@twilit rapids

twilit rapids
#

Do you have it set, so when the bot joins a guild, it set's the guild settings to the default settings?

#

In your guildCreate event.

earnest phoenix
#

hmm nope

twilit rapids
#

Then do that

#

That also helps for future guilds

earnest phoenix
#

Ah okay

twilit rapids
#

Then, when that is done, kick the bot and re-add it to your server

#

And then you are all good to go

earnest phoenix
#

hm how do u reset to default when the bot joins the server

twilit rapids
#

In the guildCreate event, set the guild settings to the default settings

earnest phoenix
twilit rapids
#

yeah

earnest phoenix
#

nice

#

@twilit rapids its still undefined

twilit rapids
#

Show the code of the guildCreate event and your message event.

earnest phoenix
#

client.on('guildCreate', (guild)=>{
client.guildConfigurations.ensure(guild.id, defaultGuildConfigurations)
client.guildConfigurations.set(guild.id, defaultGuildConfigurations)
})

twilit rapids
#

then, did you kick the bot from your guild and re added it?

earnest phoenix
#

can i store data in []

#

let blabla = [];

slender thistle
#

That's possible

sinful lotus
#

arrays are designed for that

earnest phoenix
#

well because i cant store data in other ways due to my hosting

#

ill try this then

sinful lotus
#

but keep in mind that that wont store things permanently

quartz hill
#

I am writing again. I'm sorry.
A little urgent.
I'm gonna use Shard, but I have global values.The values ​​must be synchronous.
Because they are used to intervene in SQL.
What can I do?
Is there a detailed example? (nodejs (discordjs))

sinful lotus
#

Shard?

quartz hill
#

yes

sinful lotus
#

What do you mean by Shard first

mossy vine
#

i think they mean sharding

quartz hill
#

sharding yes

sinful lotus
#

oh ok so sharding

#

what is your problem with sharding right now?

quartz hill
#

I'm new to this.
I would use sharding but couldn't find enough resources.

split lantern
#

What type of sharding are you using

quartz hill
#

I will use. I don't even know what to use yet.
I am stuck because my global values ​​are very high and I have sql.

#

What do you recommend I do?

split lantern
#

You can use internal sharding wich means everything still runs in 1 process

quartz hill
#

Yes it works but I want to use sharding to solve the slowness.
For example, 1 shard per 100 guilds

sinful lotus
#

tbh sql supports sharding

#

also sharding means more memory usage

#

do you have a server that can handle sharding?

quartz hill
#

Right now, I don't intend to increase the number of shards too much.
I change the server if there is a problem. I can switch to paid servers.

sinful lotus
#

I see, but I would clear one misconception

#

javascript is not slow

#

a single process can handle more than 4k guilds

#

if you have issues with slowness, and the guild count on process is not even close to 2.5k

#

I would recommend reviewing your code instead

earnest phoenix
#

its not slow, node is simply resource heavy

#

yes or the cpu/ram of the host

#

also get rid of the habit of using free servers for something public

sinful lotus
#

yes thats another factor

quartz hill
#

It may be, but I want to solve it already. For the future.

sinful lotus
#

If you want to solve the issue of slowness

earnest phoenix
#

what is the latency of your bot?

sinful lotus
#

this is the things you need to ask your self.

  1. am I doing too much loops?
  2. am I doing a lot of un-needed things? (basically stuffs that you do even you dont need to)
  3. Is my host sufficient for my bot?
  4. Am I doing a resource heavy setInterval? or forgetting an interval?
  5. Is my bot's internet fine?
#

Node.js Runs on a single thread

earnest phoenix
#

Latency is the amount of time it takes for an event to be performed. @earnest phoenix

#

yes

sinful lotus
#

a simple

while (true) console.log('1')

will break your bot functionality

#

it will not execute any code because its stuck there

earnest phoenix
#

causing delay if internet is bad

#

Oh, I'm dumb. You were asking what his bot's latency is, not what the definition is. RAODfail veryfastpats

quartz hill
#

When a bot is loaded in a guild, there is a slight slowdown in the other.
The reason might be sql queries but I wanted to try using shard.

#

The bot's internet is no problem. but sql ...

earnest phoenix
#

dont use free servers, they underperform and are not made to run bots, rather they are there to run small websites

sinful lotus
#

shard wont fix that

#

whats your host?

quartz hill
#

heroku

sinful lotus
#

just move the bot in paid if thats the case

#

also another thing, how many sql you do on join?

quartz hill
#

A command has a min 3-4 sql query.That's one of the reasons for slowing down when there's a very guild query.

earnest phoenix
#

which is, again, because you are using free servers

quartz hill
#

yes

pale marsh
#

3-4 queries per command is a bad practice tbh

sinful lotus
#

minimize your sql queries

pale marsh
#

If you want to check a value then cache the data in memory, then only call update queries when those values change

sinful lotus
#

if possible just use one query

quartz hill
#

not possible

#

optimized

#

All values ​​received are subject to change.

sinful lotus
#

then we cant do anything about it,
4 sql statements is too much for a single event

#

either do some caching

#

then background storing

#

or optimize the code itself

#

its impossible that you cant optimize it in my opinion

quartz hill
#

hmm
I'il check back.

quartz kindle
#

also check if you're able to use transactions instead of individual queries

#

and do it in async if you can

real helm
#

Hello

#

How I put a gif in the footer of the embed

sinful lotus
#

put the picture of gif as link

real helm
#

I have the link

earnest phoenix
#

.setFooter(`TEXT HERE`, 'IMAGE LINK HERE')

real helm
#

mmm

#

@earnest phoenix bro

#

you are allowed to change my name?

earnest phoenix
#

Yes, you can send me the name you want in DM or in #general.

earnest phoenix
#

Or boost the server

real helm
#

Hello
I have a question
I export my Glitch app to Github
And I have a question, Glitch do automatic repos?

sinful lotus
#

no it just gets the project from github

uneven rover
#

glitch is also a repo

sinful lotus
#

Glitch feels like it just saves your project

#

not really a git repo

earnest phoenix
#

can anyone help me implement a custom prefix system in my bot?

pale marsh
#

What library are you using?

earnest phoenix
#

discord.js

pale marsh
#

Are you using its command manager?

earnest phoenix
#

yes

#

i think

#

im new to this so

pale marsh
earnest phoenix
#

i mean like

#

people can choose their own prefix for the bot

rustic obsidian
#

That is custom prefix.

earnest phoenix
#

okay, ill give that a watch

rustic obsidian
#

Custom prefix means that the user in a server, could set a prefix whatever he/she prefers

sinful lotus
#

Actually

#

I dont recommend The Source Code myself

earnest phoenix
#

oof

rustic obsidian
#

TSC is more for basic stuff imo.

sinful lotus
#

I would recommend this

earnest phoenix
#

uwu

#

djs easy

sinful lotus
#

I doubt you would have problems on KeyV

earnest phoenix
#

would i put the example in the main file or

rustic obsidian
#

Well yeah if you understand how to c0de

earnest phoenix
#

?

sinful lotus
#

keyV is just like a map

earnest phoenix
#

@rustic obsidian yeah but js is very easy for beginners

sinful lotus
#

and that would depend on your code

earnest phoenix
rustic obsidian
#

It is easy yes

sinful lotus
#

I cant just say slam that on your code

rustic obsidian
#

if you understand

#

But ik what you mean.

earnest phoenix
#

Everyone can undersand js

rustic obsidian
#

If you're into coding atleast, then yes

#

ok i'm being a real dick rn

earnest phoenix
#

no :'(

rustic obsidian
#

No?

#

Ok

sinful lotus
#

epp we are getting quite offtopic now

earnest phoenix
#

Oh wth this is not off-topic

sinful lotus
#

the answer I gave disappeared

#

just read above if you want to know the answer

lilac nymph
#

u don't necessarily need to use anything to store prefixes beyond a json file

#

it's only if you need to run the bot on a server that it's useful to have a proper database

#

KeyV is just a convenient way to write key/value pairs to a database

sinful lotus
#

JSON file as storage is never been good

#

If JSON was recommended for read and write I would be using that

#

but the problem it isnt

earnest phoenix
#

use mysql or mongodb

sinful lotus
#

so just use a database, there are lots to choose from

lilac nymph
#

i just started using mongodb

#

is mongodb any good?

sinful lotus
#

common choice for no sql db

lilac nymph
#

are there any other ones which are free

#

i have no money

earnest phoenix
#

db are free

sinful lotus
#

DBs are free

warm marsh
#

What is the best language to format a codeblock: ```lang ``` with for doing a queue?

sinful lotus
#

except some

lilac nymph
#

i mean cloud ones

#

mongodb has atlas

earnest phoenix
#

@warm marsh css ?

sinful lotus
#

you dont have a server?

lilac nymph
#

heroku lol

warm marsh
#

Ok

lilac nymph
#

the worst of the worst

warm marsh
#

Thanks!

sinful lotus
#

tbh that limits what you can do

#

just use what you have right now you dont have a choice

earnest phoenix
#

you can find a lot of exemples on google, and pick up one for codeblock

sinful lotus
#

mongodb is not that bad

lilac nymph
#

lol

sinful lotus
#

its fine on its own right

lilac nymph
#

i wonder if they will approve my bot this year

#

i want to see if the database crashes

earnest phoenix
#

db doesn't crash

#

db can be corrupted but very very rarely

lilac nymph
#

i think mongodb has a bunch of issues

#

according to some people

sinful lotus
#

just use mongo db

#

its not like it will crash on you or something

earnest phoenix
#

^

sinful lotus
#

if mongo db is bad or horrible

#

some big bots wont even use it

#

but the fact some big bots use it

#

means its fine on its own right

lilac nymph
#

how do people actually afford to maintain servers for discord bots

sinful lotus
#

I paid for it the first months it was live

wild thorn
earnest phoenix
#

you can't alter how anything displays on end user's screen

#

simply don't include a thumbnail

#

it doesn't contribute to anything anyways

wild thorn
#

oh well, I was hoping you could set some sort of height restriction

mossy vine
#
//defining the guild, imported from another file
const guildSchema = new mongoose.Schema({
    id: String,
    channel: String,
    tracking: Array,
    messages: Array
})

const guild = mongoose.model('guild', guildSchema)

module.exports.guild = guild
//use code
let g = new guild({ id: guild.id, channel: '589092182657335433', tracking: ['321242389106786314'],  messages: [ m.id ]})

throwing guild is not a constructor

#

no clue why

#

worked with an extremely similar example when the schema was in the same file as its used in

earnest phoenix
#

new guild(. You don't just create a guild object...

mossy vine
#

im not trying to create a discord guild

#

this is mongoose

earnest phoenix
#

no ik you're not, but you get the guild object, not create one

#

aah

young girder
#

Does anybody in here plays roblox I have a question

earnest phoenix
real helm
#

Hello

#

What prefix are recomendable?

earnest phoenix
#

For this server, a mention would be best.

#

Try ?@{"}:{@{!@}1'£. good prefix

mossy vine
#

can bots fetch and interact (specifically: editing and deleting) with messages that have been sent before the bot came online?

slender thistle
#

Yes

mossy vine
#

so i would just use my librarys regular message fetching function, and i could interact with the message object it returns?

slender thistle
#

Yes

untold matrix
#

This might be a retarded question but I cant seem to find out why is it saying (JS) Identifier Expected

                            ^^^```
sinful lotus
#

probably some syntax problem

#

oh wait

untold matrix
#

At where the errors are

mossy vine
#

that doesnt seem right at all

sinful lotus
#

why you have a DOT there

quartz kindle
#

and wrong type of brackets/paretheses

untold matrix
#

Cause the directory of the file is response.data.stocks.1.description

mossy vine
#

plus if stocks isnt a function it wont even work

untold matrix
#

Im using axios

mossy vine
#

then do

#

response.data.stocks[args[0]].description

#

assuming stocks is an array

#

and args[0] is the element you want

untold matrix
#

Aight Ill try thanks

#
if (message.content.startsWith("!stock")) {
        let args = message.content.split(" ").slice(1);
        axios.get("https://api.torn.com/torn/?selections=stocks&key=1vpH5bIwSDLfkwX7")
            .then(function (response) {
                console.log(response)
                console.log("StockID Command Executed")
                let q = response.data.stocks.[args[0]].name
                let w = response.data.stocks.[args[0]].acronym
                let e = response.data.stocks.[args[0]].director
                let r = response.data.stocks.(args[0]).current_price
                let t = response.data.stocks.(args[0]).market_cap
                let y = response.data.stocks.(args[0]).total_shares
                let u = response.data.stocks.(args[0]).available_shares
                let i = response.data.stocks.(args[0]).forecast
                let o = response.data.stocks.(args[0]).demand
                let p = response.data.stocks.(args[0]).requirement
                let a = response.data.stocks.(args[0]).description

                message.channel.send({ embed: x })

                    .catch(function (error) {
                        console.log(error)
                    })

                    .finally(function () {
                    });
            })
    }
});
#

This is the whole command btw

mossy vine
#

yeah youve got some editing to do there

#

also if you arent even using .finally then theres no reason to have it

untold matrix
#

Aight

mossy vine
#

in discord.js does presenceUpdate fire when someones status (online/idle/dnd/offline) changes?

#

appearently yes

indigo geyser
#
      await asyncio.sleep(10)
      await client.change_presence(activity=discord.Game(name='e!help :)'))
      await asyncio.sleep(10)```
This is too fast for be approved?
slender thistle
#

Why not a while loop with asyncio.sleep

#

At least make it 15-20

#

Hell, 30 to be safe

half spear
#

Here is a weird question but is there a way I can take my bots member and server count and display it on a website?
So I can go onto a website and it shows me the member and server count live.
My bot is using discord.py

earnest phoenix
#

sure, turn your app into a web app

#

this will allow you to host the bot and the website in the same environment, allowing you to choose which data you expose to the website

half spear
#

how would I go around doing that?

earnest phoenix
#

research it

#

i don't use python so i wouldn't know

half spear
#

ok thanks for the help ill research this

earnest phoenix
#

me bot is here!!!

#

yayy!

#

sry

#

(:

#

@twilit rapids yes i did it’s still undefined

indigo geyser
#

Tnks Soup

slender thistle
untold matrix
#

xyber your solution worked perfectly thanks

mossy vine
#

👍

earnest phoenix
#

Hello, I am trying to connect my bot to a voice channel, but it says that ffmepeg is not installed, even though it is and I installed it with npm install ffmepeg-binarys and npm install ffmepeg-static like it says in the discord.js documentation

#

try @latest on the end

#

ok wait one sec

#

it looks like its taking a while to install. Ill be back in 5m

#

Okay

#

its been 10 mins fam

#

who can help me with canvas

#

Js? @earnest phoenix

#

I can help you if its in js

pallid zinc
#

Just ask

earnest phoenix
#

hi

#

im back

#

so how can i add ffmpeg to the PATH off my computer

sinful lotus
opaque eagle
#

Imo installing ffmpeg on Windows is a pain in the ass

glacial dew
#

true story

#

never going back from lavalink

opaque eagle
#

true story

#

never going back to windows

#

It'd prob be easier with that wsl shit

earnest phoenix
#

I just downloaded it and added it to the PATH of my computer

#

I did it without admin perms. Illuminati Confirmed 🔺

#

Wait thats because I only did it for my account, but then why does it still say 'FFmpeg not found' when I clearly installed it on my account, and the program is looking within my account?

real helm
#

Hello

#

Who know that how I do a server info with ID arg?

sinful lotus
#

fetch the guild using its id

#

then you can get access on its properties

real helm
#

?

sinful lotus
#

get the guild using its id

#

you have the id arg

#

all you need to do is to get the guild via its id arg in client.guilds

copper cradle
#

He's not understanding, I would help in spanish, but if I move to #memes-and-media someone will send us here and 🔁

slender thistle
sinful lotus
#

yes I think thats the best course of action as well

grave pilot
#

Uhm why is messages.react not a function?

mossy vine
#

.fetch is a promise

#

you need to await it

#

and then you can handle the message it returns

grave pilot
#

Still aint workin

sinful lotus
#

what do you want to do

#

could you elaborate?

#

also thats wrong

#

its better to do this like

grave pilot
#

I am just trying to make it react to the message

sinful lotus
#

but you didnt do a reaction code on resolved promise

grave pilot
#

Ill make it react

#

Sec

sinful lotus
#

I dont see any react there yet

grave pilot
#

Still aint working

sinful lotus
#

what is your code

grave pilot
#

Its logging the message object but aint reacting

#

Sec

#
                    let reactionMessage = await reactionMessageChannel.messages.fetch(collected);
// It is a valid id, it logs in console (https://i.imgur.com/OSTgwJW.png)
          await reactionMessage.react(reactionCollected);
#

Yes it is running async

sinful lotus
#

what is reactionCollected

grave pilot
#

Its a reaction

#

ReactionEmoji I think to be exact

#

I can make it consoe log if U want

sinful lotus
#

what reaction ?

grave pilot
#

😃

#

Its logging a emoji

sinful lotus
#

try doing a simple code first

#

try to do msg.react() so that it will react to your eval msg

#

and see if that works

grave pilot
#

I see no reason for it to not work tho

sinful lotus
#

cant test it on my bot due to the fact I dont cache emojis

#

unicode emojis works fine to me

grim pond
#

Can we add a bot?

earnest phoenix
grim pond
#

ok then you

#

What is required to add a bot on the incomplete bot list?

grim pond
#

I did not understand

earnest phoenix
grim pond
#

You don't understand me, I think my brother, I'm an angry man Turkish petty officer

#

I don't know?

slender thistle
earnest phoenix
#

I know what you mean. You want to know more about the requirements to add a bot to DBL; however, that is more appropriate for #general.

grim pond
#

Look, the only thing left of the glitch ub site is where can I open it?

#

By the way, my English is how I am normally Turkish

earnest phoenix
#

I am failing to understand what you are asking. I would advise requesting for assistance in #memes-and-media with the language you speak.

grim pond
#

What is the reason I can't add DBL Bot but I can't add it for some reasons?

earnest phoenix
rugged kelp
#

How to fix this ?

limpid raptor
#

Let me see your code

rugged kelp
#

Ok

limpid raptor
#

You must use 2 parameters

#

For exemple js .addField("The title of the field", "The description of the field")

#

Oh no 😂

rugged kelp
#

🤦

#

And don t say : You need to created a channel with name Incidents

#

:/

limpid raptor
#

🤔

#

Ooooh

#

I understand

rugged kelp
#

I need to . ?

#

incident.channel.send

limpid raptor
#

One of your var isn't valid

#

um

rugged kelp
#

incidentchannel.send{banEmbed};

limpid raptor
#

If the error is "RichEmbed field values must not be empty"...

rugged kelp
#

oh

#

let banEmbed = new Discord.RichEmbed()

#

with ; ?

#

let banEmbed = new Discord.RichEmbed();

#

no

limpid raptor
#

Your bUser isn't defined when you type the command

rugged kelp
limpid raptor
#

no

rugged kelp
#

oooh

#

wait

limpid raptor
#

Restart the bot and type ">ban @Anybody"

rugged kelp
#

down ?

limpid raptor
#

What da fuck

#

xD

rugged kelp
#

xD

limpid raptor
#

Just.. the let bUser = message.mentions.users.first() || message.guild.members.get(args[0])

rugged kelp
#

Done : )

#

I rezolve

#

xd

limpid raptor
#

Okay

rugged kelp
#

xd

limpid raptor
#

:D

rugged kelp
#

= ]

#

Oh

#

Another problem

#

owo

#

with kick command =- ]

limpid raptor
#

Always the same thing

#

Send your code

rugged kelp
#

ok

#

2 sec

limpid raptor
#

let kUser = message.mentions.users.first() || message.guild.member(args[0])

rugged kelp
#

without message.guild.member

#

?

limpid raptor
#

Yeah

rugged kelp
#

K

#

2 sec

limpid raptor
#

And if it hasn't reason, you havn't do that

slender thistle
#

Does guild.member even exist HYPERLUL

rugged kelp
#

xD

#

Oh

limpid raptor
#

🤔

rugged kelp
#

: )

#

let kUser = message.mentions.users.first() || message.guild.member(args[0]); or without ; ?

#

without

#

with

#

xd

limpid raptor
#

As you want

rugged kelp
#

k

#

2 sec to test : )

limpid raptor
#

Personnaly i never use ; x)

rugged kelp
#

wow

#

:/

#

...

limpid raptor
#

The reason isn't provide

#

🤔 🤔 🤔

#

😂

#

Yes

rugged kelp
#

kuser.... is not a function xD

limpid raptor
#

'Cuz message.guild.member(kUser).hasPermission("nanana")

rugged kelp
#

ok

#

SO

#

it's

#

wait

#

xD

limpid raptor
#

xD

rugged kelp
#

where ?

#

=]

limpid raptor
#

?

rugged kelp
#

where to put ``message.guild bla bla xD

limpid raptor
#

Where you has your "kUser.hasPermission"

rugged kelp
#

here

limpid raptor
#

Yeah

rugged kelp
#

if(message.guild.member(kUser).hasPermission("MANAGE_MESSAGES")) return message.channel.send("**Aceasta persoana nu poate primii kick :cowboy:**");

#

It's good ?

limpid raptor
#

Yes

rugged kelp
#

Ok

#

Thanks

#

wait 2 sec xD

limpid raptor
#

always xD

#

Wouhou a friend request 🎉

rugged kelp
#

: )

#

Yes

#

Because you help me : )

#

xD

limpid raptor
#

:)

rugged kelp
#

Oooof

#

YEAAH

#

: )))))

limpid raptor
#

😂

rugged kelp
#

Thanks smirk

limpid raptor
#

Bitte ~

rugged kelp
#

limpid raptor
#

😂

rugged kelp
#

it's good ?

#

No ?

#

@limpid raptor

#

Noh is not good = ]

earnest phoenix
limpid raptor
#

Wait i must go

rugged kelp
#

K

limpid raptor
#

Why it shoudn't work ? :)

rugged kelp
#

How to fix this ? think3d

quartz kindle
#

you're sending an empty message

rugged kelp
#

and how to add message ?

#

@quartz kindle

quartz kindle
#

give it something to send

#

what do you want to send?

molten yarrow
#
if(!message.member.hasPermission("ADMINISTRATOR")) return message.reply("Sorry, you don't have permissions to use this!");

    let text = args.join(" ");
      message.delete();
      message.channel.send(text);
rugged kelp
#

?

quartz kindle
#

estas tentando escrebir una messagen vacia, no estas mandando nada para discord

#

you're not sending anything to discord

rugged kelp
#

?

#

And how to add message

quartz kindle
#

well, what do you want to send?

rugged kelp
#

with: Use >Say (message)

thin ledge
rugged kelp
#

Yes

#

...

#

And he don t have with message

#

🤦

#

Nevermind

#

I fixed

earnest phoenix
#

Does anyone know why a bot could constantly be restarting itself at random times and also not restarting? It is running on a VPS which is definitely not faulty at all and even though the VPS is online, the bot isn't. When we restart the VPS, the bot comes online but doesn't respond to any commands, but it sometimes will respond to a ping with over 50k ms. After it has been online for a while, it will switch itself off while the VPS is still online and even while the bot is appearing offline, it sometimes sends extremely delayed responses to the ping command with over 100k ms. This does not happen all the time nor has it happened before yesterday; yesterday was the first time we experienced it and it was around this time, I don't understand how this could be two days in a row at the same time. It also is definitely not the code because we are running the exact same files with the exact same code on a test bot which is on a separate host.

twilit rapids
#

Are there any errors logged in the console?

earnest phoenix
#

No

south sonnet
#

@earnest phoenix hard to tell since idk the code of the bot.
I have a thing in mind tho, does the bot work decently when you have a vps connection open and running? @earnest phoenix

earnest phoenix
#

When it is online and stable, it is 100% with pings of less than 100ms.

warm flame
#

i've had issues like that and normally its due to blocking code and or the bot being spammed somewhere

#

might not apply here though

earnest phoenix
#

Maybe if I provide a link to view more info about the bot, it'd be easier to help.

rugged kelp
#

How to add message ?

earnest phoenix
#

@earnest phoenix which region is it hosted in

#

it could be that discord servers are having a shit in the region

#

you should test exchanging data with other websites other than discord

#

We tried running the bot on multiple hosts in which each host is in a different region.

#

same result?

#

Same issue occurred.

rugged kelp
#

Hey

earnest phoenix
#

it's code that's faulty probably

rugged kelp
#

Who help me please? : )

earnest phoenix
#

We have a test bot as well and the test bot is running the exact same files with the exact same code which is perfectly fine.

twilit rapids
#

@rugged kelp the message you are trying to send does not have any content.

earnest phoenix
#

dunno if it's relevant, however discord can increase ratelimits for users that hit them very often

#

hence why they're dynamic

#

could be that

rugged kelp
#

And what code for this ? @twilit rapids

earnest phoenix
#

That's a good point.

twilit rapids
#

What do you mean?

rugged kelp
#

For message

earnest phoenix
#

But would that prevent it from turning on?

twilit rapids
#

There is no code to send an empty message.

rugged kelp
#

idk

#

i need to send

#

Use >Say (Message)

#

How ?

south sonnet
#

@earnest phoenix does it have a visual interface?

earnest phoenix
#

not exactly sure, maybe there's something about reconnecting to the gateway that clears the ratelimit?

south sonnet
#

Follow up question from my stuff above^^

earnest phoenix
#

unlikely, but possible

#

No visual interface. We use an SFTP to manage files and there is a dashboard to restart the VPS and see stats.

south sonnet
#

Does it record the vps or something like that?

earnest phoenix
#

It shows how many resources we are using, that's it.

west spoke
#

@rugged kelp

Split message (prefix + command) then get the rest by getting the splitted message by var[1]

earnest phoenix
#

its irrelevant, the issue occurs over multiple hosts, and the dashboard is for the machine, not the process

#

Yeah

rugged kelp
#

@west spoke For me is Chinesse = ] ] ] ]

#

China

#

xD

west spoke
#

Dont care it's simple coding

earnest phoenix
#

if there's different behaviour with same files but different accounts, it's more than likely discord did something on their end to the account

rugged kelp
#

Idk how to put : (

earnest phoenix
#

you should try emailing them

rugged kelp
west spoke
#

message.content.split(prefix+command)[1]

#

For py

earnest phoenix
#

granted there's 80% of chance that the discord support team won't help you and will redirect you to somewhere else but it's worth a shot

rugged kelp
#

for .js

west spoke
#

Idk about js cause I don't use js

#

But I still try to help

rugged kelp
#

ok

earnest phoenix
#

We've sent an email but no response yet. Though, similar bots have reached an extreme amount of rate limits frequently and are running fine.

#

🤷 i can't explain that, pretty much no one knows how discord's backend works however it's speculated that first there's an automatic system to increase ratelimits then it's done manually

#

It's really confusing, hopefully Discord will be able to help. Thanks anyway.

#

big bots like rythm, dyno and mee6 have their ratelimits modified to fit the amount of usage, don't know for any other ones

rugged kelp
#

@west spoke You found ? SuperThinking

west spoke
#

No, I said I dont use js

rugged kelp
#

oh

#

ok

west spoke
#

There is something called Google btw

rugged kelp
#

😦

#

I don t found

#

:/

west spoke
#

Try again

split hazel
#

@rugged kelp What do you want to do?

rugged kelp
#

😦

#

How to add mesage

#

here

split hazel
#

Send message?

rugged kelp
#

Yes

split hazel
#

message.channel.send(`message`)

#

but i see youre trying to make a 'say' command

rugged kelp
#

Yes

#

Really ?

#

This is code ?

#

-_-

#

wow

split hazel
#

this should work if you set your args right

rugged kelp
#

K

#

I type >Say s

#

@split hazel Why you blocked me ? :/

molten yarrow
#

@rugged kelp i give u code above??? it works fine...

rugged kelp
#

@molten yarrow YES give me the code

#

Because i don t know : /

rugged kelp
#

What ?

#

``if(!message.member.roles.some(r=>["Administrator", "Moderator", "Admin", "Mod", "Owner"].includes(r.name)) )
return message.reply("Sorry, you don't have permissions to use this!");

let text = args.join(" ");
  message.delete();
  message.channel.send(text);``
#
      return message.reply("Sorry, you don't have permissions to use this!");

    let text = args.join(" ");
      message.delete();
      message.channel.send(text);```
#

And i need to send a message with: Use >Say (Message)

molten yarrow
#
    if(!message.member.hasPermission("ADMINISTRATOR")) return message.reply("Sorry, you don't have permissions to use this!");

    const sayMessage = args.join(" ");
      message.delete();
      if(!sayMessage) return;
      message.channel.send(sayMessage);
rugged kelp
#

And message ?

molten yarrow
#

?

rugged kelp
#

And what message ?

molten yarrow
#

the message u type?!

#

like "ur Prefix say "ur message"

rugged kelp
#

yes

#

how ?

molten yarrow
#

what u mean how? 😂

rugged kelp
#

🤦

#

how to send message

#

with: Use > asdada

molten yarrow
#

use ur keyboard? xD

rugged kelp
#

...

#

haha

peak quail
#
embed.author.icon_url: Not a well formed URL.``` What does this mean???
shy turret
#

discord.js

    if (message.content.startsWith('s)filewrite')) {
      prefix = "s)filewrite"
      args = message.content.slice(prefix.length).split(' ');
      arg1 = args[1]
      prefix = "s)filewrite " + arg1
      args = message.content.slice(prefix.length).split();
      fs.writeFile(arg1, args, function(err) {
      message.delete(message)
      if (err) throw err;
      });
      return
    }

When I make a file using this command, it adds a extra space to the beginning. How do I fix it?

mossy vine
#

@shy turret args = message.content.slice(prefix.length).trim().split(' ')

shy turret
#

so..

#
    if (message.content.startsWith('s)filewrite')) {
      prefix = "s)filewrite"
      args = message.content.slice(prefix.length).trim().split(' ')
      arg1 = args[1]
      prefix = "s)filewrite " + arg1
      args = message.content.slice(prefix.length).trim().split(' ')
      fs.writeFile(arg1, args, function(err) {
      message.delete(message)
      if (err) throw err;
      });
      return
    }
mossy vine
#

yes

#

that should work

#

.trim() removes any whitespace at the start and end of a string

shy turret
#

wait no

#

not for the first opne

#

only the second one

#

thx

#

but args make hi,hi on the file if i run s)filewrite hi.txt hi hi

#

one argument is fine but 2 or more isn't

#

let me try soemthing

#

something*

#

nope i failed

#
    if (message.content.startsWith('s)filewrite')) {
      prefix = "s)filewrite"
      args = message.content.slice(prefix.length).split(' ');
      arg1 = args[1]
      prefix = "s)filewrite " + arg1
      args = message.content.slice(prefix.length).trim().split(' ')
      fs.writeFile(arg1, args, function(err) {
      message.delete(message)
      if (err) throw err;
      });
      return
    }
#

i fixed it

#
    if (message.content.startsWith('s)filewrite')) {
      prefix = "s)filewrite"
      args = message.content.slice(prefix.length).split(' ');
      arg1 = args[1]
      prefix = "s)filewrite " + arg1
      args = message.content.slice(prefix.length).trim().split()
      fs.writeFile(arg1, args, function(err) {
      message.delete(message)
      if (err) throw err;
      });
      return
    }

Final code

stark beacon
#

is the typical approval queue a few days or is it like a couple of weeks? 😛

unique nimbus
#

Its 1-2 weeks

stark beacon
#

ahh coolio

grim aspen
unique nimbus
#

It will take time especially as its summer holidays

stark beacon
#

yea yea no worries was just curious! Must have glazed right over that part in the FAQ

warm flame
#

]]faq 2 -clean

covert turtleBOT
#
Frequently Asked Questions 📜

Click the link to get more information on the question:
2) How long is approval?

earnest phoenix
#

um... one question. Does my description have to be in english?

mossy vine
#

No

#

However it is helpful to provide an english translation of it

#

So that moderators can review it easier

earnest phoenix
#

i should yeah. thanks

barren brook
#

I need help trying to get an generate a invite link by finding a channel This is what i have so far ```
let invitechannel = bot.guild.channels.find(ch => ch.name === 'General');
invitechannel.createInvite()
.then(invite => console.log(Created an invite with a code of ${invite.code}))
.catch(console.error);

let a = new Discord.RichEmbed()
.setTitle('Order')
.setDescription(Sent by ${message.author.tag})
.addField('Order Is', Content, true)
.addField('Total member count', message.guild.memberCount)
.addField('server name', message.guild.name)
.addField('Order ID', x)
.addField('Icon', message.guild.iconURL)
.addField('Invite Link', invitechannel)
.setColor(0x00ff00)
.setFooter('created at:')
.setTimestamp(message.createdAt);

message.author.send('Your order has bin Sent for 5$! You should see a friend request or Dm from our worker soon. At the end you can do i-tip to tip them')

Channel.send(a)```

amber fractal
#
let invitechannel =  bot.guild.channels.get
let invitechannel =  bot.guild.channels.find(ch => ch.name === 'General');```
barren brook
#

let me fix that

amber fractal
#

also I just want to let you know generating an invite without the knowledge of the server owner is against the ToS

barren brook
#

Is it

opaque eagle
#

Yes