#development

1 messages ยท Page 566 of 1

astral quail
#

It will get bigger for sure.

#

But I will leave you guys alone.

lusty dew
#

Not much bigger

#

The role stuff

#

will only be in shop for an x amount of time

quartz kindle
#

you can do this: if the item is not assigned to a name in data

#

dont give it a dataName

lusty dew
#

so

#

hm

quartz kindle
#

so when the answer comes, you check if(items[answer].dataName) { do the data name } else { do a different thing, like adding it to an array }

lusty dew
#

hm

quartz kindle
#

for now, both of your items can be deal with using the same function

lusty dew
#

Yea

quartz kindle
#

but in the future, as you add different types of items, you might need to deal with each type differently

#

so you have to check what type of item it is, and use the correct function

#

checking if dataName exists or not, is one way of checking what type of item it is

#

you can give each item type a special property that only the same types have

lusty dew
#

So like

#

dataName

#

is the special property

#

for items in the DB

quartz kindle
#

yes

lusty dew
#

so I could do something like

#

actually

#

the roles would already have a special proprty

#

since I am doing

#

data[items[answer].dataName]

#

I could do

#

data[items[answer].name]

#

for the role stuff right?

quartz kindle
#

if the name matches the value that is going to be worked on, yes

lusty dew
#

Wdym?

quartz kindle
#

for example, if the name field contains the exact name of the role, so that you can use it in a role function

lusty dew
#

Yea

#

also

#
            data.bal -= items[answer].price
                                data[items[answer].name] = 2;
                                if(!data[items[answer].dataName]){

                                }else{
                                message.author.send(`You have just bought ${items[answer].name}!`)
                                }
#

Would the check work like this?

quartz kindle
#

you have to check before you do the operation

#

if you do that and data.datanamehere doesnt exist, it will create a new filed which will never be used

lusty dew
#
                                if (!data[items[answer].dataName]) {

                                } else {
                                    data.bal -= items[answer].price
                                    data[items[answer].name] = 2;
                                    message.author.send(`You have just bought ${items[answer].name}!`)
                                }
quartz kindle
#

yes

lusty dew
#

K

#

Ima add a new item

#

a role

#

would I add the role like this

#

let role = items[answer].name
message.author.addRole(role)

#

although

#

that may not be very efficient if the item isn't a role

#

and the item is also not in the Database

#

Hm

#

message.author.addRole(items[answer].name)

#

?/

quartz kindle
#

adddRole requires the role id or a role object

lusty dew
#

hm

#

I forgot that

#

I can't do

#

.id

#

after name can I?

quartz kindle
#

discord roles are indexed by IDs

#

if you have the role name, you have to find the correct role from the list of roles

lusty dew
#

Hm

#

I see

#

Hm

#

how could I do that though?

#

I mean

#

I know how to find the role

#

that part is easy

#

but how could I implement it?

#

wait

#

could I do

#

let role = message.guild.roles.find(n => n.name === items[answer].name)

#

then do

#

message.author.addRole(role)

quartz kindle
#

yup

lusty dew
#

.id*

#

Hm mk

#

that works better

#

Also

#

How does Math.floor(Math.random() * 10) + 5 work?

#

wouldn't it give me a number

#

between 0-15

static oasis
#

umm

#

well

#

what ever number you got from Math.floor(Math.random() * 10), it will add 5

lusty dew
#

Hm

#

so how could I get a number between

#

0-15

knotty steeple
#

simply

#

Math.floor(Math.random() * 15)

static oasis
#

lmao

lusty dew
#

Oh

#

That seemed very easy...

#

welp

#

I am dumb

static oasis
#

thats javascript

#

;)

lusty dew
#

Lol

#

Yea

knotty steeple
#

you should do 14 + 1 to avoid getting 0

lusty dew
#

so

#

Math.floor(Math.random() * 14) + 1

static oasis
#

ye

knotty steeple
#

yes

lusty dew
#

MK

#

Thanks

quartz kindle
#

or just use Math.ceil()

#

lul

knotty steeple
#

ceil

#

nah

lusty dew
#

ยฏ_(ใƒ„)_/ยฏ

#

Whatever works

#

Lol

#

I think my shop cmd is done now

#

Time to test

#

Oh wait

#

I had one more question while I am here

#

If anyone is good with mongoDB

#

can someone please explain why this isn't giving them 1 level added every time they get double the required xp

#
            let newLevel = data.xp / 50

            let myquery = { levels: 0 }
            let newvalues = { $set: { levels: newLevel } }
            db.collection('users').createIndex({ "id": 1 })
            db.collection('users').updateOne(myquery, newvalues)
            if (data.level == newLevel) {
                message.channel.send(`${mesage.author.id} Leveled up!`)
            }
#

Oh wait

#

I am dumb

#

It is doing what it should

#

I just didn't use it properly

#

it is taking my current xp

#

and deviding it by 50

#

it isn't waiting to see if I have 50xp already

timber wedge
#

Hey quick question guys, how do I get my bot on DBL to show how many servers it's in? Do I just need to use client.guilds.size somewhere in my script and it'll work?

knotty steeple
#

post to api

young jungle
#

1 sec

knotty steeple
young jungle
knotty steeple
timber wedge
#

oh ok

young jungle
#

this works for me

timber wedge
#

thanks guys, i appreciate it

young jungle
#

all good

#

I have my own question too

lusty dew
#
(node:1368) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of null
young jungle
knotty steeple
timber wedge
#

