#development

1 messages ยท Page 1741 of 1

wheat mesa
#

Mmmm ๐Ÿด ๐Ÿ˜‹

solemn latch
#

angeryBOYE getting off topic

earnest phoenix
#

Ok... So what am I doing wrong? I can't figure out how to do the commands like muting I can even show what I have as coding. If anyone would like me to

vivid fulcrum
#

well, we can't tell you what you're doing wrong if you don't show us what you're doing in the first place ๐Ÿง

earnest phoenix
#

True one sec

#
import discord
import os
from keep_alive import keep_alive
from discord.ext import commands

class MyClient(discord.Client):
    async def on_ready(self):
        print('Logged in as')
        print(self.user.name)
        print(self.user.id)
        print('------')
        
    async def on_message(self, message):
        # we do not want the bot to reply to itself
        if message.author.id == self.user.id:
            return

        if message.content.startswith('$hello'):
            await message.channel.send('Hello how are you? '.format(message))
            
        if message.content.startswith('$I am good'):
            await message.channel.send('Excellent '.format(message))

keep_alive()
client = MyClient()
client.run(os.getenv('token'))
#

First I got this however

slender thistle
#

keeeeeepppppp allllllliiiiiivvvvvvvvvvvveeeeeeeeee

earnest phoenix
#

When I do the commands part it don't work. I follow it on YouTube so....

#

I need it because that way it stays connected on discord online

#

Now when I follow the tutorials on YouTube... I do what it says but it don't respond to the commands. I see the YouTubers using command prompt. Which I can't do unless on a computer

vivid fulcrum
#

youtube
๐Ÿงโ€โ™€๏ธ

#

follow the official docs

earnest phoenix
#

Send me the link

vivid fulcrum
#

also

#

you need to be on some kind of a pc for this

#

using any other platform (i.e. a phone) is trivial and you're going to rip your hair out

earnest phoenix
#

This will help

vivid fulcrum
#

dpy really needs to organize their docs better

slender thistle
#

I bet it's a Flask app

mild vortex
#

lol

rocky hearth
#

can we split a string, on every nth index? in js

lyric mountain
#

You can both by using a loop or with regex

rocky hearth
#

uk regex method?

lyric mountain
#

.{length}

#

It'll create capture groups for each N characters

#

Although you could really just use a loop with substring

earnest phoenix
#

This going to take me a while.....

rocky hearth
#

like this? 'somelongtext'.split(/.{4}/)

earnest phoenix
#

Thanks for the link....

lyric mountain
#

Yes but like, why?

#

In that case, it'll only get tge first 4 letters

#

You're not storing the capture groups

rocky hearth
#

it gives empty strings

lyric mountain
#

Hm, weird, but it did get 4 results

#

Wait

#

Hm, brb gonna make regexr a visit

#

It did work here

#

Matched groups of 4 characters

#

Don't u need to use //g?

rocky hearth
#

like how

cinder patio
#

/g

lyric mountain
#

/.{4}/g

cinder patio
#

still nope

#

screw regex

earnest phoenix
#

The global flag has no effect in String.prototype.split()

lyric mountain
#

Idk then, maybe you need to use it another way

#

But the regex is right

sudden geyser
#

stackoverflow is your best friend

earnest phoenix
#

Just

const str = '...', splitBy = 3;

