#you do not understand me

1 messages · Page 1 of 1 (latest)

young stump
#

I need the full code to actually help you

amber mauve
#
const config = require("../../../config.json");
const db = require("quick.db");
const { MessageEmbed } = require("discord.js");
const moment = require("moment");
moment.locale("tr");


module.exports = {
    name: "darkcointop",
    aliases: ["dctop", "cointop"],
    execute: async (client, message, args, embed, author, channel, guild) => {
        let users = await Users.findAll({ limit: 10, order: [['count', 'DESC']] });
        for (const user of users) {
            await client.users.fetch(user.userid);
        }
        users.sort((a, b) => b.balance - a.balance)
        .filter(user => client.users.cache.has(user.user_id))
        .first(10)
        .map((user, position) => `(${position + 1}) ${(client.users.cache.get(user.user_id).tag)}: ${darkcoin:user}`)
        .join('\n'),
            message.channel.send(ranktop)
    }
}```
#

@young stump

young stump
#

I dont see where you are getting darkcoin from

#

did you remember to import it

#

or use your db to get the value

#

@amber mauve

amber mauve
#

db.get(`darkcoin:${member.id}`);

young stump
#

I dont see that in your code

#

replace darkcoin:user with your db.get("darkcoin:${member.id}")

amber mauve
young stump
#

that should work

#

but remember

#

darkcoin:user wont change per user

#

you will need to template string it

#

along with wherever you update it from

amber mauve
#

js error

C:\Users\batub\Desktop\DARK CITY BOT'S\Genel - Kopya\src\commands\Genel\darkcointop.js:12
        let users = await Users.findAll({ limit: 10, order: [['count', 'DESC']] });
                    ^

ReferenceError: Users is not defined```
young stump
#

the error tells you everything

amber mauve
#

await delete

young stump
#

Users doesnt exist

amber mauve
#

?

young stump
#

ReferenceError: Users is not defined

#

did you mindlessly copy paste code?

amber mauve
#

find me not interested

#

.d

young stump
#

?

amber mauve
young stump
#

then thats why

amber mauve
#

wait

young stump
#

quick.db is one database

#

Users.findAll seems to come from typeORM

#

so yeah this code isnt gonna work at all

#

If you do not mind maybe we can do a vsc live share so I can properly see your code?

amber mauve
#

sure

young stump
#

ok

#

do you know how to setup a vsc live share?

#

joining

#

can I have access to more files?

#

yeah you are combinding databases

#

sequelize is an sql db adapter

#

quick.db is a very bad json db

#

I am sorry but i cannot help you with an issue with this level of complexity

amber mauve
#

I just want to show the 10 richest people

young stump
#

step 1) read docs
step 2) figure out what needs to be changed
step 3) do it

amber mauve
#

that is all

young stump
#

hmm

#

well I need access to all your code

#

not just that 1 file

amber mauve
#

You're going to change them all, aren't you?

#

what about the people with dark coins on the server?

#

will they all be reset?

young stump
#

then you are going to have to do database migrations

#

or you can actually figure out what code you are writing before mindlessly copy pasting from the internet

amber mauve
#

this way i can't show it

#

?

young stump
#

i have no idea what you are saying

amber mauve
#

db.get(`darkcoin:alluser`)
top 10:
user: 10 darkcoin
user: 8 darkcoin
user: 5 darkcoin
....