#development

1 messages · Page 629 of 1

earnest phoenix
#

@earnest phoenix its hard

#

very hard

#

ok but how?

quartz kindle
#

Provide an example of the json you have and how you want it to be

earnest phoenix
#
{"id":{"coins":100},"id2":{"coins":200}}
``` I want to sort the pattern so the person with the higher coins (id2) will be showed above (id1) when displayed in an embed.
quartz kindle
#
Object.entries(yourjson).sort((a,b) => a[1].coins - b[1].coins)
``` something like that. Im on the phone so i cant test
earnest phoenix
#

ok thanks

quartz kindle
#

That should get you a sorted array like this:
[[id,{coins:100}],...]

earnest phoenix
#

@bot.command(name="name", pass_context=True)
async def edit_role_name(self, ctx, role: discord.Role, name: str):

    if name == "":
        await self.bot.say("Name cannot be empty.")
        return
    try:
        author = ctx.message.author
        old_name = role.name  
        await self.bot.edit_role(ctx.message.server, role, name=name)
        logger.info("{}({}) changed the name of role '{}' to '{}'".format(
            author.name, author.id, old_name, name))
        await self.bot.say("Done.")
    except discord.Forbidden:
        await self.bot.say("I need permissions to manage roles first.")
    except Exception as e:
        print(e)
        await self.bot.say("Something went wrong.")   i get error at logger says what is undefined
#

I use the module discord-anti-spam
So I added her without my index.js

tools(client, {
    warnBuffer: 3, 
    maxBuffer: 5,
    interval: 1000,
    warningMessage: "**❌ Le spam n'est pas autorisé.**", 
    banMessage: "a été banni pour __spam__.",
    maxDuplicatesWarning : 5, 
    maxDuplicatesBan: 8,
    deleteMessagesAfterBanForPastDays: 7
});```

but when a person spam, the bot does not react
earnest phoenix
#

bots can use animated emojis

#

yes @earnest phoenix

#

ouh

#

\:emoji:

#

for uploading anim emojis for bots i need nitro

#

No

#

why

#

@earnest phoenix i think a bot can do that

#

the \:emoji:

#

And then you got something like this 🅰519277299277![blob](https://cdn.discordapp.com/emojis/530901399077388289.webp?size=128 "blob")

#

![mmLol](https://cdn.discordapp.com/emojis/356831697385422848.webp?size=128 "mmLol")

#

yes

#

Put that in your code

#

ok

west spoke
#

@earnest phoenix I just do ``:emote:``

earnest phoenix
#

Ah yeah

west spoke
#

![mmLol](https://cdn.discordapp.com/emojis/356831697385422848.webp?size=128 "mmLol")

modern sable
#

depends

#

Xig isn't the only one

#

but yeah he does the most

#

it's probably like 50/50
50% xig
50% divided onto everyone else

#

yup

#

403 = bot still in approval queue and you aren't logged in as the owner or a mod

#

you dont need DBL to invite your bot to a server Thonk

earnest phoenix
#

you just need tonkku

modern sable
bitter sundial
#

@modern sable 51% chance xig checked your bot if it was checked last week

#

51% xig
49% rest of the web mods

digital sparrow
#

How To Host Bot with vps?

slim heart
#

Put the bot files on the vps and run it

forest sage
#

get a vps, remote in, copy files, run

digital sparrow
#

like a norm al?

slim heart
#

Norm al yes

digital sparrow
#

ok ty

slim heart
#

Polo

forest sage
#

if you'd stop asking about it for one day, it'd be instant

digital sparrow
#

lol

slim heart
digital sparrow
#

there are other ways when bot crashes will restart automatically?

earnest phoenix
#

yes

#

catch the error

#

and .then(bot.login(''))

quartz kindle
#

that will never work lol

#

if the bot crashes, the program quits. your .then() will never work. if the bot doesnt crash, it wont disconnect in a way that you need to login again

lofty hamlet
#

Hi system clicker with reaction is not advised ?

earnest phoenix
#

?

lofty hamlet
#

Make a clicker game with system clicker on reaction is not advised ?

earnest phoenix
#

whats advised mean?

hidden ginkgo
#

"is it API abuse?"

lofty hamlet
#

Thx zzzz

earnest phoenix
#

no

hidden ginkgo
#

The answer is probably yes

lofty hamlet
#

?

earnest phoenix
#

Its not a api abuse

lofty hamlet
#

Because when too many messages are modified etc the bot ram

modern sable
#

I wouldn't recommend because you users will probably hit the 0.25s reaction ratelimit very quickly

earnest phoenix
#

You can set a interval, 6 second

lofty hamlet
#

Oh ok :///

earnest phoenix
#

Per reaction

lofty hamlet
#

Yes i go make a cooldown in my commands of 5 seconds

earnest phoenix
#

Yes

lofty hamlet
#

And my bot ram for editing messages lmao

reef arrow
#

can people help me with this

#

problem

modern sable
#

you need to install discord.js

reef arrow
#

how

lofty hamlet
#

npm install discord.js

dusky marsh
#

npm i discord.js

reef arrow
#

thx

digital sparrow
#

no problem

real helm
#

hello

#

I need a web that oit haves 3d images for back-ground image in http

mossy vine
#

what

real helm
#

yes

#

3d images

#

for back-ground image

#

for a webs site

quartz kindle
#

google "3d backgrounds"

#

or "3d wallpapers"

somber verge
#

help

jolly sentinel
somber verge
#

yes

#

that didn't help

jolly sentinel
#

Your bot is missing the necessary perms to do it

somber verge
#

it has administrator perms

slender thistle
#

You can't kick the server owner or anyone who is above the bot in role hierarchy

jolly sentinel
#

^

somber verge
#

wait a second

#

ok it works now

#

the dm's stopped working but i think i can fix that myself

slender thistle
#

/shrug

jolly sentinel
earnest phoenix
#

lol

#

im making bot thats can make emojis from images and gifs (all bots can do this XD)

topaz sphinx
#

i need help to remove the text decoration

#

text-decoration: none doesnt seem to do anything

#

current css is here

opaque eagle
#

Try adding !important

topaz sphinx
#

where exactly

opaque eagle
#

To the property?

#
text-decoration: none !important;```
topaz sphinx
#

did nothing

earnest phoenix
#

try adding !very very important

topaz sphinx
#

LUL

#

nah, but i need help to get trough this

earnest phoenix
#

you need to add it to the text, not the class itself

topaz sphinx
#

well lets tryforsenE

earnest phoenix
#

select the child from the linkbutton

topaz sphinx
#

it worked... it removed the italic but not that much more

#

i need to format it properly

quartz kindle
#

remove text decoration and set a color

earnest phoenix
#

emojis from gifs

#

noice

topaz sphinx
#

Well apparently it was due to <a href> which caused it to have format

#

so i had to clear both to be able to make it work

quartz kindle
#

yes, you apply the css to the a not to the box

earnest phoenix
topaz sphinx
#

but

#

if i have a button class

#

can i use it to link directly instead

earnest phoenix
#

for reference parent > child is a child selector

topaz sphinx
#

yes but

#

im mildly confused

#

current goal is to just make the button itself have the link

#

this wont work

#

ohohhoohhhh

#

@earnest phoenix sorry i think i understand now

#

ill replace button with a href

#

switch eachother

#

cause then the <a> class will take over the link for the <button> class

#

nope :c

#

now it works

#

owo

quartz kindle
#

buttons cant have links

waxen meteor
#

There's actually a way to make a button in HTML?