Array.from({
  length: Math.ceil(str.length / splitBy)
}, (_, i) => str.slice(i * splitBy, i * splitBy + splitBy));``` :mmLol:
#

No need for regex

sudden geyser
#

yuck

cinder patio
#

Using match works

#

kinda

#

not really

lyric mountain
#

That is right tho

#

Every 4 chars

cinder patio
#

not really cause rld is not in the array

#

The string length will have to be a multiple of 4

sudden geyser
lyric mountain
#

/.{1,4}/

cinder patio
#

Surprisingly enough a for loop is faster, at least on chrome

lyric mountain
#

It is

boreal iron
#

Anything is faster than a regex

sudden geyser
#

no surprise

lyric mountain
#

Nothing can win against raw loops

cinder patio
#

The regex seems simple enough tho

#

Also Voltrex's version is 3 times slower than the regex version oop

lyric mountain
#

It is, like, you choose between speed or readability (kinda)

#

Loops are a lot larger, but faster

old cliff
#

is there any npm package or method to stringfy a function?
for a function it parses it into a string which can again be converted into a fucntion by parsing it again

lyric mountain
#

Regex is oneliner, but slower

cinder patio
boreal iron
#

He got is question answered already 1 h ago

old cliff
sudden geyser
#

for a function it parses it into a string which can again be converted into a fucntion by parsing it again
If you want to convert a string into a function, may I introduce you to our dangerous buddy eval

cinder patio
boreal iron
sudden geyser
#

And yes, you can stringify a function with toString()

old cliff
cinder patio
#

eval

old cliff
#

hmm.... but can I eval it with arrguments?

cinder patio
#

You eval it to get the function

#

and then you call it

#
let str = fn.toString();
const fnAgain = eval(str);
fnAgain();
old cliff
#

okeh

#

tenks

cinder patio
#

not 100% sure if that will work though

#

chrome doesn't allow me to test

old cliff
#

i'll check

boreal iron
old cliff
#

thanks

earnest phoenix
#

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

cinder patio
#

The regex version takes around 22ms, while yours takes 60ms

earnest phoenix
#

yea, calling Math.ceil() too many times screws it up as it seems

boreal iron
#

I got a flashback to the day Voltrex, Tim, a few others and me did that weird micro optimization just to see who was the fastest

earnest phoenix
#

Same lmao

boreal iron
#

Donโ€™t actually remember who won

lyric mountain
#

Tim

earnest phoenix
#

Didn't Tim win?

boreal iron
#

I would guess Tim just because he cheated somehow

#

Aye

lyric mountain
#

Tim has the optimize-inator 3000

boreal iron
#

lmao

#

Iโ€™m sure heโ€™s just a witch

earnest phoenix
#

Tim is the optimize-inator 3000

dusty axle
#

So question for here more about preference

#

Should I put my captcha under anti-raid or create a new category for it

slender thistle
lyric mountain
#

What does it do?

dusty axle
#

The captcha?

lyric mountain
dusty axle
#

Like your normal one sends to users DM and once verified will auto role

lyric mountain
#

Put under moderation

dusty axle
#

I thought about that because my antiraid run as a way to moderate admins more so with setting action limits

#

Such as you ban 3 people it will strip your roles, etc

lyric mountain
#

If it requires mod privileges, put under moderation

dusty axle
#

Ah true thx

lyric mountain
#

If it requires admin privileges, put under admin

dusty axle
#

Ahhhh

lyric mountain
#

Basically, the only kind of commands that'd be split into named categories would be user commands

#

(those which don't require any special perm)

boreal iron
#

if it doesnโ€™t require any privileges, put it into the trashcan

old cliff
#

is there a way to set every property of an object into a non object variable
like const {*} = myObj
where myObj is any object
I want a variable for each property without accessing it using the object

#

like if the object is {foo: "bar"}
I want variable const foo = "bar"

lyric mountain
#

Const {...} = myObj

#

Iirc

cinder patio
#

const { a, b, c, d, e } = myObj

boreal iron
old cliff
old cliff
lyric mountain
#

Why not just access the obj tho?

cinder patio
old cliff
#

can't...

rocky hearth
#

u have to define a variable at least

cinder patio
#

can you tell us why you think you can't?

old cliff
#

lmao... need a solution not a question...

lyric mountain
#

But we need the answer to know how to help

old cliff
lyric mountain
#

There are 0 scenarios where property accessing is not an option

left escarp
#

Hi

earnest phoenix
#

One of my friend is saying he will just take code from GitHub or any yt video and make bot from that and then he will public it .. is this fine? I guess it should not ๐Ÿค”

lyric mountain
#

No it's not

#

He'll promptly be declined

#

Because of plagiarism

boreal iron
#

Or just because it wonโ€™t work okeh

earnest phoenix
#

Alright I will tell him ty

sudden geyser
#

If he's not adding it to a bot list that rejects plagiarized bots and is using whatever licenses provided correctly, he probably could host it.

earnest phoenix
lyric mountain
#

Is there any botlist that allows plagiarism tho?

sudden geyser
#

probably not

lyric mountain
#

That's very risky for the site

earnest phoenix
#

Yea

sudden geyser
#

How so?

rocky hearth
#

that's not possible

lyric mountain
#

Idk but sites/services that allow such stuff never live too long to tell the history

#

People get upset with it

earnest phoenix
earnest phoenix
sudden geyser
#

I'm thinking more about the licenses for the work (e.g. MIT and Apache) that allow you to use the software with a few restrictions (so if it could be downloaded that would be the creator's problem anyway). No bot site is going to allow plagiarism anyway since it encourages generic bots

boreal iron
#

Well it has nothing to do with the common web so itโ€™s irrelevant

earnest phoenix
#

Well yeah

sudden geyser
#

It's possible.

cinder patio
#

explain why you want to do that...

sudden geyser
#

But you probably don't need it.

#

You likely would not be making your code any better and more difficult.

#

Given you're relying on JavaScript's dynamicness to create variables from identifiers (strings in this case) then (most likely) wanting to use it as a regular variable.

#

You can get all the keys off an object with Object.keys

#

You could then do something like eval or use global/globalThis/window to set it globally

#

Then figure out how to use it in your program

#

Unless your intent is to populate it with variables you don't explicitly access or need to do arbitrarily.

cinder patio
#

global[key] = obj[key]; also works, but here's the thing...

#

you cannot access those properties if you don't know the keys

#

so why the fuck won't you do
const {key} = obj

lyric mountain
#

It'd actually be like those diy videos where the dude use a soldering iron and a shitton of materials to make a soldering iron

sudden geyser
#

A $5,000 gaming PC to play Minecraft.

rocky hearth
#

has anyone worked with tailwind's headless-ui?

sterile lantern
#

what type of color is this called; 0x3498db

#

i dont think its hex or rgb

#

its used in lua but i forgot the name

lyric mountain
#

It's hex

#

0xRRGGBB is the same as #RRGGBB

#

Technically, you could also call that byte notation nvm, byte notation would be binary

sterile lantern
#

ah i see

lyric mountain
#

So yeah, hex

rocky hearth
#

#4b8 == #40b080 OR #4b8 == #4fbf8f??

lyric mountain
#

Neither

#

#4b8 == #44bb88

rocky hearth
#

y though?

lyric mountain
#

Idk, css thing

eternal osprey
#
let datajson;
let myVar;
var request = require('request');
var options = {
  'method': 'GET',
  'url': '',
  'headers': {
    'Authorization': ''
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
myVar = response.body

});
  const m = myVar.find(json => json.metadata.discordid === message.author.id);``` why is this last line giving me the error: cannot read property find of undefined
lyric mountain
#

Three digits are taken as doubles

eternal osprey
#

the console.log(response.body) logs perfectly fine.

lyric mountain
#

So f becomes ff

#

Black is #000

vivid fulcrum
#

bytes*

lyric mountain
#

And white #fff

sudden geyser
#

also don't use the request library.

eternal osprey
sudden geyser
#

It's been deprecated for a year roughly.

#

Callbacks are not promises.

vivid fulcrum
#

in order to get a 16 bit color you need to have 2 bytes, hence why the notation is RRGGBB

sudden geyser
lyric mountain
#

Also note while #f00 is red, 0xf00 is actually green

vivid fulcrum
#

dude stop using request oh my fucking god this is the fifth time you got told

lyric mountain
#

Because it'll be left padded to 0x000f00

vivid fulcrum
#

uh

#

it should be right padded, no?

lyric mountain
#

Nope

#

Right zeroes mean greater value

vivid fulcrum
#

yeah ik that

#

huh interesting

lyric mountain
#

That's annoying af when dealing with int rgb and byte shifting

#

Someone make the calc to convert f00 to decimal plz

#

It's not 4 actually, was thinking with binary

cinder patio
#

google 0xF00 to decimal

lyric mountain
#

3840

#

Didn't want to search because am on mobile data

#

But anyway

quartz kindle
#

or just

#

hit f12 > console > type 0xF00

lyric mountain
#

am on mobile data

quartz kindle
#

tldsb

#

(too long, didnt scroll back)

lyric mountain
#

You what?

#

Damn future insight

quartz kindle
#

delete x plus 1 messages

#

wut

#

oh you're fetching them beforehand?

#

you dont need to

#

if you want to fetch them beforehand, you can fetch with before: message.id

#

otherwise you can directly use bulkDelete(number)

#

instead of a collection of fetched messages

#

nope

lyric mountain
#

Just remember max will be 99 not 100

quartz kindle
#

you can run bulkdeletes in a loop until you reach the amount

#

dpy does that automatically for you

#

djs doesnt

earnest phoenix
#

Hi

rocky hearth
#

ifaik, bulkDelete has a option to fetch the required messages to delete

#

without it, it only deletes the already fetched messages

quartz kindle
#

it automatically fetches them

cinder patio
#

Turns out writing a recursive descent parser for a pretty dynamic language is pretty hard

lyric mountain
#

Descent?

eternal osprey
#

const m = myVar.find(json => json.metadata.discordid === message.author.id);myVar.find is not a function. Does anyone know why this is happening>?

#

myVar is a long list of arrays

lyric mountain
#

Are you sure it's an array?

eternal osprey
#

yup

#

can show you the console.log

#

one sec

#

owh no

#

it's an array in an object

lyric mountain
#

Then you need to get Object.values() of it

earnest phoenix
#

can some one help me on my bot

#

i have to screen share

fair axle
#

How can I convert snowflake to the timestamp?