elsif ?

young jungle
#

?

#

what do you mean?

timber wedge
#

should it be elsif?

lusty dew
#

elif is correct

knotty steeple
#

no it shouldnt

timber wedge
#

oh

knotty steeple
#

thats python

timber wedge
#

ahh and ruby

knotty steeple
#

wat

timber wedge
#

elsif in ruby as well

lusty dew
#

but python doesn't use elsif

#

python uses elif

timber wedge
#

idk python, just ruby

lusty dew
#

Mk

#

I was just making it clear

young jungle
#

discord itself uses Ajax, so it can be a bit confusing sometimes as discord.py has to convert functions to and from JSON

timber wedge
#

oof

lusty dew
amber fractal
#

Which line of that

#

Theres many ids in there

knotty steeple
#

null

#

no value

lusty dew
#

message.author.addRole(role.id)

#

The role isn't defined properly

knotty steeple
#

so fix it

lusty dew
#

but Tim said I defined it properly

#

and it looks correct to me

vernal rivet
#

What's up?

lusty dew
#

let role = message.guild.roles.find(r => r.name === items[answer].name)

#

that looks correct to me

#

cause it is getting the name

#

from the item

vernal rivet
#

So what's your error?

young jungle
#

it looks like the role may not exist

earnest phoenix
#

Guys

#

I need minesweeper code...

#

help

#

@woeful falcon

knotty steeple
#

no

earnest phoenix
#

Its offline rip

knotty steeple
#

cuz no one is spoonfeeding you

earnest phoenix
#

my bot ded

young jungle
#

minesweeper?

earnest phoenix
#

spoooonfeed me plz

#

Lmao

knotty steeple
#

no

#

its a fucking rule

earnest phoenix
#

newer

lusty dew
#

Then code it

vernal rivet
#

Kawaii, it looks like you need to have your bot to create the role if it doesn't exist

earnest phoenix
#

i cant code to save my life

#

Overdone#2166
Bot Prefix: -
To run a command, use -command.
Use -help <command> for a more detailed description about a certain command, or use -help on its own for a list of all commands.
-ban ~ -ban <member> - Ban a member from your server.
-bans ~ -bans - Check the bans for this guild.
-eval ~ -eval [Code] - Eval Javascript code.
-help ~ -help [command] - Display all available commands, or detailed information about the specified command. Text enclosed in <> Indicates optional parameters.
-invite ~ -invite - Invite the bot to your server
-kick ~ -kick [@User] - Kick someone.
-kill ~ -kill - Kill the bot.
-mute ~ -mute [@User] [Time] - Mute the mentioned user.
-purge ~ -purge <@User> [Messages] - Deletes a user's or messages in a channel
-ticket ~ -ticket <Message> - Create a support ticket.
-ticketlogs ~ -ticketlogs [Channel] - Get the chatlog of the given ticket channel.
-tickets ~ -tickets - Check outstanding tickets.
-warn ~ -warn [@User] <Reason> - undefined

#

thats it so far

vernal rivet
#

Then look up how to make it

young jungle
#

pretty sure i'll be returning a NoneType object instead of a role, so the role probably doesn't exist

knotty steeple
#

no one cares

young jungle
#

-kill

vernal rivet
#

Check d.js

lusty dew
#

I am still getting the id error

#

(node:1368) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of null at dmchannel.awaitMessages.then (C:\Users\Aj\Desktop\The Clinic\commands\shop.js:57:65)

vernal rivet
#

Your id is returning null

lusty dew
#

But I don't get it

#

reeee

young jungle
#

If the role is returning as null, it's because it doesn't exist

vernal rivet
#

^^^

lusty dew
#

Oh but it does

knotty steeple
#

no

#

it would be undefined

young jungle
#

check you are retrieving it correctly

lusty dew
#

I am

#

lol

knotty steeple
#

do you know what ur saying

#

null means no value

vernal rivet
#

Yes, lol

young jungle
#

discord will return it null as undefined would cause a bigger error

knotty steeple
#

no it would return undefined

#

and the same thing would happen

lusty dew
#

Mk

#

But I am pretty sure I am getting the role properly

young jungle
#

I only know python but it should be similar t this

#
user = client.get_user(message.author.id)
        if user is not None:
lusty dew
#