quartz kindle
#

you have to either wrap the button in an a or give it a link via javascript function

waxen meteor
#

Like, other than a <div> with an <a> around it or PHP hell?

quartz kindle
#

you can:

  1. style the a itself to make it look like a button
  2. use a button inside an a
  3. use a button inside a form
  4. use a button with a javascript link in onclick
topaz sphinx
#

yes

waxen meteor
#

I just use a <div> if I'm making a fancy button. Come to think of it, that's kind of a bad idea lol

topaz sphinx
#

<a><button>

quartz kindle
#

its not a bad idea, it just depends on what you need

#

its not a bad idea, it just depends on what you need/want

topaz sphinx
#

need?

#

its just so you can hit the button properly

#

instead of targeting just the text itself

quartz kindle
#

you can do what with only an a

#

padding is clickable

topaz sphinx
#

button is more stylish

#

also its alot more simple

quartz kindle
#

it is simpler yes

#

as for stylish, it doesnt really matter, you can achieve the same result in a gazillion ways

topaz sphinx
#

indeed

#

also how was it you made it able to hover

#

nvm thats correct, now for some ease in

earnest phoenix
#

lmao

#

so basically

#

I putin my custom html and css

#

ans

#

this is what happene

#

d

forest sage
#

that previous pic might be an answer as to why it's borken mmLol

earnest phoenix
#

lol

shy turret
#

how do you disallow bots to run commands?

earnest phoenix
#

@shy turret if(message.author.bot) return;

amber fractal
#

Oh i read that wrong

#

Lmao

earnest phoenix
shy turret
#

thx ♥

#

How do you delay/sleep?

#

discord.js

dusky marsh
#

setTimeout

shy turret
#

... no functions

dusky marsh
shy turret
#

nvm i think i found out

#

or not lol

pale ether
#

Anyone here ever used the Oxford Dictionaries API? For some reason while I was testing, lemmas returned 2 values for "testing", being the adjective & the verb, when then querying the definition for "testing" and "test", the first returned a 500 int server error & the latter returned a perfectly good json 🤔

shy rose
#

i attempted to but its kind of a mess when i last looked v2 api

pale ether
#

Lol yup

shy turret
#

how do you make a ping command...

amber fractal
#

On master or stable

shy turret
#

i just write everything in bot.js

amber fractal
#

No like

#

D.js version

shy turret
#

discord.js

amber fractal
#

Version

shy turret
#

version..

#