quartz kindle
#

if you're using discord.js you can use the snowflake util functions

fair axle
#

I am using djs but which function?

#

Which snowflake util function

eternal osprey
earnest phoenix
#

anyone?

tardy lion
#

getting this error trying to push to a github repo

! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/twtg93/funkinsrc.git
#

nvm

#

it works

vagrant prairie
#

thats a ptero problem

#

open package.json and send the code

#

only package.json

earnest phoenix
#

which 1 the one inside of node_nodules

vagrant prairie
#

no

#

the main one

#

and tell me ur file name

earnest phoenix
vagrant prairie
#

whats ur main file name?

earnest phoenix
vagrant prairie
#

like

#

is it bot.js

earnest phoenix
#

index.js

vagrant prairie
#

ah

earnest phoenix
#

?

vagrant prairie
#

send beg.js

earnest phoenix
vagrant prairie
#

eeeeeeeee

#

found ur error

#

u didnt install parse ms

earnest phoenix
#

huh i did

vagrant prairie
#

npm i <package name>

#

thats weird

earnest phoenix
#

ok i will try again

vagrant prairie
#

the problem's in ```js
const ms = require('parse-ms')

earnest phoenix
#

i told me tochange parse-ms index.js to idex.cjs

vagrant prairie
#

as seen from the error

#

eee

earnest phoenix
fair axle
gray stratus
earnest phoenix
vagrant prairie
#

also

vagrant prairie
lament rock
vagrant prairie
#

eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee

fair axle
#

discord.js

lament rock
#

Discord.SnowflakeUtil.deconstruct(id).timestamp

earnest phoenix
wild swan
#

hello there, i would like to start using ninjabot, i want try free trial key, where can i find him? ๐Ÿ™‚

vivid fulcrum
#

peek-a-boo ๐Ÿ™ˆ

earnest phoenix
#

wow

vivid fulcrum
#

you're in the wrong channel

fair axle
earnest phoenix
vagrant prairie
#

not idex.cjs

earnest phoenix
#

?

vagrant prairie
#

that u made accidently rn

#

or the file name

#

in the folder

earnest phoenix
#

?

vagrant prairie
#

was the file name index.cjs or idex.cjs

earnest phoenix
#

it said change the index.js in parse-ms

#

index

vagrant prairie
#

eeeeeeeeeee

earnest phoenix
#

should i try and download npm i ms

vagrant prairie
#

yeah

#

what even is the difference between parse-ms and ms thonkG

earnest phoenix
#

idk

vagrant prairie
#

@earnest phoenix install ms then

earnest phoenix
#

they

vagrant prairie
#

use

earnest phoenix
#

are as dumb as each other

#

to use

vagrant prairie
#
const ms = require('ms')```
#

once upon a time when i used windows

#

i couldnt install quick.db

earnest phoenix
vagrant prairie
#

;-;

earnest phoenix
#

๐Ÿ˜ฆ

vagrant prairie
earnest phoenix
#

yes

#

in where

vagrant prairie
#

beg.js

#

remove const ms = require('parse-ms')

earnest phoenix
#

no

boreal iron
#

Did you actually read the error message and use import instead of require?

earnest phoenix
#

ok i will try

boreal iron
#

I mean the explanation is absolutely accurate

earnest phoenix
#

i dose not work

boreal iron
earnest phoenix
#

im good i think i am just doing more packajes

boreal iron
#

Alright

eternal osprey
#

what is eris? never heard of it

regal creek
eternal osprey
#

ah it's a library

boreal iron
#

To quote Mr Erwin: Your solution is called Detritus

regal creek
#

No ๐Ÿงข

vagrant prairie
#

no

#

djs better

#

:))

regal creek
#

No

vagrant prairie
#

yes

regal creek
#

shut

vagrant prairie
regal creek
#

Liar

vagrant prairie
regal creek
vagrant prairie
boreal iron
vagrant prairie
#

Yes

vagrant prairie
#

dms

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

vivid fulcrum
#

functional programming in a nutshell

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

vivid fulcrum
#

doggowave same xd ive been so busy recently

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

vivid fulcrum
#

my school got me busy working on a chrome extension that helps out dyslexic people

#

and for my final programming project

#

i made a hand gesture detector with opencv

#

specifically opencvsharp cause not working with c# is lame

#

so uh

#

that's fun

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

vivid fulcrum
#

make a cheat with unmanaged c#!!

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

vivid fulcrum
#

:((

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

vivid fulcrum
#

at this point you need to be really creative because windefender detects almost all patterns related to malware, especially in c#

cold meteor
#

C++

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

vivid fulcrum
#

ive had someone sent me an app that has a compiled dll in the code as a byte array and then uses that, the dll is what had malware inside of it but windefender detected that too

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

vivid fulcrum
#

practice practice and practice

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

vivid fulcrum
#

a big problem here is that people are afraid to try and afraid of their code not working

sage bobcat
#

One message removed from a suspended account.

vivid fulcrum
#

oh

#

well

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

vivid fulcrum
#

it comes back to you really quickly

#

you should start working with unmanaged c#

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

lucid prawn
#

I got a channels error

sudden geyser
#

You need to help us help you.

#

Where are you getting the error?

lucid prawn
#

My bot said this

#

Sorry we detected a error cutie here is the error senpai: TypeError: Cannot read property 'channels' of undefined

lyric mountain
#

That's a cringe error message

lucid prawn
#

Lol

lyric mountain
#

You're trying to get channels of an invalid object

lucid prawn
#

Ok so how me fix
It worked with my jail command

prime mist
#

null is a billion dollar mistake, and undefined is just as bad.

lucid prawn
#

I will just redefine gulid

#

Then

earnest phoenix
sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

earnest phoenix
earnest phoenix
sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

earnest phoenix
sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

okk

sage bobcat
#

One message removed from a suspended account.

mystic harness
#

hello

#

i need help

#

is this good for vote webhook?

#

// Install discord.js module with `npm install discord.js`const Discord = require('discord.js');// token is the discord bot token, apiToken is the top.gg API tokenconst { token } = require('./config.json'); // Create Discord Bot Clientconst client = new Discord.Client() // THIS IS THE IMPORTANT PART // Variable for the channel were we'll send messages when users vote for the bot, this wont be used if you don't set a value for it as we do in the client.once('ready') event in this filelet channelForWebhooks; // Get the top.gg API token from the config fileconst { apiToken } = require('./config.json'); // Make sure to install this with 'npm install dblapi.js`const DBL = require('dblapi.js');// The webhookPort can be whatever you want but make sure you open that port in the firewall settings (for linux for example you can use `sudo ufw allow 8000`)// The webhookAuth is set by you, make sure you keep it secure and don\'t leak itconst dbl = new DBL(apiToken, { webhookPort: 8000, webhookAuth: 'anyPassword' });

#