let role = message.guild.roles.find(r => r.name === items[answer],name

knotty steeple
#

except its not python

young jungle
#

where discord returns None where the object does not exist

lusty dew
#

Boi

#

python is different from JS

young jungle
#

yes...

knotty steeple
vernal rivet
#

What is line 57?

young jungle
#

but the discord API is cross-platform

vernal rivet
#

What he means is their lib are different

lusty dew
#

message.author.addRole(role.id)

#

line 57

astral quail
#

sniff sniff

#

@lusty dew is this the Panda I know?

knotty steeple
#

sniff sniff

#

is this offtopic

vernal rivet
#

Good thing he said which panda ๐Ÿ˜‚

astral quail
#

sniff sniff ur fucking right

#

leaves

lusty dew
#

Lol

#

@vernal rivet
message.author.addRole(role.id)

#

line 57

young jungle
#

line 18?

vernal rivet
#

Ummmmmm

#

Felix That because that's not the full file

lusty dew
#

That is a snippet of the code boi

#

Honestly felux if you don't know JS don't answer JS questions

young jungle
#

ik but how do you know it's line 57

#

I can only see 18

lusty dew
#

Bc the error says so in my console>

#

Again

young jungle
#

oh lol

lusty dew
#

That is only a snippet of the code

#

๐Ÿคฆ

#

I said that already

vernal rivet
#

Try doing let sUser = message.author.id; then change line 57 to sUser.addRole(role.id);

lusty dew
#

message.author.id?

vernal rivet
#

Yee

#

It would let you find the correct user and add the role

lusty dew
#

(node:9308) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'price' of undefined

#

I think I know the error with that

#

actually

#

no

#

what I did should have worked

#

data.bal >= items[answer].price errored line

vernal rivet
#

Why are you checking to see if data.bal is greater or equal to items.price?

lusty dew
#

Why else?

#

To check if they have the right amount of money

vernal rivet
#

I mean you can

lusty dew
#

I kinda have too

vernal rivet
#

What line is the error occurring on?

lusty dew
#

(node:9308) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'price' of undefined at dmchannel.awaitMessages.then (C:\Users\Aj\Desktop\The Clinic\commands\shop.js:52:59)

young jungle
#

items[answer] is not defined

lusty dew
#

ahem

vernal rivet
#

I could be wrong but it could be what answer is equal to

lusty dew
#

Hm?

knotty steeple
#

data.bal >= items[answer].price

#

items is undefined

vernal rivet
#

You could do is let answer = args[1];

lusty dew
#

I see

#

mk

vernal rivet
#

Items is define

#

It's an object

young jungle
knotty steeple
lusty dew
#

yea

#

items is undefined

#

I think

vernal rivet
#

Nah try what I told you to do before jumping to solutions

lusty dew
#

Why would I want to do

#

let answer = args[1]

#

I am not doing

#

tc!shop [itemID]

vernal rivet
#

Then do args[0]

#

Trust me

#

If I am wrong then I am wrong

lusty dew
#

I am wanting to do
tc!shop it dms embed
then they can just send the [itemID] of the item they want

#

(node:5700) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'price' of undefined at dmchannel.awaitMessages.then (C:\Users\Aj\Desktop\The Clinic\commands\shop.js:52:59)

#

@vernal rivet Didn't work

amber fractal
#

The key doesnt exist

static oasis
#

I just tried SQl, I feel fresh

lusty dew
#

Could it be bc

#

I have the item set to 0

#

or is that not the problem?

#

but .price

#

does exist

vernal rivet
#

Ok

wide ruin
#

Discord.js error

#
const Discord = require('discord.js');
>const< client = new Discord.client()```
#

const< is the issue

queen sentinel
#

shouldn't the "c" in client be uppercase? Thonk

#

as in new Discord.Client()

lusty dew
#

yep

#

it hould

wide ruin
#

but would that change the const?

lusty dew
#

it should be

wide ruin
#

Or is it just because it's the first line

lusty dew
#

client = new Discord.Client()

wide ruin
#

Word in the line*

lusty dew
#

iirc

wide ruin
#

Ok, thanks

earnest phoenix
#

oh boi

#

les go.

#

my bot

lusty dew
#

and I got 0 errrors

empty owl
#

anyone online?

lusty dew
#

Huh?

empty owl
#

nvm

#

I cant really help u

lusty dew
#

Mk

empty owl
#

but I need a way to not ping every bot that has 2 letters in their prefix

#
      let cmdFile = bot.cmds.get(cmd.slice(prefix.length));```
wide ruin
#
1 > const admins = ['438733159748599813'/*pineapple*/]
2 > const bl = [];
3 > const Discord = require('discord.js');```
#

i also get const : The term 'const' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 every const

quartz kindle
#

you're trying to run a javascript file with microsoft jscript

#

Lol

lusty dew
#

Hey tim

wide ruin
#

how do i change it?

#

its vscode

lusty dew
wide ruin
#

its set to javascript

#

should it be javascript react?

#

@quartz kindle?

earnest phoenix
#

Anyone able to host my bot untill it gets verified.?

wide ruin
#

nope, thats your job, sorry

#

itll need to be hosted from your end

quartz kindle
#

@wide ruin what do you mean? it has to run in node.js

#

how are you trying to run it?

vernal rivet
#

Tim is God here OwO

wide ruin
#

I'm just clicking run active file

vernal rivet
#

Use node.js

#

You will feel a lot happier

quartz kindle
vernal rivet
#

Yee

wide ruin
#

Thanks, saved link in my group DM

#

with only me in it

lusty dew
#

(node:6060) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'price' of undefined at dmchannel.awaitMessages.then (C:\Users\Aj\Desktop\The Clinic\commands\shop.js:52:59)

if (data.bal >= items[answer].price)
late hill
#

Is answer a number

knotty steeple
#

it should be converted to a number

#

because u will be getting a string

#

from discord message

late hill
#

yes

#

Also wondering if there's a reason why you added an id to the items

#

If the id is just the same as the index in the array

lusty dew
#

Bc

#

I wanted to

#

lol

#

I have a reason

#

Anyway

#

I am trying to parseInt it

#

but I can't figure out how to

slim heart
#

so when sharding is the best way of just replacing

client.channels.get(id).send(msg)```
with
```js
client.broadcastEval(`if(client.channels.has(${id})) client.channels.get(${id}).send(${msg})`) ```
inner jewel
#

no

#

you need to make it a string

#

because js has no integer types

#

so you'd get the ids corrupted

slim heart
#

wdym

inner jewel
#

client.channels.has(${id})

slim heart
#

yea

inner jewel
#

that'll send it as an integer

#

which means it'll get corrupted

slim heart
#

even if id = "1123123"

#

"

inner jewel
#

yes

#

because that's how string concatenation works

slim heart
#

oh didnt know that, so do i have to do id.toString()

inner jewel
#

no

slim heart
#

whatdo

inner jewel
slim heart
#

ooo

#

i have to do ('${id}')

#

i get it

inner jewel
#

also instead of has/get you can just do a single lookup and store to a variable

amber fractal
#

If you do that, its backticks not single quotes

inner jewel
#

const channel = client.channels.get(...); if(channel) channel.send(...)

slim heart
#

oh ye

#

so wait yas am i write

#

its bc(`client.channels.get('${id}')`)

#

etc.

#

and how would i return the message object after the fact just curious?

lusty dew
#

how could I parseInt answer.content

inner jewel
#

parseInt(answer.content)

lusty dew
#

I tried that

amber fractal
#

Then it shouldve worked

#

What did it say?

lusty dew
#

I don't thinnk I used it properly

#
                                if (isNaN(answer.content)) return dmchannel.send("Not valid id number!")
                                parseInt(answer.content) 
                                    if (!data[items[answer].dataName]) {
                                        data.bal -= items[answer].price
                                        let role = message.guild.roles.find(r => r.name === items[2].name)
                                        if (message.member.roles.has(role.id)) return message.reply("โŒ You already bought that role.");
                                        await (message.member.addRole(role.id))
                                        message.author.send(`You have just bought ${items[2].name}`)
                                    } else {
                                        data.bal -= items[answer].price
                                        data[items[answer].name] = 2;
                                        message.author.send(`You have just bought ${items[answer].name}!`)
                                    }
                  
#

Oh wait

#

It should just be that right?

inner jewel
#

you're not using it properly

#

parseInt does not modify it's input

#

it returns the result

spring wharf
#
IDblSelfBot me = await DblApi.GetMeAsync();
await me.UpdateStatsAsync(_client.Guilds.Count, 1);```
#

@astral quail

astral quail
#

alrighty

spring wharf
#
AuthDiscordBotListApi DblApi = new AuthDiscordBotListApi(506258153545924618, "token");```
earnest phoenix
spring wharf
#

How about I ask you this first

#

how did you send that without typing

astral quail
#

have you required the dblapi.js packaged?

spring wharf
#

not using js

#

Don't use ; in js now do you?

earnest phoenix
#

bots cant have RP

spring wharf
#

moreso you don't HAVE to

astral quail
#

oh fuck, I though you did because everyone does

spring wharf
#

no

#

I know a lot of people that use Python and C#

amber fractal
#

You do use semicolons in js tho

spring wharf
#

but you dont have to

swift canopy
#

python api is slow af

amber fractal
#

You dont

#

But you can

spring wharf
#

why would I

earnest phoenix
spring wharf
#

doesnt explain how you send a message without typing

astral quail
#

alright so you have imported dbl right?

inner jewel
#

rich presence belongs to an application

spring wharf
#
using DiscordBotsList.Api;```
amber fractal
#

Put that number before "token" in a string?

inner jewel
#

which is where you'd store the assets/etc

earnest phoenix
#

I'd like to do that, but for the discord bot

inner jewel
#

but only users can have RP

#

bots cannot

earnest phoenix
#

:/

spring wharf
#

it would error if it needed a string

earnest phoenix
#

Okay

spring wharf
#

says it takes a ulong

earnest phoenix
#

rp depends on the client, which bots do not have

spring wharf
#

which is what I gave it

inner jewel
#

rp is sent over the ws

#

the client just re-sends it

#

but discord blocks rp data sent from bots

earnest phoenix
#

what is the problem starman

#

the official .net library for dbl api is full of deadlocks so i wouldn't be surprised if the entire library is the problem

spring wharf
#

the API is not working and crashes my bot

earnest phoenix
#

deadlocks

#

lol

spring wharf
#

it used to work just a month or so ago

#

haven't done anything to it

earnest phoenix
#

the official library is badly written

#

you're much better off writing your own

spring wharf
#

again I dont get why it would just stop though

earnest phoenix
#

consistencyโ„ข

#

it can vary to your cpu performance up to the library updates

#

e.g if your cpu is fast enough to process a racing condition it won't deadlock, in other cases it will

spring wharf
#

Huh

#

but this is the exact CPU I used originally when it worked

#

I've done nothing to my PC

earnest phoenix
#

but you aren't dedicating your entire cpu to the app, are you

#

meaning the cpu has to work with the app alongside other applications and programs open

#

it's not your fault though

#

the official library is badly written

spring wharf
#

well how can I fix it

#

because I do not know how to make my own

earnest phoenix
#

make your own

#

For sites, how to make one with the API to use the bot?

#

wat

#

For example, there are sites like mee6's that use the API

#

No?

#

which api

#

discord's?

#

To manage the bot from a site

#

Yes

#

it varies from dev to dev

spring wharf
#

you custom make it

#

completely

#

from scratch

earnest phoenix
spring wharf
#

oh yeah forgot that stuff exists

#

nvm

earnest phoenix
#

there's no template for it

spring wharf
#

I am dumb

earnest phoenix
#

Okay

#

Thx

#

it's an example

#

on how it would look on a user account

#

Yes, but is this allowed?

spring wharf
#

...

earnest phoenix
#

rich presence? why wouldn't it be

#

it's out there for the public lol

spring wharf
#

you don't understand rich presence really do you?

earnest phoenix
#

: dude

spring wharf
earnest phoenix
#

Make it whatever you want.

#

I've almost been banned for a rich presence before.

#

your discord app is the one maintaining the rich presence, not your bot, your discord app is not your discord bot

#

no you haven't

spring wharf
#

lol

earnest phoenix
#

Okay

#

if you have, you probably put something either offensive or inappropriate in your presence

#

probably :x

#

Yeah.

#

Where do I sell my bot?

#

I don't know

#

Show me your bot

slim heart
#

when i send an emoji retrieved from broadcastEval it just shows [object Object]

earnest phoenix
#

ping

#

ping

#

The console does not contain any errors

lusty dew
#
 let answer = coll.first()
                            if (isNaN(answer.content)) return dmchannel.send("Not valid id number!")
                            let a = parseInt(answer.content)
                            if (data.bal >= items[a].price) {
                                    if (!data[items[a].dataName]) {
                                        data.bal -= items[a].price
                                        let role = message.guild.roles.find(r => r.name === items[2].name)
                                        if (message.member.roles.has(role.id)) return message.reply("โŒ You already bought that role.");
                                        await (message.member.addRole(role.id))
                                        message.author.send(`You have just bought ${items[2].name}`)
                                    } else {
                                        data.bal -= items[a].price
                                        data[items[a].name] = 2;
                                        message.author.send(`You have just bought ${items[a].name}!`)
                                    }

(node:8000) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'content' of undefined at dmchannel.awaitMessages.then (C:\Users\Aj\Desktop\The Clinic\commands\shop.js:52:46)

amber fractal
#

The emoji is an object thats why... JPBBerry

#

.toString() will automatically convert it into the emoji tho

earnest phoenix
#

How to make a black list of users?

empty owl
#

@earnest phoenix

earnest phoenix
#

?

#

Yes?

empty owl
#

if (message.author.id === "id of blacklist") return message.channel.send('Blacklisted')

earnest phoenix
#

I want to make a blacklist with a json file

#

I already know the id technique but I want it in file

empty owl
#

oh

#

idk how do file stuff

lusty dew
#

I'd suggest a db not a json file

#

DB's are better then json files when storing stuff like that

earnest phoenix
#

I have an sql db

lusty dew
#

I'd suggest using it

earnest phoenix
#

I don't know how to do it.....

lusty dew
#

ยฏ_(ใƒ„)_/ยฏ

amber fractal
#

I use json for my blacklists and have a db

#

I dont see them as that important

#

Just make an array of ids and check if the array includes their id

knotty steeple
#

json

#

is

#

persistent

#

data

amber fractal
#

Yes

#

It

#

Is

#

But it works

earnest phoenix
#

Never mind, I don't disturb more good night

#

:)

amber fractal
#

And i dont see blacklisted people as a high priority to care enough if the file corrupts

lusty dew
slim heart
#

how do i return the message object after using broadcastEval, i console logged the response after it and the shard with the channel's response was {}

inner jewel
#

{} or [object Object]

slim heart
#

{}

#

(also ik im supposed to do it one variable i have it like that everywhere else but i had a brain fart randomly and did it like that)

inner jewel
#

return await <channel>.send()?

lusty dew
#

I got part of my problem fixed

#

but it isn't taking the coins away

#

nor is it adding the item it should

slim heart
#

@inner jewel the thing is i cant seem to get a real async function working in eval like i tried this js client.shard.broadcastEval(` async function oof() { if(!this.channels.has('528367776419676180')) return null return await this.channels.get('528367776419676180').send('test') } oof() `).then(console.log)
but then it just gives me [{},{}]

inner jewel
#

await oof()

slim heart
#

i cant

#

eval is not async

#

@inner jewel

earnest phoenix
#

Anyone have a VPS I can use for this week>

#

?

slim heart
#

is there anyone with sharding experience that can help me

keen drift
#

then why are you doing async func in eval then

slim heart
#

@keen drift idk ive been through a whole rollercoaster

#

i just want the damn message id of the message sent

#

its so needlessly difficult

keen drift
#

then let it call a reply func when it completes

slim heart
#

wym

keen drift
#

on complete

#

call reply fn to send result to the channel

slim heart
#

no but im storing it

#

not sending it anywhere

keen drift
#

what

#

you trying to get the result via the eval right?

slim heart
#

yea i wanna .then( and get the message object

#

which should work

#

but i get a promise instead i think

keen drift
#

yeah

#

cause broadcasteval does not await

slim heart
#

yea

keen drift
#

that's why I said have it call a return result fn

slim heart
#

client.shard.broadcastEval(this.channels.has('528367776419676180') ? this.channels.get('528367776419676180').send('test').then(m=>m.id) : null;).then(console.log) i've gotten to this

#

and its still doing [null, {}]

keen drift
#

yeah, expected

#

it doesn't wait

#

...?

slim heart
#

the null sure but {} doesnt

#

even without the .then(m=>m.id) its the same response

keen drift
#

yeah, again, it doesn't await for async result

slim heart
#

yea

keen drift
#

๐Ÿคฆ๐Ÿพ

slim heart
#

am i missing something zoomeyes

keen drift
#

So, use a result callback fn

#

...?

slim heart
#

ijdqwij whatever im just gonna make it push to the db in the broadcast eval idc anymore

keen drift
#

ok

#

It's pretty simple implementation, have it your own way

slim heart
#

i dont get it so :/

keen drift
#

Excerpt taken from Commando

const doReply = val => {
            if(val instanceof Error) {
                msg.reply(`Callback error: \`${val}\``);
            } else {
                const result = this.makeResultMessages(val, process.hrtime(this.hrStart));
                if(Array.isArray(result)) {
                    for(const item of result) msg.reply(item);
                } else {
                    msg.reply(result);
                }
            }
        };