(lol I'm dumb) how do you find the version?

#

i just npm install discord.js

amber fractal
#

Ok

#

Thats stable

shy turret
#

k

amber fractal
#

1 sec Im on phone

shy turret
#

ok

amber fractal
shy turret
#

client.ping?

amber fractal
#

Yep

#

That'll be the websocket ping

#

If you want bot ping too, you can send a message then edit and compare the send time from the edit time

shy turret
#

ok

#

so like

#
  if (message.content.startsWith('s!ping')) {
    message.channel.send(client.ping)
  }
amber fractal
#

That would be the websocket ping yeah

shy turret
#

My websocket ping is 148ms. is that pretty good?

  if (message.content.startsWith('s!ping')) {
    message.channel.send('My websocket ping is ' + client.ping + 'ms.')
  }
steel cloak
#

yeah that looks pretty good. it might be better to use backticks in your string expect binding strings with '+'

earnest phoenix
#
if(message.content.startsWith('s!ping')) {
message.channel.send(`My websocket ping is ${client.ping} ms`)
} 
#

@shy turret use that

steel cloak
#

^^^yeah use that lol

shy turret
#

...

#

I don't like "`"

earnest phoenix
#

and you can put client.pings for getting all pings

shy turret
#

ok

#

rather not lol

steel cloak
#

yeah go ahead and code however you want. thats the beauty about coding, no two people's code will ever look alike. but using "`" is just more human readable

ember flame
#

(Not sure if this is the right place to ask people for some insight)

Anyone who uses Discord.js
Would there be any explanation for a bot with only 5 Active servers and a >300 Mbps connection would experience intermittent inexplicable failures of performing

message.member.voiceChannel.join().then(voiceConnection => {
    voiceConnection.playStream("<VALIDATED_INPUT>"); //Note VALIDATED_INPUT is just a placeholder
});
buoyant wagon
#

the stream may have a problem

wicked pivot
#
if(message.content.startsWith(prefix + "addxp")) {
        let xpid = message.author
        if (message.mentions.users.first()) xpid = message.mentions.users.first()
        
        let addxp = args[1];
        let currentExp = xp[xpid.id].xp;
        xp[xpid.id].xp = currentExp + addxp;
      }``` cannot read property 'id' of null
earnest phoenix
#

lol

#

I'm doing the works of the console wait
message.author is not a function

wicked pivot
#

ypeError: Cannot read property 'id' of null"

earnest phoenix
#

Try message.member

#

in message.mentions..

#

and wait

#

let xpid = message.mentions.member.first() ? message.mentions.member.first() : message.author

amber fractal
#

mentions.members not mention.member

wicked pivot
earnest phoenix
#

yes

#

mentions.members

amber fractal
#

And .members is not guarenteed

#

so if you do mentions.members.first() you'd get an error

#

if no user is mentioned

earnest phoenix
#

no

#

its returning message.author

#

with 1 ? 2 : 3

amber fractal
#

nvm it's just undefined

earnest phoenix
#

@wicked pivot with put a s at the end of member

wicked pivot
#

I am not English so I do not understand everything I have to do what?

earnest phoenix
#

what languages do u speak

wicked pivot
#
if(message.content.startsWith(prefix + "addxp")) {
        let xpid = message.mentions.members.first() ? message.mentions.members.first() : message.author

        let addxp = args[1];
        let currentExp = xp[xpid.id].xp;
        xp[xpid.id].xp = currentExp + addxp;
      }```
#

french

earnest phoenix
#

go dm

amber fractal
#

I thought trying to do .first() on something that didnt exist didnt work, or at least I thought it errored for me once

earnest phoenix
#

let xpid = message.guild.member(message.mentions.users.first()) ? message.guild.member(message.mentions.users.first()) : message.author

#

80% sure its working

#

@wicked pivot

wicked pivot
#

dacc dacc

#

unhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of null

earnest phoenix
#

do you ping someone when you do the command ?

wicked pivot
#

yes

earnest phoenix
#

its not working ?

wicked pivot
#

same error

earnest phoenix
#

wth

#

let user = message.guild.member(message.mentions.users.first()) || bot.users.get(args[0]); i have that for my blacklist command and its working

#

with id and mention

wicked pivot
#

same error :/

earnest phoenix
#

show your code

wicked pivot
#
const xp = JSON.parse(fs.readFileSync("./exp.json", "utf8"))
      function write(){
        fs.writeFile("./exp.json", JSON.stringify(xp), (err) => {
          if (err) console.log(err)
      })
    }

if(message.content.startsWith(prefix + "addxp")) {
        let xpid = message.guild.member(message.mentions.users.first()) || bot.users.get(args[0]);

        let addxp = args[1];
        let currentExp = xp[xpid.user.id].xp;
        xp[xpid.user.id].xp = currentExp + addxp;
      }```
earnest phoenix
#

Remove .user

#

just xpid.id

#

And it should be work

wicked pivot
#

same error

low wasp
#

message.guild.members.get(message.mentions.users.first().id)

digital sparrow
#

wtf how turn off the bot?

earnest phoenix
#

@low wasp why?

#

xpid.id is the same

#

just earning 2 characters

low wasp
earnest phoenix
#

xpid.id work

low wasp
#

also @wicked pivot what build are you using?

earnest phoenix
#

@wicked pivot its working?

wicked pivot
#

nop

digital sparrow
#

how to turn off bot wtf

wicked pivot
#

@low wasp the last

earnest phoenix
#

@digital sparrow process.exit()

low wasp
#

or close the terminal

digital sparrow
#

if i close term nothing happend

#

@earnest phoenix where i put?

earnest phoenix
#

Under bot.on('ready'...

#

Or in a eval

digital sparrow
#

ok

buoyant wagon
#

or client.destroy() logs it off...

digital sparrow
#

kk thx you 💌

earnest phoenix
#

@buoyant wagon client.destroy() just close the bot

#

he doesn't kill the bot

buoyant wagon
#

i know

earnest phoenix
#

process.exit() down the bot after 2
seconds
client.destroy() down the bot after 60 seconds

pale ether
#

In C#, will the bot also trigger this if it gets kicked?
Client.LeftGuild += Client_LeftGuild;

#

Or only if it leaves on its own?

hushed quarry
#

if it gets kicked, it will also trigger

#

the leave event for any library is called if the bot leaves on its own, or gets kicked or banned

#

(there is no way to detect how it left either-- discord doesn't provide this to the websocket)

pale ether
#

Ah ok good

#

Was just making sure so it could delete the appropriate db entries

hushed quarry
#

if you're relying on it for clearing the db, just remember that those entities will not get cleared if for some reason your bot is offline and in that time leaves a server

pale ether
#

Yeah was thinking that too, which is why I'm just adding a manual check on a timer too :p

#

(which just grabs all the guilds in the db & checks them against the list of guilds)

#

Not like it would really matter tho, as there's only like 20 bytes of data being stored for each guild, just wanted it to be clean

floral bloom
#

Discord.js help needed
I have a member count command and I want to tell what percentage of users are bots and what percentage are humans. How would I do this? I already have variables set for the amount of humans and bots.
bots / humans * 100 works... when there are less bots than humans.

hushed quarry
#

@pale ether yeah you shouldn't worry about that tbh. I have over 100k guild data saved (most of it is from old servers) and it uses hardly anything

#

@floral bloom divide by the total member count, which includes bots and humans

floral bloom
#

Ah, thanks. So humans / (humans + bots) * 100 and vice versa?

hushed quarry
#

the library doesn't have a total member count property? most libraries I've seen have it. but, if it doesn't, then yes

floral bloom
#

Oh, it does.

hushed quarry
#

maybe wrap humans/ (humans+bots) behind another parentheses

#

so you know the multiplication will affect the result of the entire thing

floral bloom
#

I'm sorry?
Math.round((bots / total * 100))

#

Ok, I think it works.

#

Thanks!

hushed quarry
#

i meant (bots/total) * 100, but if it works yw lol

pale ether
#

Yeah it's
BotsPercentage = (bots/total) * 100 HumansPercentage = 100-BotsPercentage In case you want to show both

floral bloom
#

Ok, thanks both of you!

pale ether
#

Make sure you use 100f in the humansperc in case you want decimals tho, unless js doesn't care about int vs float for that calculation

#

Cuz I know in some languages they like to see
(int)10 / (int) 100
as being (int) 0 instead of (float) 0.1

hushed quarry
#

yeah you don't have to worry about that in js

#

same with python, lua, and other dynamicaly typed languages

pale ether
#

Wasn't sure, so thought I'd add the warning about it :p

#

I've had many a headache because I've forgotten about it

#

Quick repeat of an earlier question as nobody seemed to know back then & other ppl are online now:

When calling the oxford dictionary API, querying the lemmas for "testing" results in this Json (img)
When then calling for the definition of the verb "test", it works fine & outputs the correct result, however when querying for the adjective "testing", it returns a 500 internal server error, any ideas on the cause and/or a fix?

@ me on a response or pm; as I'll be afk for a while & don't want to miss responses

undone carbon
#

I need a small help

#

And that ???

#

What do they mean

#

And how can I change it

#

?

copper cradle
#

first

undone carbon
#

Okay

copper cradle
#

is the bot approved?

undone carbon
#

Yep

copper cradle
#

second, you have to manually send the server count through the API

undone carbon
#

Okay

copper cradle
#

and that ??? means that the bot isn't on the server

#

If it is

#

then restart it or idk

undone carbon
#

I'll try, thanks for the help

copper cradle
#

np

cunning snow
#

Hello friends

floral bloom
#

Discord.js
Ok... so, I have a setTimeout function. How would I reset it with a command?

#

Ping with response please 😃

hushed quarry
#

show the code you attempted

earnest phoenix
#

Ping with response

#

@floral bloom show the code.

copper cradle
#

@floral bloom show the code

steel cloak
#

doesn't reply

earnest phoenix
#

Let's wait

copper cradle
#

lmfao

pale ether
#

Lmao 😂

steel cloak
#

5 hours later

earnest phoenix
#

9 endgames later

pale ether
#

Update for my earlier question (https://discordapp.com/channels/264445053596991498/272764566411149314/586036103086211073), when doing the same with "working", I get an adjective, noun & verb from lemmas, but when searching the entry for definitions, both "working" and "work" work just fine, as opposed to "testing" not working while "test" works

Discord

Step up your game with a modern voice & text chat app. Crystal clear voice, multiple server and channel support, mobile apps, and more. Get your free server now!

pallid zinc
#

Code ==const background = await loadImage('./IDcard.png')

Err==parsing error: Can not use keywork 'await' outside an async function

#

Do you need full code ??

quartz kindle
#

the error says it all

#

add async to your function

pale ether
#

The calling function has to be async as well @pallid zinc

pallid zinc
#

Sorry

#

Fixed before

pale ether
#

Ah good, only just now noticed the timestamp 😂

pallid zinc
#

No err

mossy vine
#

You are playing dbm. Are you sure its a friend MegaThonk

fading wigeon
#

its really easy actually

#

all you need to do is burn your code to a floppy

#

and then put it into the robot

quartz kindle
#

well, does your friend want to actually program a bot?

#

if so, does he know any programming language? or has any language preferences?

#

then he should start setting up an environment for javascript development

#

install node.js then install discord.js

mossy vine
jaunty drum
#

yes but not anymore lol

quartz kindle
#

do you have node.js installed?

jaunty drum
#

donno how to

#

do u have teamviewer?

quartz kindle
#

just google node.js

mossy vine
quartz kindle
#

^

jaunty drum
#

and then?

quartz kindle
#

install it and restart your computer

jaunty drum
#

i have it downloaded, do i place it somewhere?

quartz kindle
#

no... you install it

mossy vine
#

No.. Just run the installer

jaunty drum
#

th

mossy vine
#

How experienced are you with javascript anyways?

jaunty drum
#

1-10?

#

1.2

#

but my dad can help me

mossy vine
#

Yeah.. Please learn js more before jumping into bot development

jaunty drum
#

hes professional

quartz kindle
#

anyways, once its installed, restart your computer (this is important)

jaunty drum
#

well, gtg now so i'll try continue later

#

bye

earnest phoenix
#

lol

pallid zinc
#

Do canvas only support .jpg

#

??

pale ether
#

HTML canvas? Pretty sure it supports png as well, would have to check tho

pallid zinc
#

Nope

#

Node canvas

pale ether
#

Oh, no clue then

pallid zinc
#

As I was sending a PNG

#

It was not waorking

#

Then I can it to jpg and it work

#

Btw thanks

quartz kindle
#

yes it does support png

pallid zinc
#

Ok

#

Thanks

#

I am done with my command

earnest phoenix
#

@jaunty drum you really shouldn't trust random people into your teamviewer

jaunty drum
#

i can just easily lock the out right?

#

but ur right

earnest phoenix
#

thank

verbal nacelle
#

How to make mysql listener for discord. js to invite bot to guild then added row in database?

quartz kindle
#
client.on("guildCreate", guild => {
    // add guild to your database
})```
verbal nacelle
#

But how to add bot to guild by mysql add row event?

#

Or by website (php, js) button click

#

Like Luca does

#

You click "add my bot to website database", and Luca invites bot

quartz kindle
#

bots cant invite bots

#

luca doesnt invite, the mods do when they review them

lofty hamlet
#

Hi the limit of emoji and edit message is how much ?

verbal nacelle
#

Thank you. But how when we get bot icon and name when sending website form? I know only method with secret token, but it seems form dont use it. How can i get with php script bot name and icon when only know client id?

quartz kindle
#

im pretty sure you can scrap a bot's name and profile picture from its invite link

#

else you need to use oauth2 to get access to an account information by id

verbal nacelle
#

Thanks

earnest phoenix
#

role detection on support server

#

how i can make that

verbal nacelle
#

I found restcord library, it can get guild info with bot token

earnest phoenix
#

@earnest phoenix i have this on my bot i can send u the code if you want

unique nimbus
#

Read docs

#

docs good

knotty steeple
#

dont spoonfeed

unique nimbus
#

yes

knotty steeple
#

spoonfeed bad

unique nimbus
#

yes

#

Samurai qt

#

gg bye

knotty steeple
#

waveboye

unique nimbus
earnest phoenix
#

@earnest phoenix ```let serv = bot.guilds.get('supportserverid')

let guildmem = serv.members.get(message.author.id)
let memberhasrole = guildmem && guildmem.roles.has('roleid')

if(memberhasrole) {
console.log(${message.author} has the premium role.)
}```

unique nimbus
#

no spoonfeed

earnest phoenix
#

why not

unique nimbus
#

they wont learn that way

earnest phoenix
#

i have sent my code, if he understand js he can modify the code

knotty steeple
unique nimbus
#

its better to link docs

#

yes

knotty steeple
#

spoonfeed is against the rules lmfao

amber fractal
slender thistle
#

Spoonfeed doesn't teach

knotty steeple
#

^

waxen meteor
#

Question: is there a limit to how many times a message can be edited by a bot?

earnest phoenix
#

@waxen meteor yes

split lantern
#

No, but you have to consider the timing between each edit

earnest phoenix
#

@waxen meteor you can do that with a json files

#

count a edit on a message, and if the edit size are highter than "5" return

waxen meteor
#

Ok, good to know

earnest phoenix
#

idk what events is

#

i think is messageUpdate

#

I'm not sure

split lantern
#

@earnest phoenix Wdym with 5 times ?

#

@waxen meteor You can edit an message as often as you want

slender thistle
#

Unlimited edits but let's follow ratelimits as well

waxen meteor
#

I mean, I know there's probably a ratelimit. Discord has those everywhere.

slender thistle
#

"probably"

split lantern
#

But the thing with 5 edit size is just straight up made up

slender thistle
#

shrug

earnest phoenix
#

@waxen meteor put a 6 seconds limit per edit

#

if your bot edited message too fast

waxen meteor
#

Understandable, have a good day.

pale ether
#

Quick q, in Discord.NET, is there a way to get to your commandservice inside a command module, or would I need to add another check in my messagerecieved to use it/throw in a DI into my execution?

earnest phoenix
#

i cant install better-sqlite3

#

i hardly installed quick.db but it depends better-sqlite3 so i also need to install it

#

but i cant

#
internal/modules/cjs/loader.js:596
    throw err;
    ^

Error: Cannot find module '../build/better_sqlite3.node'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:594:15)
    at Function.Module._load (internal/modules/cjs/loader.js:520:25)
    at Module.require (internal/modules/cjs/loader.js:650:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (C:\Users\Win7\Desktop\Klasörler\JavaScript\Test\index.js:3:21)
    at Module._compile (internal/modules/cjs/loader.js:702:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
    at Module.load (internal/modules/cjs/loader.js:612:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
    at Function.Module._load (internal/modules/cjs/loader.js:543:3)
split lantern
#

Do you have any errors above that message

quartz kindle
#

why cant you?

earnest phoenix
#

ima send install err

split lantern
earnest phoenix
split lantern
#

Try installing windows build tools npm install --global windows-build-tools

slim heart
#

Run npm i windows-build-tools --production --vs2015 --add-python-to-PATH --global as admin, and restart terminal.
Restarting machine can also be required.

earnest phoenix
#

i did

slim heart
#

Did u do mine?

earnest phoenix
#

doin

slim heart
#

Ok

earnest phoenix
#

------------------- Python --------------------
Python 2.7.15 is already installed, not installing again.

#

its been 3 times since i install these

slim heart
#

Do the other flags will do their work

split lantern
#

did you also try to restart your PC

earnest phoenix
#

All done!

  • windows-build-tools@5.1.0
    updated 1 package in 95.939s
slim heart
#

If it finished do a restart

#

Yea there

split lantern
#

Windows is sometimes really weired

slim heart
#

Yea if ur using windows id just say don’t even bother with gyp

earnest phoenix
#

literally nothing has changed

slim heart
#

Have you restarted?

earnest phoenix
#

no

#

wait ima

slim heart
#

K

earnest phoenix
#

restarted now

#

nothing changed

#

LITERALLY NOTHING

#

same error as i sent

hushed quarry
#

then find another sqlite library

earnest phoenix
#

quickdb requires better-sqlite3

#

wait

#

i cannot install anything

night imp
#

Hey, isn't Eris more lightweight than discord.js?

mossy vine
#

it is

hushed quarry
#

yes

night imp
#

good to switch to?

mossy vine
#

depends

hushed quarry
#

sure

split lantern
#

Just because its lightweigth doenst mean its good

night imp
#

wdym xyber

hushed quarry
#

@split lantern eris implements the entire discord api, so it's good

split lantern
#

i mean discord.js does too pretty sure

mossy vine
#

if you dont need it, its simpler to use something youre already familiar with

night imp
#

yeah; I really only need role management but ya know not doing api calls myself

hushed quarry
#

@split lantern but it's also a memory whore

night imp
#

yeah, I am sending this out to multiple people to run on their servers and want to save them some memory

#

thank y'all, I'll switch over my code rq

earnest phoenix
#

im done

#

been tryna install better-sqlite3 for like a week

night imp
#

do you have node-gyp installed?

earnest phoenix
#

yes

#

3.8

night imp
#

I remember I had an issue with better-sqlite3 when I used it, but node-gyp fixed it

earnest phoenix
#

my node-gyp is broken either

#

it tries to find a file in \node-modules\node-modules

#

which doesnt exit

#

Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\node_modules\node_modules\node-gyp\bin\node-gyp.js'

night imp
#

have you tried rebuilding?

earnest phoenix
#

i cannot

#

node-gyp rebuild isnt working

night imp
#

can you purge node-gyp via npm?

#

then reinstall

earnest phoenix
#

nope

#

i uninstalled node-gyp

#

reinstalled but nothing

#

4.0.0

earnest phoenix
#

try npm i package@latest

mossy vine
#

npm*

quartz kindle
#

have you tried googleing Failed to locate: "CL.exe"?

#

i've seen answers that include installing vc++ redists or using specific versions for visual studio

#

it might also be as simple as adding CL.exe to your path

digital sparrow
#

WKP)OOSOQIQW

#

HELP

mossy vine
#

i love how you completely disregard all of the unwritten rules of asking for help

slender thistle
#

You should actually explain what you need help with

digital sparrow
#

TF

quartz kindle
#

are you trolling?

mossy vine
#

judging by previous messages, yes

earnest phoenix
near igloo
#

HI DEVELOAPERS sry for caps

grim aspen
#

need help?

near igloo
#

ive finnally made a bot named Pgoldy[BOT] I MADE IT ON ANOTHER ACCOUNT so i cant show you guys

#

but i have a problem

mossy vine
#

and what is it?

near igloo
#

i tried to find my bot on the inter net i couldnot find it on any were

#

another problem is

grim aspen
near igloo
#

every 2 or 1 munits the bot goes offline

amber fractal
#

Use a process manager

bright meadow
#

Is it your bot

near igloo
#

yup

mossy vine
#

@bright meadow read above messages lmfao

bright meadow
#

Right, sorry forgot it after laughing

grim aspen
#

there's your first problem, you can't find it anywhere on the internet because nobody knows about it

amber fractal
#

Also you'll need to list it if you want to find it, but that's only if you want it to be public

grim aspen
#

second, use a vps

amber fractal
#

And that

near igloo
#

and some times it send me weird massages

#

like

amber fractal
mossy vine
#

oh yes

#

you leaked your bot token

near igloo
#

100101#*%#$

bright meadow
#

Is this a troll

near igloo
#

this is the massage i go tits from my bot

#

idk y

grim aspen
#

how old are you?

near igloo
#

can i send u the codes?

#

im 14

wraith cipher
#

8 ?

near igloo
#

14

bright meadow
#

Oof

near igloo
#

14 years old

#

on 16 june im turning in 15

grim aspen
#

i am trying to understand what you're saying

#

"i go tits from my bot"

near igloo
#

sending the codes

wraith cipher
#

Lmao

near igloo
#

the first code i ve write is

#

{
“name”: “Pgoldy-bot”,
“version”: “1.0.0”,
“description”: “hello games im Pgoldy the bot i will teach you a lesson plz follow my rules to become a god gamer”,
“main”: “bot.js”,
“author”: “PureGOLDS,Pgoldy”,
“dependencies”: {10}
}

hushed quarry
#

that is not code

near igloo
#

ik

hushed quarry
#

please use google and learn how to code.... we do not understand anything you're trying to say

grim aspen
#

that looks like it belongs in a packagelock.json

mossy vine
#

no

#

its package.json

#

package-lock.json is completely different

near igloo
#

i got this from internet

#

var Discord = require('discord.io');
var logger = require('winston');
var auth = require('./auth.json');
// Configure logger settings
logger.remove(logger.transports.Console);
logger.add(new logger.transports.Console, {
colorize: true
});
logger.level = 'debug';
// Initialize Discord Bot
var bot = new Discord.Client({
token: auth.token,
autorun: true
});
bot.on('ready', function (evt) {
logger.info('Connected');
logger.info('Logged in as: ');
logger.info(bot.username + ' - (' + bot.id + ')');
});
bot.on('message', function (user, userID, channelID, message, evt) {
// Our bot needs to know if it will execute a command
// It will listen for messages that will start with !
if (message.substring(0, 1) == '!') {
var args = message.substring(1).split(' ');
var cmd = args[0];

    args = args.splice(1);
    switch(cmd) {
        // !ping
        case 'ping':
            bot.sendMessage({
                to: channelID,
                message: 'Pong!'
            });
        break;
        // Just add any case commands if you want to..
     }
 }

})

mossy vine
#

so you dont actually know what youre doing

hushed quarry
#

we're not helping you with code you copied online

near igloo
#

it similior to java

mossy vine
#

so you 100% have no idea what youre doing

near igloo
#

justin u said get help from internet

hushed quarry
#

getting help from the internet doesn't mean copy code

near igloo
#

i serchit in on internet and this pop up

#

nop

hushed quarry
near igloo
#

as i said i already created a bot

#

but i have some problems

hushed quarry
#

which are

mossy vine
#

yes, the problem is that you have no clue what youre doing

steel cloak
#

script kiddie

quartz kindle
#

following a bad and outdated guide

grim aspen
#

if you want to learn discord.js go here https://discord.js.org/#/

lofty hamlet
#

Hi, how i can sort for example : all of my userInfo[message.author.id}.level ?

#

With quick.db

mossy vine
hollow beacon
#
var video1 = await youtube.searchVideos(args.join(" "), 1);
   const videoIndex = parseInt(1)
   var video = await youtube.getVideoByID(video1[videoIndex - 1].id);
  
   const ul = `https://www.youtube.com/watch?v=${video.id}`
   
   let data = ops.active.get(message.guild.id) || {};

    if (!data.connection) data.connection = await message.member.voiceChannel.join();

    if (!data.queue) data.queue = [];
      
  
  data.guildID = message.guild.id;
    data.queue.push({
        songTitle: video.title,
        requester: message.author.tag,
        url: ul,
        announceChannel: message.channel.id
    

    });
      if (!data.dispatcher) play(bot, ops, data);
    else {
        message.channel.send(`Добавлено в очередь : ${video.title} | Добавил : ${message.author.tag}`);
   
    }
    ops.active.set(message.guild.id, data)
}
async function play(bot, ops, data) {

    bot.channels.get(data.queue[0].announceChannel).send(`Сейчас играет :${data.queue[0].songTitle} | Добавил : ${data.queue[0].requester}`)


    data.dispatcher = await data.connection.play(ytdl(data.queue[0].url, { volume: 1 , filter: 'audioonly' }));
    data.dispatcher.guildID = data.guildID;

    data.dispatcher.once('finish', function() {
        finish(bot, ops, this);
    });
}
function finish(bot, ops, dispatcher) {

        let fetched = ops.active.get(dispatcher.guildID);

        fetched.queue.shift();

        if (fetched.queue.length > 0) {

            ops.active.set(dispatcher.guildID, fetched);
            play(bot, ops, fetched)
            
        }   else {
            ops.active.delete(dispatcher.guildID);

            let vc = bot.guilds.get(dispatcher.guildID).me.voiceChannel;
            if (vc) vc.leave();

copper cradle
#

what's the error

hollow beacon
#

What could be the problem bot does not play music?

#

e
no errors

#

@copper cradle

copper cradle
#

idk

#

I'm not on my pc

#

and I'm not reading that on phone

earnest phoenix
#

error :

lientUser#setActivity instead
(node:27037) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'calculatedPosition' of undefined```

code :

const Discord = require('discord.js');

exports.run = (bot, message, args, guild) => {

let user = message.mentions.users.first();
if(user.highestRole.calculatedPosition >= message.member.highestRole.calculatedPosition && message.author.id !== message.guild.owner.id) return message.channel.send("**❌ Vous ne pouvez pas warn cet utilisateur.**");
if (message.mentions.users.size < 1) return message.reply("**❌ Vous devez mentionner l'utilisateur à avertir.**").catch(console.error);
let reason = args.slice(1).join(' ');
if (reason.length < 1) return message.channel.send("**❌ Veuillez insérer une raison.**");

if(!message.member.hasPermission("MANAGE_MESSAGES")) return message.channel.send("**❌ Vous n'avez pas la permission d'utiliser cette commande.**");

message.channel.send("**✅ L'utilisateur a été averti avec succès.**");
let mpEmbed = new Discord.RichEmbed() 
.setColor("RED") 
.setDescription(`Vous avez été averti dans le serveur ${message.guild.name} par ${message.author.username} pour la raison suivante : ${reason}`)
try{
user.send(mpEmbed)
} catch(e) {
	console.log(`Avertissement en message privé échoué.`)
} 

}

exports.conf = {
enabled: true,
guildOnly: false,
aliases: [],
permLevel: 2
};

module.exports.help = {
name: 'warn',
};```
How can i do ?

#

@earnest phoenix is not function

#

Yet on the command ban its works

#

user.highestRole.calculatedPosition is not function, lol .

#

message.member ?

#

owh, ok

#

owh no

#

uWhat do I put instead? @earnest phoenix

digital sparrow
#

is not string

lofty hamlet
#

Hi, how i can sort for example : all of my userInfo{message.author.id}.level ?
With quick.db

digital sparrow
#

idk

unique nimbus
#

No

#

@modern sable advertising?

bright meadow
#

Oof

unique nimbus
#

oof

modern sable
#

@gaunt blade sorry but this falls under rule 4

gaunt blade
#

oh

#

sorry

#

@modern sable where can i ask for developers for my bot?

modern sable
gaunt blade
#

oh ok

split lantern
gaunt blade
#

ok

unique nimbus
#

I am in discord.py rewrite

Is it possible to purge messages from a specific person?
For example: G-purge @Peter2469#5460 100 would delete 100 messages sent by me and excludes everyone else

slender thistle
unique nimbus
#

okay thankis

#

I will see what I can do

lofty hamlet
#

Hi, how i can sort for example : all of my userInfo{message.author.id}.level ?

mossy vine
lofty hamlet
#

?

mossy vine
#

also is userInfo{message.author.id} valid syntax?

lofty hamlet
#

Ok thx

mossy vine
#

huh

#

anyways

#

the link is what you need

unique nimbus
#

@slender thistle I tried doing

amount2 = int(amount) + 1
await ctx.channel.purge(limit=amount2, check=author)
embed = discord.Embed(title= "", description= f'**{amount}** messages by {author.name}' + " was deleted successfully!", color = 0xFFFFF)
yeet = await ctx.send(embed=embed)
await asyncio.sleep(2)
await yeet.delete()

however it gave a TypeError: ClientUser object is not callable (author is the person who got pinged)

slender thistle
#

check is a function. When that returns True, action is done, else go to next message

unique nimbus
#

ok

lofty hamlet
#

@mossy vine i can't

#

I can't sort with this my userInfo{message.author.id}.level

#

My userInfo_ and .level is

#

:

#

db.set(`userInfo_${message.author.id}`, { name: `${pseudo}`, class: `${choice}`, rune: `${choice2}`, runelvl: 1, armor: `${basearmure}`, weapon: `${baseweapon}`, pendentif: `${basependentif}`, money: 0, life: baselife, damage: basedamage, lifeactual: baselife, badge: ["🎮"], reputation: 0, energie: 500, energiemax: 500, inventaire: [], bucheron: 1, bucheronxp: 0, chasseur: 1, chasseurxp: 0, mineur: 1, mineurxp: 0, paysan: 1, paysanxp: 0, pecheur: 1, pecheurxp: 0, compagnonbdd: [], compagnon: "Aucun", all: [], niveau: 1, niveauxp: 0, niveaumaxp: 5000, biographie: "Aucune", farmer: 0, myguild: "Aucune", fer: 0, bronze: 0, argent: 0, obsi: 0, chene: 0, erable: 0, merisier: 0, acajou: 0, crevette: 0, truite: 0, anguille: 0, requin: 0, ble: 0, malt: 0, millet: 0, quisnoa: 0, cochon: 0, mouton: 0, vache: 0, canard: 0, bucheronmaxp: 1000, paysanmaxp: 1000, pecheurmaxp: 1000, mineurmaxp: 1000, chasseurmaxp: 1000, potionhp: 0, potionstamina: 0, vip: false })

quartz kindle
#

sort what?

#

it doesnt even have any .level

earnest phoenix
#

does anyone know if discord allows you to make a command, where you can buy emoji's in a guild.

#

With points what you earn by typing etc, (example levels)

mossy vine
#

uh thats literally impossible

earnest phoenix
#

Whats impossible?

mossy vine
#

limiting emoji use

#

literally the easiest thing to bypass

earnest phoenix
#

no i mean that users can create a emoji.

#

with a command

mossy vine
#

that could be easily abused as well mmLol

earnest phoenix
#

thats why we have moderators right 😉

#

but can i add this to my bot

#

or isn't this allowed

mossy vine
#

i dont see why it wouldnt be

earnest phoenix
#

Okey thanks 😄

forest sage
#

inb4 30 dick emojis

stiff summit
#

What an interesting first message for me to see

somber verge
#

-+++

#

wait no

#

_+++

#

there

lofty hamlet
#

@quartz kindle this is .niveau

#

My bad

smoky mica
#

hey guys, i tried to do this new help command but i get this error that rich embed field values cannot be empty and that happens because it cant find my files but i gave it a place to search

#

someone help?

amber fractal
#

when does it happen? With just help or help with a command/module

smoky mica
#

when I type z.help it says that error

#

its tryna send scan text from my js files and send the text in the field but it can't cause of some error ??? and then it sends empty/nothing/blank embed lol except for the name and icon and etc ofc.

amber fractal
#

try logging dir

#

does it get the correct commands in that category or get any at all?

#

how about categories?

smoky mica
#

wait when i do a command like prefix help jwrij or well a command that doesnt exist in my js files the invalid command does come up for sure

#

its problem with the categories i realized

#

from line 28 to 37

amber fractal
#

yeah

smoky mica
#

when i privated the try catch i didnt get error

#

so obv it doesnt get my files but idk how to fix

amber fractal
#

that's why I asked if dir was empty

smoky mica
#

do i type console.log(dir)?

amber fractal
#

if it's empty rn it wouldnt change

#

But what does categories return?

smoky mica
#
RangeError: RichEmbed field values may not be empty.```
#

thats what i get when i do prefix help

#

oh, nothing. empty

amber fractal
#

Wait

smoky mica
#

after the description the code should look something like this but cleaner.

amber fractal
#

are the categories in your help objects is the first letter capital?

smoky mica
#

elaborate?

#

like dog.js as Dog.js?

amber fractal
#

no

#

you have

smoky mica
#

or in the module exports?

amber fractal
#
category: "Miscellaneous", //copy paste this in all commands.``` in the help object for the help command
#

Are the first letters in all capped?

smoky mica
#

the first letter in all my command files capital

#

other lowercase

delicate zephyr
#

@vital nest basically you wanna check if msg.channel.permissionsFor(msg.member).has("SEND_MESSAGES") is true when a message is sent and if not just return

vital nest
#

ok, thanks for the help! ill give it a shot

#

but that doesnt fix my bot responding to other peoples help commands

delicate zephyr
#

Also do you check whether or not the person sending is a bot?

smoky mica
#

prefix?

vital nest
#
        return;
    }```
#

thats what i have for that

delicate zephyr
#

ah good

#

also

vital nest
#

but it got muted

delicate zephyr
#

Yea

#

thats fine

#

what was it muted for

vital nest
#

replying to bots

smoky mica
#
    if (message.author.bot) return;
    if (!command.startsWith(prefix)) return;
#

do you have the second line

delicate zephyr
#

@vital nest have you got a testing server?

#

@smoky mica his code could be different to yours

vital nest
#

yeah my personal one

delicate zephyr
#

@vital nest send me an invite and i'll help test this issue

smoky mica
#

could be yeah but just could kinda refer ya know.

delicate zephyr
#

so that it can be unmuted here

vital nest
#

sent!

smoky mica
#

@amber fractal don't wanna trouble you with the ping but if you could help me rn, that would be greatly appreciated

quartz kindle
#

"dont wanna trouble you with a ping but im gonna trouble you and ping you anyway"

smoky mica
#

ah yes expected that lol

quartz kindle
#

whats your problem anyway? maybe someone else can help

#

you dont need to harass the same person every time xd

smoky mica
#

not everytime, just encountered a problem after some months when updating my help command

#

scroll up, too much to re explain and idk how to explain properly but i tried my best

lofty hamlet
#

Hi, how i can sort for example : all of my userInfo{message.author.id}.level ?

#

I have been on it since hours

quartz kindle
#

well that should be easy to debug

#

just console log those variables

#

and see which one is missing

smoky mica
#

i've been trying but idk

quartz kindle
#

@lofty hamlet provide an example of what you have, and how you want it to be

smoky mica
#

sometimes i get stuck on the easiest problems ._.

quartz kindle
#

well, console.log(dir.map(c => \${c.help.name}``).join(" "))

lofty hamlet
#

@quartz kindle example of ?

quartz kindle
#

the way it looks like and the way you want to be after sorting

lofty hamlet
#

My heal command for example

#
    let reputa = await db.fetch(`heal-timer_${message.author.id}`)
    let time = ms(timeout - (Date.now() - reputa))

    if (db.get(`userInfo_${message.author.id}.name`) == null) return message.channel.send("Vous devez vous enregistrer, pour ce faire tapez `?register`")
    if (db.get(`userInfo_${message.author.id}.vip`) == false) return message.channel.send("Vous devez être VIP `?vip`")
    if (reputa !== null && timeout - (Date.now() - reputa) > 0) return message.channel.send(`Revenez dans : **${time.hours}h ${time.minutes}m ${time.seconds}s**!`)

    db.set(`heal-timer_${message.author.id}`, Date.now())
    db.set(`userInfo_${message.author.id}.lifeactual`, db.get(`userInfo_${message.author.id}.life`))
    db.set(`userInfo_${message.author.id}.energie`, db.get(`userInfo_${message.author.id}.energiemax`))

    let embed = new Discord.RichEmbed()
        .addField(`Régénéré`, `HP : ${db.get(`userInfo_${message.author.id}.lifeactual`)}/${db.get(`userInfo_${message.author.id}.life`)}\nStamina : ${db.get(`userInfo_${message.author.id}.energie`)}/${db.get(`userInfo_${message.author.id}.energiemax`)}`)
        .setColor("RANDOM")
    message.channel.send(embed)```
quartz kindle
#

you said to want to sort

#

explain what you want

lofty hamlet
#

I want make a ranking of 10 best level in my bot

#

So if i make a command where the player can see her level i do make this dunction db.get(`userInfo_${message.author.id}.niveau`)

#

@quartz kindle

smoky mica
#

imagine getting 3 chances to win $50,000 as bonus money

quartz kindle
#

@lofty hamlet which db are you using? you need to get all data from the db, or check if your db has a way to query data by properties

smoky mica
#

hey tim

#

could you recommend me some good websites or places to search for to learn about databases in java script or well for discord?

quartz kindle
#

theres a gazillion databases out there, its more about the database itself than javascript

#

javascript libaries will just give you an interface, most likely the database's native commands are going to be used anyway

#

so you just gotta chose a database and learn it

lofty hamlet
#

@quartz kindle it's quick.db

smoky mica
#

what about quick db or like mongodb

quartz kindle
#

basically there are many types of databases, but most of them fall into two categories: nosql and sql, and two types: embedded and server

#

quickdb is embedded nosql, mongo is server nosql

smoky mica
#

oh god

quartz kindle
#

quickdb is actually just a front

#

they use sqlite behind the scenes

#

which is an sql embedded database

smoky mica
#

wait did you forget the \ in js console.log(dir.map(c => `\`${c.help.name}\``).join(" "))

lofty hamlet
#

🤔

#

So how i can sort with this

smoky mica
quartz kindle
#

sql is based on tables and gives you the ability to run advanced queries

smoky mica
#

thanks for the heads up btw

quartz kindle
#

i just copied it from the code you gave me lol

smoky mica
#

It was there in my code already

lofty hamlet
#

?????

#

Me ?

smoky mica
#

somehow you deleted it ig

#

yes one sec have patience xd

quartz kindle
#

anyway, nosql usually runs on documents or key->value stores, which is a lot more similar to javascript objects

#

so nosql is usually easier to learn

#

then the issue of server vs embedded. a server database accepts multiple connections from multiple processes and also connections over the internet. which is useful if you run your database in another server for example

smoky mica
#

there's clearly a lot i didn't know about

quartz kindle
#

an embedded database can only be used for processes in the same machine, and sometimes its also limited to one process at a time

smoky mica
#

damn. thanks dude.

quartz kindle
#

mongo is probably the most popular nosql server database

#

mysql and postgre are probably the most popular sql server databases

#

sqlite is probably the most popular sql embedded database

smoky mica
#

oh btw i console logged it but its not there in the console log

quartz kindle
#

then theres your problem, your field is being filled with nothingness

#

double check your filter function before it

smoky mica
#

RangeError: RichEmbed field values may not be empty.
#

yeahh ik this but how the code is setup is its supposed to look into your folder and take the things from there

#

like import and export into the field i wanna know why its doing that even though i gave it a place to look

lofty hamlet
#

Tim so how i can make my ranking ?

empty owl
#

I forgot what u do to get this args.join(" ").slice(args[0])
i mean i know that wont work but i forgot which one it is supposed to be
XD

quartz kindle
lofty hamlet
#

Hum

#

But startwith does not work

smoky mica
#

@quartz kindle so i updated this command handler and now it sends the help files like all the files in my directory /folderand there's no empty message but still it says

RangeError: RichEmbed field values may not be empty.

wicked pivot
#
let member = message.mentions.users.first() || message.author;
    let textimage = args.join(" ")
    if(textimage.length > 30) return message.channel.send("Seulement 30 caractères sont admis.")```the mentions are counted as character how to deny this
earnest phoenix
#

slice the mention

wicked pivot
#

that would do?

hoary helm
#

help
just moved to a raspberry pi to host the bot, and now it throws this error
it was working fine when i was hosting it on my windows desktop
it defines richembed with const { RichEmbed } = require("discord.js") and constructs it with new RichEmbed()

#

nevermind, got it working by using discord.js 11 instead of 12

fiery stream
#

ayyy do u get paid if i make a api for rapid api

#

cuz its easy i can make millions of em

amber fractal
#

@hoary helm for the future when you update, its MessageEmbed on master

hoary helm
#

ok

undone carbon
#

I'm bit confused with adding a feature that the bot depends on Google Translate and translates French words to English, But I couldn't figure out how to do it
Do you have anyway? ( JavaScript)

hushed quarry
#

use the google translate api

undone carbon
#

Is it possible for to share me a code? sorry I'm confused with it

restive light
#

const os = require('os')
function delta() {
const cpus = os.cpus()
return cpus.map(cpu => {
const times = cpu.times
return {
tick: Object.keys(times).filter(time => time !== 'idle').reduce((tick, time) => { tick+=times[time]; return tick }, 0),
idle: times.idle,
}
})
}
let startMeasures = delta()
setInterval(() => {
const endMeasures = delta()
const percentageCPU = endMeasures.map((end, i) => {
return ((end.tick - startMeasures[i].tick) / (end.idle - startMeasures[i].idle) * 100).toFixed(3) + '%'
})
client.on('message', msg => {
if (msg.content === 'show cpu') {
msg.reply(percentageCPU.join(' '), '\n')
}
});
// reset
startMeasures = delta()
}, 1000)

ERROR: percentageCPU is not defined

hushed quarry
#

make an account with them, get your API key, read their docs and make a GET request @undone carbon

#

@restive light then define it

undone carbon
#

I'll do that way, thanks Justin👍

restive light
#

i already did

#

const percentageCPU = endMeasures.map((end, i) => {

hushed quarry
#

that's in a different scope than the message event

#

so it cannot see the value

restive light
#

When i paste this code in the loop
client.on('message', msg => {
if (msg.content === 'show cpu') {
msg.reply(percentageCPU.join(' '), '\n')

bot spams cpu usage every seconds

if i paste "show cpu" code different place, "percentageCPU is not defined"

hushed quarry
#

I need to see the new code, and please use codeblocks

restive light
#

how to use it?

hushed quarry
#

triple ` at the beginning and end

restive light
#

'test'

#

test

hushed quarry
#

1 more and that makes the code block

restive light
#

well my keyboard doesnt have that

grim aspen
#

@restive light please make it into a codeblock

#
(code)
restive light
#

i said my keyboard isnt have `

#

that was copy paste

hushed quarry
#

do you have a QWERTY keyboard

restive light
#

yes

#

but turkish Q

#

thats different

hushed quarry
#

just copy and paste it 3 times then on both sides

restive light
#

damn the fucking doesnt work

#

meh just look the code

hushed quarry
restive light
#

how can i define it in java?

hushed quarry
#

javascript?

restive light
#

im new in java and writing these codes what i remember from c#

#

ye javascript

hushed quarry
#

this is basic programming fundamentals. where you have percentageCPU defined in one scope cannot be seen in a completely different scope

restive light
#

hmm i have second solution but need help

#

"show cpu" works in loop but spams as i sad
if i can do something like
"send (cpuusage)
->>Send command 1 time but dont stop loop

hushed quarry
#
{
    int x = 0;
}

{
    // different scope
    System.out.println(x); // ERROR
}
#

again, I need to see the updated code

restive light
#

but please dont shitty " ' " or what was it

#

doesnt works with me

#

const os = require('os')

function delta() {
const cpus = os.cpus()

return cpus.map(cpu => {
const times = cpu.times
return {
tick: Object.keys(times).filter(time => time !== 'idle').reduce((tick, time) => { tick+=times[time]; return tick }, 0),
idle: times.idle,
}
})
}

let startMeasures = delta()
setInterval(() => {
const endMeasures = delta()
const percentageCPU = endMeasures.map((end, i) => {
return ((end.tick - startMeasures[i].tick) / (end.idle - startMeasures[i].idle) * 100).toFixed(3) + '%'
})

client.on('message', msg => {
if (msg.content === 'show cpu') {
msg.reply(percentageCPU.join(' '), '\n')
}
});

// reset
startMeasures = delta()
}, 1000)

#

now this code shows the cpu usage but spams

#

something like "Stop sending message but dont stop loop" i mean

hushed quarry
#

don't have the message event in a function

#

it should be outside of everything

restive light
#

if i do that, "percentageCPU is not defined"

hushed quarry
#

it's probably spamming because of the timer shit

#

then define it

restive light
#

how

hushed quarry
#

you declare it in your message event callback

cyan goblet
#

Bot#invite()

restive light
#

can you show me an example on code?

hushed quarry
#

no, I don't code in javascript

restive light
#

thats gonna being complicated

cyan goblet
#

How can invite bot

hushed quarry
#

define the percentageCPU stuff either in another function and return the value, or do the processing in your message event

#

this is basic programming involving scopes. this is not complicated. if it's complicated to you, then you need to learn more programming

restive light
#

i said i understand but i dont know how to define that to code

#

define code i mean

hushed quarry
#
  client.on('message', msg => {
  var x = 5;
  if (msg.content === 'show cpu') {
    msg.reply(percentageCPU.join(' '), '\n')
  }
});```
#

I have defined x to be 5

#

do the same for percentageCPU

#

I'm not writing your code for you if you're implying that

restive light
#

I already dont want that

#

just wrote here for help

#

also define which you wrote fucked bot now

#

78 errors

hushed quarry
#

then fix it

restive light
#

js started showing interesting errors

hushed quarry
#

you're struggling so much with basic programming scopes

restive light
#

" % " is not defined

#

etc..

#

pff

#

anyone here for really helping me?

#

now bot fucked from A to Z

hushed quarry
#

debug your code and fix it

restive light
#

"client.login is not defined"

#

bot really fked

undone carbon
hushed quarry
#

already explained that to him

#

@restive light post code

restive light
#

i understood it

#

but it didnt work

hushed quarry
#

then post your code

undone carbon
#

👍

restive light
#

i destroyed bot

#

and deleted everything

#

i just tried to do "If i type cpu then write cpu usage" about 19 hours

west spoke
#

Learn how to code

#

And also

#

You terminated it not destroyed

sinful lotus
#

theres a lot of example about cpu usage, I even made my own promised based cpu usage calculator

#

you just need to read

west spoke
#

^

restive light
#

Im already vb6 and c# programmer dont say me "learn how to code"

#

but java is really complicated for me

hushed quarry
#

you were struggling with scopes

#

this is fundamental to all languages

west spoke
#

^

sinful lotus
#

I know java and javascript, yet js is so easy

west spoke
#

^

sinful lotus
#

you just need to put your scoping right

west spoke
#

Js is easier than java imo

sinful lotus
#

CONST is a block scoped variable

#

a simple

let percentageCPU
let startMeasures = delta()
setInterval(() => {
  const endMeasures = delta()
  percentageCPU = endMeasures.map((end, i) => {
    return ((end.tick - startMeasures[i].tick) / (end.idle - startMeasures[i].idle) * 100).toFixed(3) + '%'
  })
#

will fix your scoping issues

#

a little reading about how JS scoping works will let you learn that

restive light
#

I never see the bullshit langs like java and js

#

really complicated and annoying languages

hushed quarry
sinful lotus
#

javascript is designed for beginners

#

its so easy that it doesnt even need you to specify the type of variable

#

like in langs like Java or whatever

#

you just need to read about it or learn how it works

#

or if you do C# then why not do a bot in C#

#

Also Java is not Javascript

#

they are completely different languages

#

remember that

restive light
#

i already know

#

both are bullshits

sinful lotus
#

Java is fun

restive light
#

just good for android developing

sinful lotus
#

you are saying its bullshit because you dont get the flow or gist of how Java works

#

true Java is primitive in lot of ways

#

but its fun to code in Java once you get the gist of it

#
  • theres a lot of help from google and stackoverflow
restive light
#

I wrote a clientless game program with java for android

sinful lotus
#

even an IDE from jetbrains

restive light
#

i punched and broke my phone because of java

#

always gives errors or bugs

sinful lotus
#

its not because of Java

#

Its because of you