// When the webhook is ready log it to the console, this will log `Webhook up and running at http://0.0.0.0:8000/dblwebhook`dbl.webhook.on('ready', hook => { console.log(`Webhook up and running at http://${hook.hostname}:${hook.port}${hook.path}`);}); // This will just log errors if there are anydbl.on('error', e => { console.log(`Oops! ${e}`);}) // When the webhook receives a votedbl.webhook.on('vote', async vote => { // This will log the whole vote object to the console console.log(vote) // Get the Discord ID of the user who voted const userID = vote.user; // If the channel to send messages in exists, we send a message in it with the ID of the user who votes if(channelForWebhooks) await channelForWebhooks.send(`User with ID \`${userID}\` just voted!`);}) // END OF IMPORTANT PART // When the bot is ready...client.once('ready', async ()=> { console.log('Webhook Bot Tester launched!'); // Get the Discord Channel were we will send the message whenever a user votes for the bot // Replace channelID with a valid Discord Channel ID were your bot can send messages too channelForWebhooks = await client.channels.resolve('channelID');}); // Login into the Discord Bot Client with the tokenclient.login(token);

vivid fulcrum
#

damn you didn't even bother removing the comments from whatever you copypasted

#

a new level of shameless

earnest phoenix
mystic harness
#

i copyed

mystic harness
#

now pls answer

sudden geyser
#

I hope you know we can't read it as is.

ember lodge
#

I am using CSS and how do I make it look like this?

#

instead of this

earnest phoenix
#

@ember lodge can you talk to me in dms

ember lodge
#

Current CSS:

margin-top: 1cm;
height: 30px; 
width: 10cm;
border-radius: 20px;
border-color: #e6e5ea; 
background-color: transparent; 
outline: none; 
font-size: 30px; 
padding: 10px;
lyric mountain
ember lodge
#

I mean the input field

lyric mountain
#

what about it?

ember lodge
#

Mine has like a black line, and the other one has like a gray line

lyric mountain
#

adjust the border-color

#

make it lighter

ember lodge
#

the border color is th same one

earnest phoenix
#

hey @lyric mountain can we talk in dms for a sec

lyric mountain
#

the top one is blurred, that's why it appears lighter

ember lodge
#

@lyric mountain XDDD

#

Thanks for the help btw

lyric mountain
#

when in doubt, just press f12 and use inspect element to see the field's css

cosmic forum
#

Anyone know what font discord used here?

lavish bramble
#
if(msg.content === "!gif"){
msg.channel.send(searchForGif("spider"));  
}

My command

var GphApiClient = require('giphy-js-sdk-core')
const configg = require("./config.json")
const client = GphApiClient(configg.GIPHY_API)

const searchForGif = (gifName) => {
client.search('gifs', {"q": gifName, "limit": 1})
.then((response) => {
   var gif = response.data[0].url;
   return gif;
 })
 .catch((err) => {
  return err;
 })
}

module.exports.searchForGif = searchForGif

And my module
Its showing searchForGif is not a function

half spear
cosmic forum
#

Ok, thx

sudden geyser
#

It is Whitney. They default to a few other fonts as well

earnest phoenix
#

Hi I'm using pluris with typescript and I'm getting this error:

node_modules/eris/index.d.ts:2222:16 - error TS2428: All declarations of 'Message' must have identical type parameters.