#

eval(anSyncFn().then(result => doReply(result.whatever))

#

How you implement that similar behavior is up to your discretion

slim heart
#
client.shard.broadcastEval(`
            let tic = this.channels.get('509886529729200128')
            if(tic) {
                tic.send('TICKETID = ${ticid} : Word ticket > ${message.author} via ${sent}: ${message.content} || Match site: ${iscensor[1]}').then(msg=>{
                    client.db.table('tickets').insert({
                        id: '${ticid}',
                        author: '${message.author.id}',
                        ticmsg: msg.id,
                        word: '${word}'
                    }).run()
                })
            }
        `)

its saying missing ) after argument list but i cant seem to find it idk

#

also fishy im just gonna keep it simple so i actually understand what im doing oof

lusty dew
night imp
#

@granite yoke are you running Windows?

granite yoke
#

Yes

night imp
#

If so, make sure node.js and npm are installed on your system and in the PATH

granite yoke
#

I have node.js

night imp
#

Try going to cmd and typing in node

#

What happens?

granite yoke
#

Just I have to write cmd.exe in terminal to do it, right?

night imp
#

Press the Windows key and search cmd

granite yoke
#

Ok

lusty dew
#

Windows key + r

#

will take you there as well

granite yoke
#

Ok i have cmd

night imp
#

Type in node

lusty dew
#

if you also search cmd just a func fact

#

fn*

night imp
#

And tells me what happens

lusty dew
#

fun*

night imp
#

@lusty dew ๐Ÿค”

#

Is that not what I said orrrrrr

granite yoke
#

Nothing happened

night imp
#

Alright

granite yoke
#

Waiit no

#

I have ">"

night imp
#

Okay node.js is working properly

#

Try running your bot in command prompt

granite yoke
#

Where is it

night imp
#

(CD to the directory then do node bot.js)

#

Ie
cd C:/myCode
node bot.js

granite yoke
#

Ok

#

Have I type this in terminal?

lusty dew
#

are you in your bots directory in the terminal?

granite yoke
#

Yes

lusty dew
#

then just do

#

node file.js

#

replace file

#

with the name of your main file

granite yoke
#

Ok

#

Ok I have it

#

And the node command is now working?

lusty dew
#

Idk

#

you tell me

#

Did your bot come online?

granite yoke
#

Wait I need to see

#

No

sick cloud
#

did you get a console.log

#

saying ready

lusty dew
#

Well seems how bot didn't come online

#

ima asume no

#

assume*

#

they didn't

night imp
#

Do you have a screenshot program?

#

If so please post a screenshot of the command prompt window

granite yoke
#