2222   export class Message<T extends PossiblyUncachedTextable = TextableChannel> extends Base {
                    ~~~~~~~

node_modules/pluris/index.d.ts:111:13 - error TS2428: All declarations of 'Message' must have identical type parameters.

111   interface Message<T extends Textable = TextableChannel> {
                ~~~~~~~

node_modules/pluris/index.d.ts:112:82 - error TS2344: Type 'T' does not satisfy the constraint 'Textable'.
  Type 'PossiblyUncachedTextable' is not assignable to type 'Textable'.
    Type 'Uncached' is missing the following properties from type 'Textable': lastMessageID, messages, addMessageReaction, createMessage, and 12 more.

112     awaitReactions(options: ReactionCollectorOptions): Promise<ReactionCollector<T>>;
                                                                                     ~


Found 3 errors.
sudden geyser
#

~~@earnest phoenix I'm not experienced with TypeScript, but if I had to infer,

  • The first error means you're using type parameters where you don't need them (since you never go generic over a type other than TextableChannel).
  • Same as first bullet.
  • The type you're giving a type parameter does not satisfy its requirements (aka what it has on it). The issue stems from Uncached missing properties that Textable requires.~~
#

In fact, this is occurring from a library. Dumb me.

ember lodge
#

@lyric mountain hey, here you can see the problem better

#

There is like a dark gray line

#

The input value should not have that

pale vessel
#

looks like border/outline

#

try border: none;?

marble silo
#

lol

sonic hill
#

aaa alg

sudden knoll
#

Right now I'm using sqlite3 to create a db. My issue is that whenever I reset the program I get the exception:
Exception has occurred: DatabaseError file is not a database
The program runs fine if the db is stored in the main directory. However, it fails on reset if it's stored in my child directory.
Functioning file structure and code:

โ”œโ”€โ”€ main.py
โ”œโ”€โ”€ arcade.db
# code works perfectly on reset
connection = sqlite3.connect('./arcade.db')

Non-functioning file structure and code:

โ”œโ”€โ”€ main.py
โ”œโ”€โ”€ db
โ”‚   โ””โ”€โ”€ arcade.db
# will run the first time without issues if the file doesn't exist
# will fail on reset since the file now exists
connection = sqlite3.connect('./db/arcade.db')

If anyone knows the issue and can help, I'd greatly appreciate it.

lavish bramble
#

I'm just testing api but after that I'm will use that in command handler

#

๐Ÿ˜

ember lodge
#

not the dark gray

pale vessel
#

maybe that's the border-top?

ember lodge
#

now looks like this

pale vessel
#

try inherit or use the same color as the primary one

ember lodge
#

they have the same color

lavish bramble
#

What is normalizedField?

pale vessel
#

context?

sudden geyser
sudden knoll
#

the only reason why it worked in the main directory was because I didn't change the s3 upload code to access from there

#

so I just scrapped it and put it on a vps so I won't have to upload to s3

lavish bramble
#
const { MessageEmbed, MessageAttachment } = require("discord.js");
const fetch = require("node-fetch");

module.exports = {
  name: "kill",
  description: "kill someone",
  category: "gifs",
  async execute(client, message) {
    let keywords = "anime wasted"
  let url = `https://api.tenor.com/v1/search?q=${keywords}&key=${client.configg.TENORKEY}&contentfilter=off`;
    
  let response = await fetch(url);
  let json = await response.json();
const index = Math.floor(Math.random() * json.results.length);
    
 const c = json.results[index].url
 
    const user = message.mentions.users.first() || message.author;
    const b = message.author.id === user.id ? "themselfs" : user.username;


const embed = new MessageEmbed()
      .setTitle(`${message.author.username} killed ${b} oops!`)
      .setFooter(message.author.username)
      .setColor("BLUE")
      
.setImage(c)
     
      .setTimestamp();

    message.channel.send(embed);
    console.log(c)
  }
};
#

Its not showing me the gif

#

Its showing like this

sudden geyser
#

Have you tried logging c

compact echo
#

uhm look at the last line Lite, they do log c

sudden geyser
#

Ah missed that

#

But what does it log?

cinder stratus
#

Well tenor doesn't return a buffer

sudden geyser
#

Is it a link to the regular site or a link to the direct image file

cinder stratus
#

Directly

#

Array<Object>

#

That's what it returns

lavish bramble
cinder stratus
#

Are you sure the gif is in url property

lavish bramble
#

Like this
https://tenor.com/#####.gif

cinder stratus
#

Lemme see the docs

lavish bramble
#

Ok i will check out also

cinder stratus
#

The gif is in media[index].gif.url

lavish bramble
#

Can I get docs?

cinder stratus
lavish bramble
#

So how can I solve this ๐Ÿค”

lyric mountain
#

Tenor is veeeery troublesome sometimes

lavish bramble
#

I have no other choice

compact echo
#

you could try the giphy api

#

I doubt it's any different

#

๐Ÿคทโ€โ™‚๏ธ

cinder stratus
#

Hmm

#

I have both

#

xD

lavish bramble
pale vessel
#

what's the problem

compact echo
#

^^^

#

seems like it's basically the same

#

well almost

lavish bramble
#

1 more thing when I use this without embed it showing me the gif
But not in embed

compact echo
#

hmmm

#

that's awkward

lyric mountain
#

Btw, I'd not trust sites like tenor, giphy or imgur for stuff like reaction gifs

#

You never know when an image will have the wrong tags in it

lavish bramble
#

I see

#

So can I make my own?

compact echo
#

I mean like just use express and create an endpoint

#

then just get a random url from an array of the gifs

ember lodge
#

How can i delete an array object by the name?

pale vessel
#

elaborate

bronze wind
#

Hi, I have a question, is there a way i can get the id of the user who reacted to an embed in the following code:

embedMessage.awaitReactions(filter, { max: 1, time: 10000 }).then(collected => { HERE is where i wanna use it })

I can use it inside the filter but i cant return it (?) or i dont know how, i can insert imgs of the code if necessary

cinder stratus
#

console.log collected

bronze wind
#

Thats what console log collected prints

cinder stratus
#

I'm not sure but try

#
collected.first().message.reactions
#

console.log that

pale vessel
#

use collected.first().users

cinder stratus
#

hmm

pale vessel
#

that would be a collection of users that reacted that emoji

#

i think it's a manager

#

you need to access cache

#

that would be the collection

cinder stratus
#
collected.first().users.cache.first()
lament rock
#

Does anyone happen to know if a bunch of Timers in NodeJS occupy a lot of cpu time? I'm considering changing an implementation to do Math based on Date entries to determine a value instead of using a Timer to reset a value.

bronze wind
#

Okay I'll try those options, thanks for the responses guys

#

collected.first().users.cache returns that, finally i found where the user id reaction is

#

collected.first().users.cache.first() doesnt seems to work since the first id is the bot's one

#

@cinder stratus @pale vessel thx

cinder stratus
bronze wind
#

Oh okay that will be useful too ty

bronze wind
cinder patio
cinder patio
#

you don't need to filter

bronze wind
#

Okay

thin echo
#

I made an avatar command and it works.... But the avatars are small and are stuck in that size, is here anyway I can enlarge it?

#
if (prefix.some(word => msg.content.startsWith(word + " avatar"))) {
    const avatarEmbed = new Discord.MessageEmbed()
      .setColor(0xf5d6ea)
      .setTitle(msg.author.username + "'s pfp")
      .setImage(msg.author.displayAvatarURL())
      .setFooter(msg.author.username + (`'s pfp`))
  msg.channel.send(embed=avatarEmbed)
  }```
feral perch
#

how can we use emojis on our server globally through the bot?

earnest phoenix
#

@feral perch wdym

cinder stratus
#

Check the options

thin echo
#

ok

earnest phoenix
#

*displayAvatarURL

thin echo
#

ok

cinder stratus
cinder stratus
#

displayAvatarURL({ size: 4096 })

earnest phoenix
#

you spelt it wrong in the documentation link

thin echo
cinder stratus
#

Oh my bad

earnest phoenix
#

and im 10% sure displayAvatarURL is djs v11 and avatarURL is v12

thin echo
#

thx

#

its bigger

cinder stratus
#

No it is in v12

earnest phoenix
#

nvm use displayAvatarURL

feral perch
cinder stratus
#

Yeah if the Bot has that emoji in its cache

feral perch
lavish bramble
#

Is it possible to use djs commando and command handler together

fresh verge
#

How do I use Await Message?

cold meteor
#

@feral perch if u put a \ infront of an emoji and then paste it itll give u the id. Eg: \:DancingMonke:

feral perch
cold meteor
#

Alright

cinder patio
cinder stratus
#

Yeah it has one inbuilt

earnest phoenix
#

Hej wiecie jak dziaล‚a yt bot?

lavish bramble
#

I wanna make game command

#

So

misty chasm
#

Can you help me with a PC config?
Intel i9 10900X series or Ryzen 7 3700X

earnest phoenix
#

gosh i hate these pro programmer guys

old cliff
#

is there a way to make variable from a string?

#

like
let str = "var1"

and I want a variable called var1

latent heron
#

Umm

#

As in the string content becomes the var name?

old cliff
#

yes

earnest phoenix
#

@old cliff globalobject[string] == value

#

you have to use the same method to get the variable value back

old cliff
#

no in object form....

latent heron
#

I dont think that's possible

earnest phoenix
#
eval(`var ${string} = "h";`);
#

@old cliff

old cliff
#

nvm... its impossible

latent heron
#

Yeah

#

Not with how you can declare that kind of stuff

earnest phoenix
#

@old cliff why do you even need that

latent heron
#

You could prob do it for local variable reference in a function or loop

#

It would be useful tbh

median iris
#

hello

#

can i get help?

#

hello?

#

@cinder patio

#

@earnest phoenix

#
        isValidURL(testContent) &&
        msg.channel.id !== '836159363872849980' &&
        msg.member.hasPermission('SEND_MESSAGES') 
    ) {
        msg.delete();
     msg.member.hasPermission('MANAGE_CHANNELS')

        msg.channel.send('You are not allowed to send links in this channel.');
    }```
earnest phoenix
#

WHY THE PINGS

#

Bye

median iris
#

Uhh

#

help

lusty quest
#

what is the issue?

median iris
#

issue is if the member has manage channels permission

#

the bot delete that link too

#

what is the code for that

#

Idk

lusty quest
#

bcs you delete the message and then check if he got the permissions

old cliff
median iris
#

so

#

i need to put that code upper

#

?

lusty quest
#

add a check around the url check that checks the permission of the author

median iris
#

Ok

#

ty

lusty quest
#

also hasPermission is deprecated

#

got replaced with permissions.has()

median iris
#

ok

cinder patio
#

But why tho

#

There shouldn't be a reason to be doing this

median iris
#

Can anyone tell me the code, if bot deletes an message then bot need to send it again

#

any code

#

coz idk

lusty quest
#

so if the bot deletes a message you want to send the message again?

earnest phoenix
#

Lmao

old cliff
lusty quest
median iris
#

ok

pearl trail
#

message.delete().then(msg => msg.channel.send(msg.content)) ยฏ\_(ใƒ„)_/ยฏ

prime mist
clear marlin
#

That's cool

#

Oh my God tbh @prime mist that's awesome!!

quick helm
#

-botinfo 832937425515970582

gilded plankBOT
#
Bot info
ID

832937425515970582

Username

Queen Olivia

Discriminator

1924

Short Description

Welcome images, memes, giveaways, Economy, fun, high admin info, moderation ,nsfw and many many more!

Library

undefined

Prefix

.

Total Upvotes

1

Monthly Upvotes

0

Server Count

No server count

Owner(s)

@quick helm
@hushed sun

clear marlin
quick helm
#

kk

knotty obsidian
#

How do I get the current day/month in java

gilded plankBOT
#
Bot info
ID

820977858344255499

Username

Supernova

Discriminator

4218

Short Description

Supernova is a small but useful bot, it includes | Moderation | Emotions | Games | music| everything that your server needs!

Library

undefined

Prefix

~

Total Upvotes

4

Monthly Upvotes

2

Server Count

No server count

Owner(s)

@cold meteor

cold meteor
#

Oh snap im so sorry weong channel

earnest phoenix
#

Error: \?\C:\Users\Lan\Desktop\jancok kau\node_modules\better-sqlite3\build\Release\better_sqlite3.node is not a valid Win32 application.
\?\C:\Users\Lan\Desktop\jancok kau\node_modules\better-sqlite3\build\Release\better_sqlite3.node
at Object.Module._extensions..node (node:internal/modules/cjs/loader:1167:18)
at Module.load (node:internal/modules/cjs/loader:988:32)
at Function.Module._load (node:internal/modules/cjs/loader:828:14)
at Module.require (node:internal/modules/cjs/loader:1012:19)
at require (node:internal/modules/cjs/helpers:93:18)
at bindings (C:\Users\Lan\Desktop\jancok kau\node_modules\bindings\bindings.js:112:48)
at Object.<anonymous> (C:\Users\Lan\Desktop\jancok kau\node_modules\better-sqlite3\lib\database.js:9:24)
at Module._compile (node:internal/modules/cjs/loader:1108:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
at Module.load (node:internal/modules/cjs/loader:988:32) {
code: 'ERR_DLOPEN_FAILED'

#

help plz

cinder stratus
#

Just convert all the members collection into array and choose one from it and mention it

fleet current
#

First get a list of all the people in a server then random

#

yeq

cinder stratus
#

Hnm

forest juniper
fleet current
#

uh

cinder stratus
#

๐Ÿ˜‘

fleet current
#

Read the doc

earnest phoenix
#

Error: \?\C:\Users\Lan\Desktop\jancok kau\node_modules\better-sqlite3\build\Release\better_sqlite3.node is not a valid Win32 application.
\?\C:\Users\Lan\Desktop\jancok kau\node_modules\better-sqlite3\build\Release\better_sqlite3.node
at Object.Module._extensions..node (node:internal/modules/cjs/loader:1167:18)
at Module.load (node:internal/modules/cjs/loader:988:32)
at Function.Module._load (node:internal/modules/cjs/loader:828:14)
at Module.require (node:internal/modules/cjs/loader:1012:19)
at require (node:internal/modules/cjs/helpers:93:18)
at bindings (C:\Users\Lan\Desktop\jancok kau\node_modules\bindings\bindings.js:112:48)
at Object.<anonymous> (C:\Users\Lan\Desktop\jancok kau\node_modules\better-sqlite3\lib\database.js:9:24)
at Module._compile (node:internal/modules/cjs/loader:1108:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
at Module.load (node:internal/modules/cjs/loader:988:32) {
code: 'ERR_DLOPEN_FAILED'

#

help

#

asap

earnest phoenix
#

code wat

pearl trail
earnest phoenix
#

this node_modules

#

@fleet current

cinder stratus
#

Sounds suspicious like making a raid Bot or something

pearl trail
#

yeah it's more simple

sand walrus
#

(node:12448) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added to [Client]. Use emitter.setMaxListeners() to increase limit (Use node --trace-warnings ...to show where the warning was created) PS C:\Users\andre\OneDrive\Desktop\BOT DISCORD\ZeraBot>node --trace-warnings ...`
ode : Termine '
ode' non riconosciuto come nome di cmdlet, funzione, programma eseguibile o file script. Controllare l'ortografia del nome o verificare che il percorso sia incluso e
corretto, quindi riprovare.
In riga:1 car:1

  • node --trace-warnings ...
  •   + CategoryInfo          : ObjectNotFound: (
    

ode:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException` i have this problem when i digit my command for reddit's meme and install the **got **library

#

is in italian sorry

forest juniper
#

thought i'd try to ask for some help on achieving that

cinder stratus
cinder patio
earnest phoenix
#

Error: \?\C:\Users\Lan\Desktop\jancok kau\node_modules\better-sqlite3\build\Release\better_sqlite3.node is not a valid Win32 application.
\?\C:\Users\Lan\Desktop\jancok kau\node_modules\better-sqlite3\build\Release\better_sqlite3.node
at Object.Module._extensions..node (node:internal/modules/cjs/loader:1167:18)
at Module.load (node:internal/modules/cjs/loader:988:32)
at Function.Module._load (node:internal/modules/cjs/loader:828:14)
at Module.require (node:internal/modules/cjs/loader:1012:19)
at require (node:internal/modules/cjs/helpers:93:18)
at bindings (C:\Users\Lan\Desktop\jancok kau\node_modules\bindings\bindings.js:112:48)
at Object.<anonymous> (C:\Users\Lan\Desktop\jancok kau\node_modules\better-sqlite3\lib\database.js:9:24)
at Module._compile (node:internal/modules/cjs/loader:1108:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
at Module.load (node:internal/modules/cjs/loader:988:32) {
code: 'ERR_DLOPEN_FAILED'

forest juniper
#

that just pings some random dude when you @ someone

cinder patio
#

Stop spamming erroressages without any context @earnest phoenix

sand walrus
#

i create a own bot

cinder stratus
#
require('events').setMaxListeners(0)
``` iirc
cinder patio
#

Yes, that's a trivial feature that a lot of bots have

clear marlin
forest juniper
#

also I'd like the bot to be called someone so you can actually ping @ someone

#

well i could just nick it

#

what bots have that option?

cinder patio
#

Can't name one of them cause I don't use any bots but surely you can find one on top.gg

forest juniper
#

ok ill look

clear marlin
#

just fetch all the members in the guild and then randomly ping someone

forest juniper
#

i have no experience coding bots pain_lifeispain

clear marlin
#

decent, neither do I

cinder stratus
#

๐Ÿ˜‚

sand walrus
cinder patio
#

That won't solve the error

forest juniper
#

YES I found a bot that does exactly what I want and its called "someone" les go

cinder patio
#

good job

cinder stratus
#

Like whatever you have index.js

#

Or whatever

cinder patio
#

That just avoids the error, If I can't see the errors in the terminal then it's okay amirite

cinder stratus
earnest phoenix
#

ERR_DLOPEN_FAILED'

#

who can help me

cinder patio
#

oop

earnest phoenix
#

?

cinder patio
#

wrong reply

cinder stratus
#

Wrong message

earnest phoenix
#

tf

#

F

#

help me plz

cinder patio
earnest phoenix
#

Error: \?\C:\Users\Lan\Desktop\jancok kau\node_modules\better-sqlite3\build\Release\better_sqlite3.node is not a valid Win32 application.
\?\C:\Users\Lan\Desktop\jancok kau\node_modules\better-sqlite3\build\Release\better_sqlite3.node

#

that

#

u can help me

#

better_sqlite3.node is not a valid Win32 application.

cinder stratus
#

It's kind of getting annoying

sand walrus
#

what are a listeners??

cinder patio
#

.on

#

for example client.on(...

pearl trail
earnest phoenix
#

ok

sand walrus
#

how can fix this problem

clear marlin
#

check the issue

#

he just sent you

pearl trail
#

you need x64 arch

cinder patio
cinder stratus
#

So you can't run that on x86 arch

pearl trail
#

idk, it was mentioned here
You should use Windows x86 OS for building your project because the better-sqlite3 has native dependencies. I use this way for my electron app.

cinder stratus
#

So is he using x64 arch os for x86 arch PC or something like that

pearl trail
#

x86 arch is x64 afaik

#

eh

cinder stratus
#

Hmm

pearl trail
#

x86 is x32 yes

cinder stratus
#

Yeah made me confused for a sec

sand walrus
pearl trail
cinder patio
pearl trail
#

x64 is the architecture name for the extensions to the x86 instruction set that enable 64-bit code.

cinder stratus
#

Interesting

sand walrus
cinder patio
#

That's the problem then

#

you should have only 1 message listener

pearl trail
#

never use event inside event

#

except .once ig

cinder patio
#

As long as you're removing the listener at some point events inside eventa are fine

#

but using multiple message listeners for every single command is bad

cinder stratus
pearl trail
#

ah

sand walrus
#

there are a methods for substituting this multiple listeners??

cinder patio
#

if / switch statements

#

or having an actual command handler

sand walrus
#

@cinder patio would you have my bot code on github link??

earnest phoenix
#

?

cinder patio
#

can you elaborate

unborn marsh
#

how can i get the snowflakes posted by top.gg in spring boot ?

sand walrus
#

i fix the problem

#

i create 4 command for 4 subreddit memes

earnest phoenix
#

and?

cinder stratus
#

Is he an idiot

#

4 commands for 4 memes

#

Use args or something

cinder patio
#

oh geez

stiff lynx
#

https://srcb.in/wJl7Y2MeiA
Pls help with my leaderboard, I have a lot of trobles!
In the sourcebin link there is the mongoose schema and the leaderboard code.
The leaderboard code outputs only me

old cliff
#

I found a way to access all properties of an object without using an object

for(prop in myObj){
    global[prop] = myObj[prop];
}
#

๐Ÿง 

lusty quest
#

also imports are case sensitive

#

you probably want to change your export in the model to something more meaningful

stiff lynx
lusty quest
stiff lynx
#

and how can I fix it?

lusty quest
#

read the mongodb docs for how to query MongoDB, also like ive said your import of the model probably dont work

stiff lynx
#

i should do like const leaderboard = await profileSchema.findOne(?

lusty quest
#

fineOne will only find one document

#

profileSchema.find() should return all documents

stiff lynx
#

but if I found all the documents and I map them?

lusty quest
#

is one way to handle it

stiff lynx
# lusty quest is one way to handle it
            guildID: message.guild.id
        }, (err, guild) => {
            if(err) console.log(err)
            if(!guild) {
                const newGuild = new Guild({
                    _id: mongoose.Types.ObjectId(),
                    guildID: message.guild.id,
                    guildName: message.guild.name,
                    prefix: process.env.PREFIX
                })
                newGuild.save()
                .then(result => console.log(result))
                .catch(err => console.log(err));```
#

for example calling like this in a variable and after doing, in this case, settings.map

#

should work?

lusty quest
#

try and see

stiff lynx
#

are thaths the thing that I dont get

#

and mongo docs says to use $sort but when I tried never worked ๐Ÿ˜ฆ

lusty quest
#

just just use it wrong then

stiff lynx
#

but for me that I'm a newbie are super hard thats docs

lusty quest
#
const leaderboard = await model.find({},{$sort: {xpfield:1})
``` replace 1 with -1 if its the wrong orientation
lusty quest
stiff lynx
stiff lynx
lusty quest
#

try harder

stiff lynx
#

I told u, I'm a newbie, in 1 month I've learnerd a lot of things

#

my bot is 1 month ppld and works

cinder patio
stiff lynx
#
      const leaderboard = await profileModel.find({
        userID: member.guild.id,
        bank : 
      },{$sort: {bank:-1})```
#

In bank, what should i PUT?

modest maple
lusty quest
#

did you have a plan what you do there?

#

like you tell mongoDB that you want only a document where the userID is the given id and then also it has to be a spezific bank thing?

old cliff
quartz kindle
#

child processes dont share global variables

stiff lynx
lusty quest
#

the way you do it currently asks for one spezific thing, but you want it not this precise for the leaderboard.

stiff lynx
#

the actual output Is good, because I am in the leaderbord and 3786 are my coins

lusty quest
#

is there only one document or mutiple?

stiff lynx
#

multiple, but all the console.log gives me 3786 coins for everyone, but outputs Only me

#

at the beggining was an output made by 10 people with 3786 coin

lusty quest
#

bcs like ive told you, you narrow your query to a point where it only returns one document

#

instead of userID and bank i suggest to use guildid only so you get the leaderboard for this one guild

stiff lynx
#

Is the unique that made al the documents different

lusty quest
#

you dont need the userid

stiff lynx
#

but why not

lusty quest
#

bcs mongodb will then only get the document where the userid is present

#

if you pass the guildid it will return all documents with the guild id

stiff lynx
#

I should use userID or guildID withoht difference Only if my bot Is in One guild

#

right?

lusty quest
#

i think you dont really get how mongodb works

stiff lynx
#

I think the same

lusty quest
#

that you have unique IDs for the userid is ok, but will cause issues if your bot goes into mutiple guilds

stiff lynx
#

my bot Is in 2 guilds right now

lusty quest
#

what if 1 user is in both guilds?

#

he wont be able to get data stored for both guilds

stiff lynx
#

a lot of users are in both

#

One guild Is made by 250 people and the second One Is made by 50

lusty quest
#

there are mutiple ways to solve the issue. one is nesting object, the other one is using a unique id for each guild. like guildid+userid

stiff lynx
#

for examole my .beg and .bal works in both

lusty quest
#

this is probably down on how you query the database.

lusty quest
#

no

stiff lynx
#

If I change in my actual code the user ID with guild ID It could work?

lusty quest
#
const profileSchema = new mongoose.Schema({
    serverID:         {type: String, require  : true, unique   : true },
    users:  [{userid:String, Bank:Array}],
});```
this is one way to solve it, but a bit harder to use if you dont know how.
zenith terrace
#

what trynna do

lusty quest
#
const profileSchema = new mongoose.Schema({
    uniqueID:         {type: String, require  : true, unique   : true },
    serverID:       {type: String, require  : true                  },
   userID:       {type: String, require  : true                  },
    coins:          {type: Number, default  : 10                    },
    bank:           {type: Number, default: 0                                   },
    tier:           {type: Number, default: 0                       }, 
    nlavoratori:    {type: Number, default: 1                       }, 

});
``` would also work
#

as unique ID you can pass something like guildid+userid

#

would make a snowflake that wont cause issues if your bot and users share mutiple guilds

stiff lynx
#

but, if I change the schema rn, It Will change in mongodb?

zenith terrace
#

trying to make a lb command and post top like 10 highest numbers?

lusty quest
#

yes, but there are a lot of issues.

stiff lynx
#

lol

lusty quest
#

i just tell the truth lol

stiff lynx
#

np

lusty quest
#

i would say a lot of it is down due to language barriers

stiff lynx
#

what do you mean?

lusty quest
#

i think a lot of the stuff ive told you you dont really understand due to a language barrier.

stiff lynx
#

I think the same, and I'm really sorry for this, U really tried in helping me and I'm very grateful

lusty quest
#

nah no problem

zenith terrace
#

idk how to help, the code is different from what i'd use

#

I can check later

lusty quest
#

the code he provided in the sourcebin is mostly useless

#

exept the model

stiff lynx
#

I should start from 0

#

for doing that leaderbord comando

lusty quest
#

the thing with the snipped you provided initially is that your code doesnt call the database at all

zenith terrace
#

oh I might have an idea

stiff lynx
zenith terrace
#

first of all do you want to show the bank, coins or both in total?

#

@stiff lynx

worn sonnet
#

async or sync? which one is better?

#

i'm using aiohttp lib for making requests

stiff lynx
zenith terrace
#

do you want them seperate or total

#

as in put together

stiff lynx
#

Total

zenith terrace
#

ok

#

ah ffs, for me to help you would need to add to the schema a totalAmount

#

which is basically .coins + .bank

stiff lynx
zenith terrace
#

secolare?

stiff lynx
#

declare

#

here

#

in the schema

zenith terrace
#

you can try using .updateOne, but I cant help rn

stiff lynx
#

because for my .double command I use bank I and I would like to do somethin like .rob in the future

#

so lets use bank

cinder stratus
#

Upto you

zenith terrace
#

ok bank it is

slender thistle
worn sonnet
#

i mean using that lib is kinda hassle

#

but few say using async is better

slender thistle
#

If you're going with d.py, use async because it's async

worn sonnet
#

and since the whole .py is async

slender thistle
#

I use requests in my cronjob that runs every hour BepShrug

#

Since I'm not doing anything that needs concurrency, I don't need to make it asynchronous

zenith terrace
# stiff lynx lets make easier, lets use bank for leaderboard

so since you have done most of it its basically just editing some of your code but for me the easiest way to probably do it is to first get the guildID from the database

let user = await profileModel.find({
        guildID: message.guild.id
        })```

then use `let index = 0;` which will help with the leaderboard numbers

then all you need to really do is sort the users in order. Then user `.slice` to get the first 10 users. 
You already did some of it so all you really need to do after is map it

```js
let user2 = user.sort(function(b, a){return a.bank-b.bank}).slice(0, 10).map(user3 => `${++index}. <@${user3.userID}> - ${user3.bank}`)```
pale vessel
#
arr.map((elem, index) => `${index + 1} foo`)```
lusty quest
zenith terrace
#

I mean

#

true

#

but I find that this way was easier, but if theres an easier way

#

then add onto it

lusty quest
#

for the leaderboard i would use find not findOne

zenith terrace
#

a I said findOne

#

whoops

lusty quest
#

find one only works if you use nested arrays / objects

#

(in this case)

zenith terrace
#

yee my mistake typing findOne

earnest phoenix
lusty quest
#

depends on the context, some stuff makes no sense to run async

earnest phoenix
#

well requests do

cinder stratus
#

@earnest phoenix dms dude

slender thistle
#

Requests don't always need to be async

umbral zealot
#

don't you have to, like, configure your server and authentication when you use mongoose? I don't see you doing that

rocky hearth
#

I want replace all occurrences of stroke-[a]bc to stroke-[A]bc. Where a is any letter which gets capitalize.

umbral zealot
#

You'll need a regex for that, make sure to escape the brackets with \[ and \] because those are special regex characters.

slender thistle
#

Raw strings ftw

zenith terrace
umbral zealot
#

I mean... an actual login. the URL to mongo.

cinder stratus
umbral zealot
#

No because they're importing mongoose here and doing a Collection initialisation.

rocky hearth
#

which would be more better? mongoose or firestore?

cinder patio
#

firestore is a cloud database, mongoose is an ORM for mongodb - which could be on the cloud, or you can host it yourself

#

if you're looking for a cloud database, I think either one is fine

#

but honestly it's better to host the server yourself for bigger projects

#

though cloud services make scaling a lot easier

#

eh, both are good choices

#

cloud services get too pricey tho

quartz kindle
#

sqlite is more than enough for most projects tbh

cinder patio
#

kinda hard to scale though, no?

quartz kindle
#

depends on your needs

#

the only thing sqlite cant do is concurrent writes, but most projects wont ever reach such scale

umbral zealot
#

Depends on what you mean by "scale" because really sqlite can store terrabytes of data and be read on a pretty massive scale before it has any issue.

quartz kindle
#

sqlite with sychronous:off will queue all writes at the OS level, so it doesnt block your app, even if you multithread

umbral zealot
#

Just because it doesn't have a special TCP protocol and server, doesn't mean it's not a perfectly valid database ๐Ÿ˜„

quartz kindle
#

thats precisely what makes sqlite so good

#

not having to run ginormous server databases for small apps