Wait where's the command prompt

#

I'm a noob ;;

night imp
#

The thing you just typed node in

#

Cmd

granite yoke
#

Ok

#

So wait i need to do a screenshot

night imp
#

Yes

#

So we know what's going on

#

Hit prntscr on your keyboard and then control v in discord

granite yoke
#

Ok

#

And bot is not online

night imp
#

Okay what is the file that you wrote your bot in called

granite yoke
#

You mean folder?

night imp
#

No file

#

Should end with .js

granite yoke
#

node file.js

night imp
#

๐Ÿค”

#

Alright rename that to file.js

granite yoke
#

Ok

night imp
#

Then hit control c twice in the console

#

Then type node file.js and press enter

granite yoke
#

Ok

lusty dew
#

Lmfao

#

"Alright rename that to file.js"

#

omfg

#

Their name file is actually called node file.js

night imp
lusty dew
#

Sure sure

granite yoke
#

Bot is still offline : (

night imp
#

Do basic debugging @lusty dew

  1. Check variables near conditional statements for expected results
  2. Add console.logs to checkpoints to see where it gets
#

@granite yoke please send another screenshot

granite yoke
#

Ok

lusty dew
#

K t hanks

night imp
#

Remove lines 2 5 6 7 8 9

granite yoke
#

Ok

night imp
#

Then run it again

granite yoke
#

still offline : (

night imp
#

Screenshot

granite yoke
night imp
#

Anything with logger. remove

granite yoke
#

Ok

sick cloud
#

its outdated

granite yoke
#

What can I use?

sick cloud
#

discord.js

granite yoke
#

Ok

sick cloud
#

if you need to

night imp
#

Discord.js is the easiest

sick cloud
#

videos are out of date too

night imp
#

I recommend starting from scratch and watching this or another discord.js tutorial

sick cloud
#

made by the devs

granite yoke
#

So I need to make a bot again

#

maybe

night imp
#

Since many of your issues are handled in the videos

#

The guide is another option but videos may be easier in your case

lusty dew
sick cloud
#

stop reposting to get attention

#

someone will help you if they know

granite yoke
#

It's not attention

#

I really need help

#

I've fighting with it for 3 hours

lusty dew
#

I wasn't reposting to get attention

granite yoke
#

@lusty dew So I have to copy and paste it to my file.js?

lusty dew
#

What?

granite yoke
lusty dew
#

No

#

that is my code

granite yoke
#

Aaa

lusty dew
#

that I am having problems with

granite yoke
#

I'm sorry

#

Hm, maybe I'll try run my bot in C++

#

And cmd

keen drift
#

what

granite yoke
#

Is it a good idea?

keen drift
#

run your bot in cpp, what you mean

#

and cmd?

granite yoke
#

I mean:

#

This and etc

#

In C++

#

And the running commands

#

In cmd

keen drift
#

I don't see anything related to cpp

granite yoke
#

I will write it again but related to cpp

keen drift
#

what

granite yoke
#

I'll try ;;

keen drift
#

@earnest phoenix come translate this

granite yoke
#

I just wanna make my bot online and responding : (

keen drift
#

don't know why you are talking about cpp while showing js projects

granite yoke
#

and I'm fighting with it by 3 hours

#

Ik but is it possible to make a bot in c++?

keen drift
#

yeah, but would you?

granite yoke
#

YES I WILL DO ANYTHING TO MAKE MY BOT ONLINE

keen drift
#

can't even make bot online in js > let me try cpp

granite yoke
#

I tried in js

#

Maybe cpp is better

keen drift
#

๐Ÿคฆ๐Ÿพ

#

have your fantasy

earnest phoenix
#

learn some language and make a bot then

granite yoke
#

;;;;;;;;;;;;;

keen drift
#

i don't know how to work a high abstraction language
let me try a lower abstraction language

granite yoke
#

I just wanted someone to help me

#

With my problem

#

Beucause I'm now tired and didn't sleep by whole night

#

because of this

keen drift
#

maybe should learn a programming language before continuing

granite yoke
#

I'm trying

#

As you see

keen drift
#

not trying hard enough as you wanted to switch to cpp saying it'd be easier Thonk

sick cloud
#

you dont learn a programming language by making a bot

granite yoke
#

Why won't you help me but have fun of my lack of knowledge

sick cloud
#

everyone suggests not to

#

we are trying to help

granite yoke
#

I want my bot to be online pls

#

I'm desperated

earnest phoenix
#

i didnt know much python but making my bot helped a ton

granite yoke
#

It's almost 6 am in my country

earnest phoenix
#

ok

granite yoke
#

But I undestand pieces of python

bright spear
#

@granite yoke pick a language then look up tutorials for learning it

#

If you know python then make ur bot in python

granite yoke
#

;;

#

I wanna my bot online today pls

#

This week is the only week i have free time

#

So I wanted to spend it for things I wanted to do

keen drift
#

kek

#

how about spending that time learning the language

granite yoke
#

I wanted to create a maybe good server in this week

keen drift
#

cool

lusty dew
#

mei no one is going to help you if you don't have basic knowledge of the language you are doing

keen drift
#

it's like jumping into Calculus without even knowing Algebra

lusty dew
#

using*

keen drift
#

10/10

lusty dew
#

I could do that

#

But I would fail

#

:^)

granite yoke
#

Ok fine thank you all

#

.

earnest phoenix
#

np

lusty dew
#

Rip

earnest phoenix
#

Does anyone know any decent databases other than mongodb and mysql

sick cloud
#

redis, rethink, sqlite, postgre, etc

#

there's a lot

earnest phoenix
#

mysql is not decent kek

lusty dew
#

@earnest phoenix it is in some people's eyes

#

It's a matter of opinion

#

๐Ÿ‘€

earnest phoenix
#

its not opinion its facts

#

Lmfao

sturdy delta
#

nhk e

#

Anyone

#

I hate life

#

I canโ€™t get my Dblapi.js to work

sick cloud
#

well that isn't very helpful for us is it

#

just saying "it wont work"

bright spear
spare spruce
#

how to give the role on discord by role ID in discordjs

#

for example as if they did !verify gives the role but i dont know if theres way do by role id

astral quail
spare spruce
#

so like this? js if (message.content.startsWith(prefix + 'verify')) { message.member.addRole('542291593709879327') .then(message.member.removeRole('542292515642933258')) .catch(console.error); }

timber cloud
#

Can somebody help

#

how to make typing t!eq m1 do this

 const test = args[0] 
eq.selected.level = eq. (here test) .level
#

xoz i have like m1/m2 etc etc and want to make current level same as level from one of these

pallid zinc
#

Anyone now how to make poll, voting bot

quartz kindle
#

@timber cloud eq[test].level

earnest phoenix
#

Is anyone here familiar with hosting on glitch

earnest phoenix
#

Anyone familiar with youtube api if we can check if someone is subscribed to someone?

timber cloud
#

@quartz kindle it doesnt work

#

says unexpected token

#

unexpected [

quartz kindle
#

show code?

timber cloud
#
const t = .credits
message.channel.send(eq[t])```
quartz kindle
#

t = .credits is not valid javascript

timber cloud
#

there are '' just forgot to write them here

quartz kindle
#

show the contents of eq

#

if you have a property called credits, then you access it by using eq.credits or eq[credits]

#

not eq[.credits]

#

so the dot there is wrong

timber cloud
#

eq is a shema from mongodb

#

And i acces it by eq.credits

#

I know i can just type eq.otherstuff but im oversimplyfing it here

#

I just need to be able to change this .credits so it works

quartz kindle
#

yes but if you use [] then you dont need the dot

timber cloud
#

but it will be just eqcredits

quartz kindle
#

so it should be const t = "credits"

timber cloud
#

thats not how it works but lets try

quartz kindle
#

thats what im telling you

#

the dot means its a property of

#

eq.credits is the same as eq[credits]

#

the brackets replace the dot

timber cloud
#

ok it worked

#

and i cust continue with readind propeties

#

eq[test].user.level etc etc

quartz kindle
#

yes

timber cloud
#

ok thx

pallid zinc
#

Hey

astral quail
#

Stop asking to get code.

#

Just try to think of your own idea to make one.

quartz kindle
#

anyone good with github pages? im trying to add css rules to a jekyll remote theme. i tried creating an assets folder as recommended, but it doesnt work

earnest phoenix
#

@earnest phoenix it's decent for php but that was not what I was looking for

#

@sick cloud thanks for the suggestions btw

inner jewel
#

you're using .pop

#

which is a function

#

but you don't call it

fiery nebula
#

.pop() ?

inner jewel
#

so you check if a function is equalt to "js"

#

instead of the result of the function call

fiery nebula
#

ok yea thx it works with .pop()

earnest phoenix
#

Does anyone know what's wrong with my bot and why it won't go online?

#

Ping me when you reply

lusty dew
#

no

#

Show any errors you have

fiery nebula
#

@earnest phoenix it needs some time to go offline, the bot doesnt show offline when you close it directly

earnest phoenix
#

None

lusty dew
#

Then show code

#

lmfao

earnest phoenix
#

Later

#

MOBILEEEE

#

It's ran on glitch

lusty dew
#

Then no one can help ya

fiery nebula
#

ignore my msg thx

lusty dew
#

ยฏ_(ใƒ„)_/ยฏ

fiery nebula
#

miss read

#

maybe wrong token

earnest phoenix
#

Nop

#

Check all code

lusty dew
#

We won'

earnest phoenix
#

Shhhh

lusty dew
#

WE won't be able to help without errors or code

#

ยฏ_(ใƒ„)_/ยฏ

earnest phoenix
#

If your not gonna help leave this channel till you help

fiery nebula
#

xD

earnest phoenix
#

xd

fiery nebula
#

give code = get help

earnest phoenix
#

Yesh

#

It's JavaScript btw

lusty dew
#

๐Ÿค”

fiery nebula
#

ok

lusty dew
#

Am I wrong?

earnest phoenix
#

Shhhh

fiery nebula
#

still triggered that iam not green xd

earnest phoenix
#

If your not gonna help leave this channel till you help

#

Lmao @fiery nebula

lusty dew
#

Am I supposed to just know how to fix it without seeing the code or the erorrs?

#

errors*

earnest phoenix
#

Yeh Lmfao

#

Jks

lusty dew
#

If you aren't going to provide what we need to help you then don't ask for help

earnest phoenix
#

I'll show errors later

#

If I find

lusty dew
#

Well I kinda need them now

#

if you want help

fiery nebula
#

just send the code

#

oml

earnest phoenix
#

MoBiLe

lusty dew
#

Then ask for help when you are on PC

#

Simple as that

fiery nebula
#

y u ask for help when oyu cant even provide code now?

#

xd

earnest phoenix
#

๐Ÿคฆ

quartz kindle
#

show code or no help

lusty dew
#

Thank you tim

#

Lmfao

#

Hey tim do you know what an npm package called "faker" does?

inner jewel
lusty dew
#

Hm

mossy vine
#

reg isnt even used in the function tho lmao

#

i dont understand why theyre there

lusty dew
#

full code

#

I know what it is meant to do

#

I just don't understand what a big chunk it means oof

#

Anyway

marble needle
#

yall think its better to split setting related stuff into multiple commands or keep it rather simple for the enduser to just have one command with a param designated to deciding which setting is being changed?

amber fractal
#

I use flags

#

Its up to you tbh

marble needle
#

guess im going for the single command then, less documentation and command spam hmm

inner jewel
#

i just make subcommands for each setting

earnest phoenix
#

@woeful falcon

#

my gae bot online ay

amber fractal
earnest phoenix
#

kong left Discord Bot List which has 36079 members. The bot now serves 40646 users.

#

rip

marble needle
#

eris doesnt automatically deal with guildspecific prefixes does it

inner jewel
#

no

marble needle
#

๐Ÿ‘

crystal spear
#
players:
   [ { name: '1', score: 24, time: 4283.09130859375 },
     { name: '2', score: 12, time: 2838.73486328125 },
     { name: '3', score: 43, time: 2583.64208984375 },
     { name: '4', score: 3, time: 2537.353515625 },
     { name: '5', score: 8, time: 2210.147216796875 },
     { name: '6', score: 15, time: 1887.413818359375 } ]```
How I can get a 3 best values in score and then sort them by scores?
```{ name: '3', score: 43, time: 2583.64208984375 }
{ name: '1', score: 24, time: 4283.09130859375 }
{ name: '6', score: 15, time: 1887.413818359375 }```
quartz kindle
#

something like this players.sort((a,b) => a.score - b.score)

#

(untested)

wide ruin
#

how do i disable mcrosoft JScript?

mossy vine
#

im not sure thats how you would want to run a js file anyways

wide ruin
#

well thats the only error i get

#

terminal > run active file

#

and occasionally

#

Cannot read property 'indexOf' of undefined

mossy vine
#

the latter is a problem with your code

#

try running node server.js in your bots directory

wide ruin
#

cmd.exe?

mossy vine
#

do you know how to use the cmd

wide ruin
#

yes

mossy vine
#

then whats the problem