#development

1 messages · Page 1744 of 1

gray bronze
#

There is no image at all now

glad cobalt
#

ToLowercase still isnt a function....

#

AHH-

gray bronze
#

Let me grab my code

pale vessel
#

It's toLowerCase()

crimson vapor
#

.toLowerCase()?

gray bronze
#

Yes

glad cobalt
#

java script

gray bronze
#

.toLowerCase()

crimson vapor
#

javaScript

glad cobalt
#

I'll try

pale vessel
#

ecmaballs

gray bronze
#

It will work

#

I have it myself

glad cobalt
#

still no

gray bronze
#

Has to

pale vessel
#

skill issue

crimson vapor
#

its correct lmfao

gray bronze
#

Yeah

crimson vapor
#

@pale vessel I think im just about done, my english file is 200 lines

glad cobalt
#
const command = args.shift().ToLowercase();
pale vessel
#

what, english?

crimson vapor
#

en-US.ts

gray bronze
#

Bruh

pale vessel
#

wait wtf

crimson vapor
#

a

pale vessel
#

didn't you start with english?

crimson vapor
#

yes

#

I added more

gray bronze
#
const command = args.shift().toLowerCase()

@glad cobalt

pale vessel
#

what did your commands use then

#

if english wasn't a thing

molten lagoon
#

GUYS PLSSSS HELP

glad cobalt
#

well

crimson vapor
#

I mean it was but now I added the descriptions and usage and shit

#

test

pale vessel
#

oh

#

there were placeholders?

molten lagoon
#

my bot dm-ed me with something horror Pls Help

teal wren
#

Hai

molten lagoon
#

I Didnt Dm Him

#

or put a command

#

pls help

#

im scarred

#

idk if i got hacked

dusky sundial
#

Regen your token

crimson vapor
#

no I mean I used to have it cmd.description and now its CMD_${cmd.locale}_DESCRIPTION @pale vessel

molten lagoon
gray bronze
#

Could anyone help me with the CSS on the site?

molten lagoon
#

he is acting strange

dusky sundial
glad cobalt
#

I've done that no errors, but it doesn't shift into lowercase or delete the -

#

so the command doesn't work

gray bronze
#

I want to do an image as background but it repeats itself

pale vessel
dusky sundial
crimson vapor
#

yes

earnest phoenix
crimson vapor
#

so thats why its 200 lines

gray bronze
#

Ill try it thx

pale vessel
#

ahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh

#

i seeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee

crimson vapor
#

ye

glad cobalt
#

eg

#
client.on("message", async message => {


if(message.author.bot) return;

if(message.channel.type == 'dm') return;


if(message.content.startsWith(prefix)){


const args = message.content.slice(prefix.length).trim().split(/ +/);


const command = args.shift().toLowerCase();


const commandToRun = client.commands.get(command)

if (!commandToRun) return;

try {

commandToRun.run(client, message, args);

} catch(error){

console.log(error); 

}

}

})
#

the } are in right place

#

just the copying was trash

earnest phoenix
#

The code looks fine, if it doesn't execute any of the commands, it can't find that command in the collection, try logging command

#

And format your code, my god notlikethis

slender thistle
#

No indents

#

Python triggered sounds

glad cobalt
#

LOLOLO

earnest phoenix
#

Hey can we make a command in which messages by specific user gets deleted
Using discord.js in nodes.js

pale vessel
#

Check the author ID

dense spire
#

is it possible to use thread locks with asynchronous methods?

#

for python

#

threads arent really the same but is there possibly a similar concept that would work for asynchronous methods

slender thistle
#

asyncio locks?

dense spire
#

i c

#

thank you

rocky hearth
#

what does this do in python?
a ,= b

#

is it, a = (a, b)?

deep mantle
#

The second one would set A to a tuple

dense spire
#

does that exist in python?

slender thistle
#
>>> a,b,c ,= 1,2,3
>>> a
1
>>> b
2
>>> c
3
#

which is literally the same as a,b,c = 1,2,3

#

Well, sort of. ,= errors if there's too many or too few values to unpack

rocky hearth
#

then what actually is ,= operator.

slender thistle
#

unpack and assign

#

Which Python just so happens to do with = already

rocky hearth
#

ok

#

and is there any easy way to fetch all the messages, in certain period of time? in djs

onyx hare
#

i thought this would of worked:

client.on("channelUpdate", function (channel, oldChannel, newChannel, oldtopic, newtopic) {
  let message = channel.guild.channels.cache.find(
    (ch) => ch.name === "logs"
  );
  let embed = new Discord.MessageEmbed()
  .setTitle(`Channel Updated`)
  .setColor("ORANGE")
  .setDescription(`A Channel Has Been Updated: \nOld Name: ${oldChannel} Old Topic: ${oldtopic}\nNew Name: ${newChannel} New Topic: ${newtopic}`).setTimestamp()
  message.send(embed)
});
pale vessel
#

There's only two parameters, oldChannel and newChannel

onyx hare
#

o

pale vessel
#

These parameters will be undefined

#

In your case, channel is the old channel and oldChannel is the new channel

#

You should rename those and use oldChannel.topic and newChannel.topic

onyx hare
#

o

gray bronze
#

Could anyone help me with the CSS on the site

#

I have this

#

And it repeats the image

zenith terrace
zenith terrace
# earnest phoenix

here you go

if(message.content === "/hi") {
    return message.channel.send({
        embed: {
            description: `Hi Voltrex`
        }
    })
}```
earnest phoenix
#

Mashallah, much better

gray bronze
#

!important?

zenith terrace
gray bronze
#

Ill try it

#

Now no image appears at all

#

@zenith terrace

zenith terrace
#

I got no clue why, @rustic novawhats the css link you gave before or is it old

rustic nova
gray bronze
#

Oh

#

Can you help then?

uneven lily
#

Hi, a few days ago my bot started using shards, the problem now I have a lot of problems with counting for users or servers, is there a way to merge all members / servers of a shard into one count?

To see the servers count I use

$ {client.guilds.cache.size}

Below I leave 2 photos of the server count from 2 different shards

Lang: Javascript
https://cdn.discordapp.com/attachments/622379620674830346/840976774036324392/unknown.png
https://cdn.discordapp.com/attachments/622379620674830346/840976826213203979/unknown.png

earnest phoenix
solemn latch
earnest phoenix
solemn latch
#

2.5k is when your bot will stop working

#

if you let it go to 2.5k youll have some serious issues to fix

#

2k is generally my recommendation, but for fast growing bots 1.5k is fine too.

old cliff
onyx hare
#

can someone help me with my nickname changed it doesnt seem to log if someone changes there nickname

client.on("guildMemberUpdate", function (oldMember, newMember) {

  let message = oldMember.guild.channels.cache.find(
    (ch) => ch.name === "logs"
  );
  let embed = new Discord.MessageEmbed()
  .setTitle(`Nickname Changed`)
  .setColor("ORANGE")
  .setDescription(`Member Has Changed Their Nickname: \nOld Nickname: ${oldMember.nickname} \nNew Nickname: ${newMember.nickname}`).setTimestamp()
  message.send(embed)
});
old cliff
#

Does the logs channel exist?

onyx hare
#

yes

old cliff
#

Also try logging anywhere in between just to check if the code gets executed

#

Also any error?

onyx hare
#

no errors, tried under a random channel didnt send anything

old cliff
#

Try logging stuff

deep mantle
#

Hey I use PIL and I am attempting to paste a vector image over another image, but when the image is pasted the part that is supposed to be vector is black. Anyone know how to fix this?

onyx hare
# old cliff Try logging stuff

i think it was intents not being enabled tried on my bot with it on it worked but shows the same name as the b4 and after so i tried with .displayname and this shows instead

opal plank
#

sup

peak bough
#

Any web dev here who want to work on a project ?

crimson vapor
thick nexus
#

how to use get_channel

median moss
#

do you guys know any website, api or lib that encrypt and uncrypt codes in Js?

umbral zealot
#

What do you mean by "encrypt codes"

eternal osprey
#

I finally switched from json to mongodb, after 8 hours of changing code (I was working kinda slow, but okay..). Really happy that it is done, However my bot now takes longer than usual to respond to the command handlers. Is that normal?

umbral zealot
#

Using mongo can be a little slower, but it shouldn't be that noticeable

eternal osprey
#

alrighty, thank you!

umbral zealot
#

I'm also SUPER proud of you for taking the step by the way

#

I want you to know that ^_^

median moss
#

you know when it is messed up

#

you cant understand anything

umbral zealot
#

By "a code" do you mean javascript itself, or do you mean data like text

median moss
#

let me send you for example

umbral zealot
#

Ok well there are quite a few encryption/decription methods

median moss
#
const _0x5383d1=function(_0x300d11,_0x536269,_0x4acf75,_0x2be0a6){return _0x2eae(_0x536269- -0x2e8,_0x2be0a6);},_0x1b7849=function(_0x7e6e7c,_0x282b8e,_0x2316bd,_0x59c574){return _0x2eae```
#

this is a part of a code

umbral zealot
#

that... isn't encryption

#

And it's absolutely possible to read this

median moss
#

can I send you the whole code in your DM?

#

cause I think this is encrypted

#

I cant understand this

zealous egret
#

Can you guys help me i want to if user don t have item in bag he can t use it and it said taht message and it didn t work because veryone can use command even if they don t hvae item in bag/inventory

median moss
#

only "const" and "function"

#

and "return"

cinder patio
#

the rest are variable names

zealous egret
# zealous egret Can you guys help me i want to if user don t have item in bag he can t use it an...
@commands.cooldown(1,20,commands.BucketType.user)
async def fish(ctx):
    item = "fishing pole"
    res = await check_item(item)

    if not res[0]:
        if res[1]==1:
            await ctx.send("You don't have :fishing_pole_and_fish: Fishing Pole. You can buy it in **shop**")
            return
  
    await open_account(ctx.author)

    users = await get_bank_data()

    user = ctx.author

    earnings = random.randrange(420)

    em = discord.Embed(title=f":fishing_pole_and_fish: You caught a fish and sold it for {earnings} :coin:", color = 0xf9b9ff)
    await ctx.send(embed=em)

    users[str(user.id)]["wallet"] += earnings

    with open("mainbank.json","w") as f:
        json.dump(users, f, indent = 4)


async def check_item(item_name):
    item_name = item_name.lower()
    name_ = None
    for item in mainshop:
        name = item["name"].lower()
        if name == item_name:
            name_ = name
            break

    if name_ == None:
        return [False,1]

    return [True,"Worked"]```
umbral zealot
median moss
#

thats what I want .-.

#

I thought this was encryption

zealous egret
umbral zealot
#

No what you want is to have access to the code of someone who does not want you to read their code

cinder patio
#

The snippet above cannot be undone without any context

median moss
umbral zealot
#

And we're not here to teach you infosec

umbral zealot
#

what do you mean "no"

median moss
#

my friend sent me this and asked me to teach him how to uncrypt it

umbral zealot
#

Is this your code?

median moss
#

but idk how to do this

median moss
umbral zealot
#

Ok well he doesn't either

dusky garden
#

how do i dm someone with there name and tag? and without ID

median moss
#

idk what is it about

umbral zealot
#

and we're not going to tell either of you how to do it

zealous egret
zealous egret
sterile lantern
#

let validcolors = ['`Light Green <@>`\n', '`Light Blue <@>`\n', '`:star: Omega Almighty Booster Color <@>`']

i want to list this in an embed, how would i have it join and remove the , from it

umbral zealot
zealous egret
umbral zealot
#

I can't help you with your code. I don't actually know python.

zealous egret
#

okay, but thank you for try to help me

eternal osprey
sterile lantern
#

ah .join, ill try tha

#

worked ty

umbral zealot
zealous egret
dusky garden
umbral zealot
#

that does not guarantee they are cached

#

why do you not have their ID?

zealous egret
sudden knoll
#

seems like an strange name for inv

zealous egret
eternal osprey
#

Well it is your code i guess

sudden knoll
#

idk what your data structure is like so I can't help you with that

zealous egret
#

okay I am gonna try

zealous egret
eternal osprey
#

if not res[0]:
if res[1]==1: why does this look so strange?

umbral zealot
#

The fact that you're still stuck on use JSON as a database like a caveman trying to beat rocks with a stick to communicate is the only thing that's really sticking out to me

#

(speaking to solic this time lol)

umbral zealot
eternal osprey
zealous egret
#
@commands.cooldown(1,20,commands.BucketType.user)
async def fish(ctx):
    item = "fishing pole"
    res = await check_item(item)

    if not res[0]:
        if res[1]==1:
            await ctx.send("You don't have :fishing_pole_and_fish: Fishing Pole. You can buy it in **shop**")
            return
  
    await open_account(ctx.author)

    users = await get_bank_data()

    user = ctx.author

    earnings = random.randrange(420)

    em = discord.Embed(title=f":fishing_pole_and_fish: You caught a fish and sold it for {earnings} :coin:", color = 0xf9b9ff)
    await ctx.send(embed=em)

    users[str(user.id)]["wallet"] += earnings

    with open("mainbank.json","w") as f:
        json.dump(users, f, indent = 4)


async def check_item(item_name):
    item_name = item_name.lower()
    name_ = None
    for item in bag:
        name = item["name"].lower()
        if name == item_name:
            name_ = name
            break

    if name_ == None:
        return [False,1]

    return [True,"Worked"]```
eternal osprey
#

waaaa.

#

Bin the code

umbral zealot
#

IKR, I finally got you to relent after half a damn year but there's always another noob that really does NOT want to accept that using JSON is fucking stupid.

sterile lantern
#

how do i check if a user has a specific role

eternal osprey
#

thanks for convincing me

umbral zealot
#

It's a nonstop battle with idjits.

eternal osprey
#

finally realized how easy it is with mongo, like reading and writing wise

sterile lantern
#

if(message.member.roles.has('id')) {
would this work

zealous egret
umbral zealot
#

Hear this @zealous egret ? Stop using JSON. USE A DATABASE

#

I got this guy to move after 6 months, please don't take that long to smart up.

zealous egret
umbral zealot
#

No, it's not.

zealous egret
#

database cost money?

umbral zealot
#

Use SQLIte, it's perfectly suitable for your purpose.

sterile lantern
#

no, it's literally free

umbral zealot
#

No, they're free. 100% free.

sterile lantern
#

mongo db is free

#

sqlite is free,

#

most dbs are free

umbral zealot
#

You could not be MORE free than using sqlite.

sterile lantern
#

you just pay for extra storage

sudden knoll
zealous egret
#

okay i will but now I want help with that

sterile lantern
#

or other addons

umbral zealot
#

that is your solution

zealous egret
#

and what is good or better on database?

dusky garden
sudden knoll
#

also I have no idea what the heck your code structure is so don't just copy pasta

umbral zealot
#

The problem you are having right now, and all your problems, are 100% specifically due to you using JSON.

Use SQLite.

eternal osprey
umbral zealot
sterile lantern
#

if(member.roles.cache.has('id'))

#

how come this doesnt work

umbral zealot
#

doesn't work how?

eternal osprey
#

as she is already checking and awaiting the role to variable res

sterile lantern
#

if the user has a role, log 'yes' otherwise log 'no'

#

doesnt log anything

#

wait does member require an ID or just message.author

sudden knoll
umbral zealot
#

member is a GuildMember, or it should be

zealous egret
#

like that?

#

or I am idiot

sterile lantern
#
if(colorchoice.toLowerCase() === 'light green') {
  if(message.author.id.roles.cache.has('id')) {
    console.log('ya')
  }```
#

neither work

zealous egret
#
    item_name = item_name.lower()
    name_ = None
    for item in bag:
        name = item["name"].lower()
        if name == item_name:
            name_ = name
            break

    if name_ == None:
        return [False,1]

    return [True,"Worked"]

item_name = item_name.lower()
for item in bag:
  name = item['name'].lower()
  if name == item_name:
    return True
return False```
#

can you guys reedit it please

sudden knoll
#

I'm just wondering why you need the name_ variable, just return once you find the item you want

#

your code is wonky imo

#
async def check_item(item_name):
  item_name = item_name.lower()
  for item in bag:
    name = item['name'].lower()
    if name == item_name:
      return True
  return False
sterile lantern
#
 if (message.member.roles.cache.some(role => role.name === 'Green')) {
    console.log('ya')```
#

sadly doesnt work

sudden knoll
#

also what the hell is bag

zealous egret
#

will this work?

#

or I have it completly wrong

sudden knoll
#

no you didn't put any indentations

#

therefore it won't work

#

also why do you return a list

#

in the old code

#

why do you need that

sterile lantern
#

i found my issue i used args(1) instead of (0) Facepalm

sudden knoll
#

if you're just checking if something is true just return a bool

zealous egret
#

I have no clue

#

async def check_item(item_name):
item_name = item_name.lower()
for item in bag:
name = item['name'].lower()
if name == item_name:
return True
return False

sudden knoll
#

oh god

#

put some indents please

zealous egret
sterile lantern
#

essage.member.roles.remove(role => role.name === 'Green')

zealous egret
#

async def check_item(item_name):
item_name = item_name.lower()
name_ = None
for item in bag:
name = item["name"].lower()
if name == item_name:
name_ = name
break

if name_ == None:
    return [False,1]

return [True,"Worked"]
sterile lantern
#

can i remove a role with a role name, if so how

sterile lantern
#

i tried this
message.member.roles.remove(role => role.name === 'Green')

sudden knoll
zealous egret
#

because I still don t understand what replace

sudden knoll
#

aren't you just checking if an item is in the bag?

zealous egret
#

yes I am or?

#
    item_name = item_name.lower()
    name_ = None
    for item in bag:
        name = item["name"].lower()
        if name == item_name:
            name_ = name
            break

    if name_ == None:
        return [False,1]

    return [True,"Worked"]```
sudden knoll
#

just iterate until you find the item, if you find it return True, if you don't find it return false

#

or store stuff in a dictionary so it does it O(1) time

zealous egret
#

and how to do that?

sudden knoll
#

I'm not gonna teach you about python data structures my guy

#

I'm sorry

#

but no

zealous egret
sterile lantern
#

bento u do js?

#
message.member.roles.remove(role => role.name === 'Green')```

if so, how come the above doesn't work?
sudden knoll
sterile lantern
#

well code in js

sudden knoll
#

know a very small amount would be better

sterile lantern
#

ah ic

sudden knoll
#

yeah i can't help you samm, sry

sterile lantern
#

ah i figured out how to do it, no worries

sudden knoll
#

okay

sudden knoll
# zealous egret <:Sadge:808088921208651787>
# this code is wack
item_name = item_name.lower()
name_ = None
for item in bag:
  name = item["name"].lower()
  if name == item_name:
    name_ = name
    break
if name_ == None:
  return [False,1]
return [True,"Worked"]

# this code is a not wack version
item_name = item_name.lower()
for item in bag:
  name = item['name'].lower()
  if name == item_name:
    return True
return False
zealous egret
#
@commands.cooldown(1,20,commands.BucketType.user)
async def fish(ctx):
    item = "fishing pole"
    res = await check_item(item)

    if not res[0]:
        if res[1]==1:
            await ctx.send("You don't have :fishing_pole_and_fish: Fishing Pole. You can buy it in **shop**")
            return
  
    await open_account(ctx.author)

    users = await get_bank_data()

    user = ctx.author

    earnings = random.randrange(420)

    em = discord.Embed(title=f":fishing_pole_and_fish: You caught a fish and sold it for {earnings} :coin:", color = 0xf9b9ff)
    await ctx.send(embed=em)

    users[str(user.id)]["wallet"] += earnings

    with open("mainbank.json","w") as f:
        json.dump(users, f, indent = 4)


async def check_item(item_name):
    item_name = item_name.lower()
    name_ = None
    for item in bag:
        name = item["name"].lower()
        if name == item_name:
            name_ = name
            break

    if name_ == None:
        return [False,1]

    return [True,"Worked"]
sudden knoll
#

yeah okay that's your weird code again

zealous egret
#

okay, that s fine but I want to it works now to it will b simple

sudden knoll
#

i don't know what that sentence means

zealous egret
#

I mean i want to it will works when you have fishing pole you can use fish and when do not have it you can t

#

easy

sudden knoll
#

Yeah ik that

#

Do you understand how to search through an inventory

#

Or an array in this case

zealous egret
#

I don t know how so I am asking

sudden knoll
#

You don’t know how to search an array...

#

You might want to go learn some basics in coding before trying to make a bot

zealous egret
#

I know basics but don t know that one thing

#

so please send a doc of it or say how to do it

sudden knoll
#

Of how to find if something is in a list?

zealous egret
#

yeah

sudden knoll
#

if item_name in list_name

#

You can do that

#

That works

earnest phoenix
#

guys

#

what is the best 24/7 way to host your bot

sudden knoll
#

Vps

sudden knoll
earnest phoenix
#

how though

sudden knoll
#

Wdym

earnest phoenix
#

from visual code

#

studio

sudden knoll
#

Uhh

#

Just go watch a YouTube video or smthn there are a lot on hosting bots

#

That’s also a decent source of info

quartz kindle
#

dafuq is that

#

what language is that even

#

is that supposed to be javascript/discord.js?

umbral zealot
#

Oh jesus god almighty

earnest phoenix
#

is there any free vps?

vivid fulcrum
umbral zealot
sudden knoll
quartz kindle
#

and the #

median moss
umbral zealot
#

... no sorry kid you clearly do NOT know javascript

median moss
#

Ok then 👍

earnest phoenix
lyric mountain
#

By what I've read in reviews, it's not supposed to be used for bot hosting

opal plank
earnest phoenix
#

Do you know what is the name of the NPM module to get information about an NPM package?

umbral zealot
#

you know what's funny? Doing a search for search npm packages through nodejs reveals absolutely no useful results because that's like googling for google

lyric mountain
#

I mean, you could always scrape the page

umbral zealot
#

I mean I know there are packages

lyric mountain
#

but no sweet easy package for that

umbral zealot
inner sandal
#

i defined it 😭

quartz kindle
#

show models/premiumKey.js

inner sandal
#
const { Schema, model } = require("mongoose");

module.exports = model(
  "premium-keys",
  new Schema({
    Key: String,
  })
);
#

@quartz kindle

quartz kindle
#

dont you have to instantiate the model too?

inner sandal
#

ill send everything related

quartz kindle
#

if key is "create", you make a new premKey

#

if key is not "create", premKey is never instantiated

inner sandal
inner sandal
#

that should make the key no?

quartz kindle
#

does this even work?

#

you export an empty collection, because the function is not run

#

does running the function afterwards actually affect the exported collection?

#

this looks weird af

inner sandal
#

no i dont even have something in mongodb yet

quartz kindle
#

also, the function is completely async with no way to wait for it

#

even if the collection worked, you'd have to guess when its ready

inner sandal
#

can you fix it @quartz kindle ?

crimson vapor
zenith terrace
#

lol

umbral zealot
cosmic forum
#
if (message.content == "https://images-ext-1.discordapp.net/external/8b2pWECsnPiAoTIi4YFcunJ0f-0p3tuN2tfWecRtZDg/http/images.mewbot.xyz/img/sprites/282-0-.png") {
  return message.channel.send("Gardevoir");
};

or

if (message.content == "https://images-ext-1.discordapp.net/external/8b2pWECsnPiAoTIi4YFcunJ0f-0p3tuN2tfWecRtZDg/http/images.mewbot.xyz/img/sprites/282-0-.png") return message.channel.send("Gardevoir");
vivid fulcrum
#

no difference

#

if char count is something you have an orgasm over

#

use whatever you prefer

quartz kindle
#

using brackets is usually recommended to avoid confusion

#

an if without brackets only works if you have a single expression, anything more than that it wont work anymore

#

if(a) something; is the same as:
if(a) { something; }
but
if(a) something; somethingElse; is the same as:
if(a) { something }; somethingElse; and not:
if(a) { something; somethingElse; }

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

quartz kindle
#

no u

prime mist
rocky hearth
#

I hv a string like, "some34more9andmore78"
And I want to convert this string in an array like this
["some", 34, "more", 9, "andmore", 78]
What be the best approach to tackle this in js?

prime mist
#

Been playing around with a permissions API for slash commands. I think I have something I like now lol

commands
  .guild({
    name: "admin-only",
    description: "A restricted command",
    default_permission: false,
    permissions: async (guild) =>
      guild.roles
        .filter((role) => BigInt(role.permissions) & Permissions.ADMINISTRATOR)
        .map((role) => ({
          id: role.id,
          type: ApplicationCommandPermissionType.ROLE,
          permission: true,
        })),
  })
  .pipe(
    RxO.flatMap(({ respond }) => respond({ content: "You are the special." })),
  )
  .subscribe();
#

Creates a command like this:

lyric mountain
#

everything after it IS a new line, independently if you broke it or not

charred dock
#

Anyone know why have (promise) ? It cause my bot not work ig

pale vessel
median moss
#

guys, is there any docs that talks about how to make slash commands on d.js?

rocky hearth
#

oh wow, can u paste the code here

quartz kindle
lyric mountain
#

semis for life

quartz kindle
#

always use semis, alaways use brackets

#

done

lyric mountain
#

it's technically a colon, but still not a colon - it's a semicolon

prime mist
lyric mountain
#

meanwhile pythoneers: "Where tf I missed a tab???"

sudden knoll
#

lmao

sudden knoll
median moss
#

ty

sudden knoll
#

you can find this easily with google

median moss
#

yeah, I couldnt find ;-;

prime mist
sudden knoll
#

idk, I write in python

rocky hearth
#

so it seems, regex is way more perfomant

sudden geyser
#

5head

#

optimize for readability before optimizing for speed

rocky hearth
#

in ts, can I grab, constructor parameter types directly from class itself

crimson vapor
#

that would be the same as getting a function's inputs probably

outer void
#

guys, im having a problem here with the guildMemberAdd on discord v12

sudden geyser
#

Are you having troubles receiving events or using them? Did you enable intents?

outer void
#

a lot of tutorials send text with the following:

  
client.on('guildMemberAdd', async member => {
  //if he is not in a server
  if (!member.guild) return;
  let guild = member.guild;
  
  //find my server ID
  let channel = guild.channels.cache.get("836374069985280032");
  //find my channel ID from server
  let welcomeChannel = channel?.guild.channels.cache.get("836374070642999327");
  
  let membercount = guild.members
  if (!channel) return;
  
  console.log("new user detected");
  console.log(`username: ${member.user.username}`);

  let embed = new MessageEmbed()
  .setColor("GREEN")
  .setTitle("New Server Member!")
  .setDescription(`Welcome, ${member.user.tag} to **${guild.name}!**`)
  .setThumbnail(member.user.displayAvatarURL())
  .setFooter(`You are the ${membercount}th member to join`);
  
  //send message as EMBED
  (welcomeChannel as TextChannel).send(embed);

});
sudden geyser
#

On the developer portal and when initializing the client?

outer void
#

i cant find a way to send a message to the desired text channel

outer void
drifting shell
#

i just want someone to help me confirm something, so im looking at applying join roles that people didnt get from my bot due to it being offline

sudden geyser
drifting shell
#
                final List<Long> joinRoles = JoinRoleCache.get().getEntity(guild.getId());
                if (!joinRoles.isEmpty()) {
                    LOGGER.info("Applying join roles in guild {} for {} members.", guild.getName(), guild.getMemberCount());

                    for (final Member member : guild.getMemberCache()) {
                        final List<Long> roleIds = member.getRoles().stream().map(Role::getIdLong).collect(Collectors.toList());
                        joinRoles.stream().filter(roleId -> !roleIds.contains(roleId)).forEach(roleId -> {
                            final Role role = guild.getRoleById(roleId);
                            if (role == null) {
                                LOGGER.info("Got null as a result for role ID {}", roleId);
                            } else {
                                LOGGER.info("Attempting to apply role {} to user {} in guild {}", role.getName(), member.getUser().getAsTag(), guild.getName());
                                guild.addRoleToMember(member, role).queue(null, ex -> LOGGER.info("Failed to apply role to member", ex));
                            }
                        });
                    }

                }
``` just to clarify this should be adding all the join roles to the member
#

joinRoles being a list of configured roles for people to not get on join

sudden geyser
#

can you add syntax highlighting pls

drifting shell
#

oh sorry

#

completely forgot about highlighting LULW

sudden geyser
drifting shell
#

it doesn't spam it

#

if it runs into a rate limit

#

it'll just wait for that period to be over

sudden geyser
#

Yeah but that would accumulate rate limits

drifting shell
#

cant really think of any other way to avoid that

sudden geyser
#

Though you could use methods like modifyMemberRoles to minimize it

#

So it sets all the roles for a single member in one API request as opposed to an API request for each role to add

drifting shell
#

oh

#

had no idea that method existed

sudden geyser
#

yah

drifting shell
#

thanks

rocky hearth
#

Can I stop prettier to format my empty functions like this?

function () {}
#

i hate this format.

#

I'm fine with this

function () {
}
sudden geyser
#

Prettier has configuration options you can apply, but I don't know if they have one for formatting empty function bodies as so.

#

I've only used ESLint in the past.

drifting shell
#

@sudden geyser theres a warning on the doc of modifyMemberRoles, it says it shouldn't be used more than once within 1 event listener cycle, i take it that just means that it shouldn't use it twice in the same listener?

sudden geyser
#

The full warning:

This may not be used together with any other role add/remove/modify methods for the same Member within one event listener cycle! The changes made by this require cache updates which are triggered by lifecycle events which are received later. This may only be called again once the specific Member has been updated by a GenericGuildMemberEvent targeting the same Member.

It basically means you can't call another one of the update member role methods (though I don't know what "cycle" refers to in this context). It would only be safe to call other methods if a GenericGuildMemberEvent event was received later (which you probably can't time efficiently).

prime mist
sudden geyser
#

So after you call modifyMemberRoles, you can't call the same method or an add/remove method either.

outer void
prime mist
outer void
#

not even entering on console.log()

prime mist
#

And you have definitely enabled this?

outer void
prime mist
#

Can you copy paste your new Client(...) code?

outer void
#
//Enable some intents to collect data from guild
export const client: Client = new Client({
  ws: {
    intents: [
      "GUILDS",
      "GUILD_MESSAGES",
      "GUILD_INVITES",
      "GUILD_MEMBERS",
      "GUILD_PRESENCES",
      "GUILD_VOICE_STATES",
    ],
  },
});
prime mist
#

Hmm looks good.

And this does nothing?:

client.on('guildMemberAdd', (member) => console.log(member));
sudden geyser
#

Java's ok.

latent heron
#

PHP gang

sudden geyser
#

tries not to vomit

latent heron
#

i'm like one out the only 5 here who codes php in top.gg

outer void
#

it worked

#

im gonna look at code step by step again

latent heron
#

@drifting shell

outer void
#

funny enough it started to print the values from console.log() now but its not sending messages yet

#

thanks @prime mist

#

i commented my code, compiled the one you sent and then it started to work like wtf

sudden geyser
#

In Postgres, how would you insert a date into a column with only its year?

drifting shell
green kestrel
#

BLOODY MARIADB as i should swear

#

virtual colum that does a divide by zero brings down the ENTIRE server on debian 10.

#

as in the entire database daemon, boom, poof, gone

#

"what, you wanted to do this thing that should be trivially handled? fuck you, developer. im gonna crash instead!"

#

so much for mature and stable software kek

crimson vapor
#

anyone have a list of preferred_locale options for discord

quaint wasp
#

guys..

#

I randomly get an error

#

saying module pack utils was not found

#

I never mentioned utils in any of my code

#

or ever enev created/needed one.

#

(ping if going to help please)

earnest phoenix
#

@quaint wasp Check the call stack of the error and see which file is using a module that imports util

latent heron
#
<?php for($i=0;$i<100;$i++){if(!($i%3)&&(!($i%5)))if(!$i)0;else echo"FizzBuzz\n";elseif(!($i%3))echo"Fizz\n";elseif(!($i%5))echo"Buzz\n";}?>
#

@quartz kindle im trying to learn how to write PHP 1 line code for the first time

#

any advice/thoughts/feedback?

drifting shell
#

cyanide pills are always an option

sage bobcat
#

One message removed from a suspended account.

latent heron
#

this is another masterpiece of mine, the fibonacci sequence

<?php $x=$z=0;$y=1;$n=8;for($i=0;$i<$n;$i++){$x=$y;$y=$z;$z=$x+$y;echo$z."\n";}?>
cinder patio
#

loops aren't meant to be a one-liner, yours is more like "making code more unreasable"

opal plank
#

mimified code looks more readable than that

drifting shell
#

you should obfuscate it

latent heron
#

it is minified though

#

dont make me take the Google™️ route of minifying my code

#

i'll turn this shit into alphabet soup code

opal plank
#

is there a way to pass in everything in an SQL statement?

#

invot VALUES()

#
INSERT (c1, c2, c3, c4) VALUES($)  => [1,2,3,4]```
#

something like that?

#

instead of

#
INSERT (c1, c2, c3, c4) VALUES($1, $2, $3, $4)  => [1,2,3,4]```
old cliff
earnest phoenix
#

Tuples are coming to JS

#

😄

rocky hearth
#

what really?

sinful tiger
#

Anyone know how to make a bot looking to get one made

rocky hearth
#

Everyone with the badge "Bot Developer", knows, how to create a bot.

sinful tiger
#

ok thank you

rocky hearth
#

how can I declare a type in ts, that accepts all the instantiable Child classes of a abstract Base Class?

slender thistle
earnest phoenix
#

There was this deno lib that already supports them

#

Don't remember exactly which

low river
#

hello

slender thistle
#

What are Records, again?

low river
#

this is for my tictactoe command

#

but its on global variable

slender thistle
#

Are you using the commands extension

#

I cba to view the file on mobile

low river
#

f wait

lusty glacier
#

guys

#

why icant

#

vote

#

i get error 500

slender thistle
#

Because you are not important enough

lusty glacier
#

and when i refresh the page i get error 400

slender thistle
#

500 means server error

low river
#

bruh ill just dm u @slender thistle

slender thistle
#

So that's issue with topgg

long crow
rocky hearth
#

y, thts what that role is for

slender thistle
#

It's for whoever owns a bot that's approved on top.gg

#

And that doesn't always equal knowledge.

near stratus
#

Your bot needs uptime but uptimerobot is running ?
whaaaaatttt ?

#

The bot not running ?

#

You can't host bot on Glitch anymore

slender thistle
#

Well, this hurts

near stratus
slender thistle
#

Replit

#

GitHub isn't for hosting

near stratus
#

imagine paying 10$ on Glitch for a bot when you can get 2 (isc 4) VPS with the price

earnest phoenix
long crow
eternal osprey
#

hey!

prime mist
eternal osprey
#

I have this function which adds the coins to 'final': ```js
module.exports.addCoins = async (guildId, userId, coins) => {
return await mongo().then(async (mongoose) => {
try {
console.log('Running roulette
')

  const result = await profileSchema.findOneAndUpdate(
    {
      guildId,
      userId,
    },
    {
      guildId,
      userId,
      $inc: {
        coins,
      },
    },
    {
      upsert: true,
      new: true,
    }
  )



  coinsCache[`${guildId}-${userId}`] = result.coins

  return result.coins
} finally {
  mongoose.connection.close()
}

})
}``` how do i do the opposite? So removing the amount 'final' from the total amount

#

it's gonna be const result -= await profileSchema.findOneAndUpdate() maybe?

earnest phoenix
#

embed.set_image(url = 'attachment://Suitsaur #33.png')
This is not working, any idea?

onyx hare
earnest phoenix
#

I got bunch of images and hosting it will mess up the the names for a specific conditions.

stiff lynx
#

How I connect a discord collection to my mongodb database?

lavish bramble
#

How can I do like the the name of replied person?

lavish bramble
#

And then they mentions the person @lavish bramble

dusky sundial
#

What lang are you using?

lavish bramble
#

Javascript

gritty falcon
#

How long needs a bot to be approved?

earnest phoenix
# lavish bramble Javascript

//make an embed

const m = await message.channel.send(`<@${message.author.id}>`)

setTimeout(function() {
m.edit(embed)
},100)```
This is my code for my private bot. It works.
earnest phoenix
earnest phoenix
lavish bramble
gritty falcon
earnest phoenix
earnest phoenix
#

@lavish bramble

earnest phoenix
lavish bramble
#

So how can I get the message id also?

stiff lynx
#

collection.filter(user => user.username === 'Bob');
These is the docs

gritty falcon
zenith terrace
#

what are you trying to do

earnest phoenix
zenith terrace
#

oh

earnest phoenix
#

But he is asking again and again

stiff lynx
#

guys in the docs I dont find how to delcare a connection and connect it to a database

#

let collection = new Collection(ProfileModels);
collection.filter(ProfileModels => ProfileModels.serverID === message.guild.id);

#

I tried this but it gives me this error UnhandledPromiseRejectionWarning: TypeError: function is not iterable (cannot read property Symbol(Symbol.iterator))

earnest phoenix
#

idk what is going on but i hope that i will be able to authorize soon

#

in top gg site

vivid fulcrum
#

store ids of the entities you need in your database

#

then using that piece together the data you need

#

in your code

stiff lynx
vivid fulcrum
#

okay

stiff lynx
#

that is by serverID

vivid fulcrum
#

but you can't do what you're trying to do

stiff lynx
vivid fulcrum
#

because it doesn't work like that

stiff lynx
#

and how lol

#

idk I'm trying

vivid fulcrum
#

you cannot store a full ass discord entity in your database

#

a) property recursion
b) you're going to have stale data

#

you only store ids in your database

#

pull those ids

#

then you fetch/get the entity in your code via that id

stiff lynx
vivid fulcrum
#

🤷‍♂️

stiff lynx
#

because I assume I pull the ID's and put them into the collection

#

and after that I filter them

#

right?

deep robin
#

How do I make a purge command for my discord.py bot?

earnest phoenix
#

i want myself to be able to login / authorrize

#

in top gg site

#

i can't use a bot without voting it

#

pls i hope someone workin on it

stiff lynx
#

how I connect my daabase to a collection, I'm gonna cry because I found nothing

#

I've watched discord.js docs and nothing, Map.js docs and nothing

#

tysm to everyone lmao

eternal osprey
#
exports.run = async (client, message, args) => {

    
        if (args) {
            var amount = Number(args[0]);
        }
        else {
            return message.reply("Please specify a bet.");
        }
    
        const guildId = message.guild.id
        const userId = message.author.id
    
        const bal =  await economy.getCoins(guildId, userId)```why is this still giving me an asyc -await error?
#

mean isn't it already in my exports.run...

zenith terrace
#

theres 2 spaces after bal =

#

which I believe can error it ?

pale vessel
#

no

zenith terrace
#

oh

#

idk then

#

I thought 2 spaces did something to error

pale vessel
opal plank
#

that code is giving me headaches

pale vessel
#

suffer

opal plank
#

some stuff have semi colons, some dont
the return is in brackets
theres no indentation
var
extra newlines for no fucking reason

#

its a 10 line snippet, why so much pain?

pale vessel
#

yes

opal plank
#

i just noticed

#

wtf

#

@eternal ospreyjesus christ add a linter

#
exports.run = async (client, message, args) => {
  let amount = 0;
  if (args) amount = Number(args[0]);
  else return message.reply("Please specify a bet.");
  const guildId = message.guild.id,
    userId = message.author.id,
    bal = await economy.getCoins(guildId, userId)
}```
#

and check if args[0] is a number

#

otherwise NaN

#

he legit used var just to abuse scopes

zenith terrace
#

Erwin: screaming

opal plank
#

screaming? nono, im screeching

#

its 6am, too late for this shit

zenith terrace
#

inb4 Erwins 5am washing neighbour kills Erwin before Erwin kills the 5am washing neighbours

cinder patio
#

I'd say it's too early

opal plank
#

not when you've been awake this long

#

probably slept 7 or 8h this week, total

slender thistle
#
TypeError: Object of type datetime is not JSON serializable

woohoo!

devout hornet
#

To verify a discord bot do you need to be above 18?

slender thistle
#

16+

devout hornet
#

Ahh ok cool

rapid wharf
slender thistle
#

Noice

rapid wharf
#

@slender thistle can u tell me if in a running loop an error comes, how to ignore it and continue the loop in Python. should i give code

slender thistle
#
>>> for i in range(10):
...     try:
...             print('Result: ', (i + 1) / i)
...     except ZeroDivisionError:
...             continue
...     print(i)
...
Result:  2.0
1
Result:  1.5
2
Result:  1.3333333333333333
3
Result:  1.25
4
Result:  1.2
5
Result:  1.1666666666666667
6
Result:  1.1428571428571428
7
Result:  1.125
8
Result:  1.1111111111111112
9
rapid wharf
#
     await member.send('Hellooo see i sent u a DM')
   except (HTTPException, ValueError):
      pass```
#

i did this

slender thistle
#

What are you doing

#

To break out of a loop use break

hearty dune
#

can someone help me

slender thistle
#

To continue to next iteration use continue

hearty dune
#

hello

rapid wharf
slender thistle
#

Hi state your issue before asking if anyone can help

rapid wharf
slender thistle
hearty dune
#

ok my issue is i cannot login to discord bot

#

can i post link

slender thistle
#

How are you trying to log into a bot

hearty dune
#

top dot gg

slender thistle
#

Can you provide a screenshot

hearty dune
#

ok

#

this is the result i get

slender thistle
#

That happens when you try to submit a bot, correct?

hearty dune
#

when i try to login

#

can i give link

#

to that

slender thistle
#

Sure

hearty dune
stiff lynx
#

Guys how I connect my collection to my database? IDK how to do it, and in docs I cant find it,also googling it

rapid wharf
#
async def accept(ctx, *, msg):
    ok = msg.split(' ')
    for each in ok:
        webhooks = await ctx.channel.webhooks()
        webhook = discord.utils.get(webhooks, name='SVRP OP')
        if webhook is None:
            webhook = await ctx.channel.create_webhook(name="SVRP OP")
        await webhook.send(f'{each}  ||. Your application has been **Accepted for the Interview**. You will get notified about the time of interview at #interview-announcement.', username=f'{ctx.author.display_name}  .SVRP', avatar_url=ctx.author.avatar_url)
        member = each.strip("<!@>")
        member = await client.fetch_user(int(member))
        try:
            await member.send('**Congratulations!!**  Your application for SVRP Whitelist has been **Accepted for the Interview**. You will get notified about the time of interview at #interview-announcement.')
        except (HTTPException, ValueError):
            continue```
This is the error : `Command raised an exception: ValueError: invalid literal for int() with base 10: ''`
I did continue, but..... still is giving error @slender thistle
hearty dune
#

i really need to fix this i can make another accont but i handle lot of server with this account this is really important

slender thistle
#

In one or multiple iterations member is either literally <@!> or an empty string generally

#

And you try to convert that into int

rapid wharf
slender thistle
#

That aside, are you aware of how try-except works?

hearty dune
#

ohk

rapid wharf
slender thistle
#

You'll have to wait until it's fixed

hearty dune
#

can u login shivacco

stiff lynx
#

Guys how I connect my collection to my database? IDK how to do it, and in docs I cant find it,also googling it

hearty dune
#

have u tried to lgin

slender thistle
# rapid wharf yes a little

So, what you are doing is handling only the message sending. The rest is not caught in a try branch, therefore it's erroring out and stopping

#

Honestly though, I advise using if statements instead of relying on exceptions

rapid wharf
#

how??

hearty dune
#

he

#

shivaco

#

reply

#

have u tried to login

#

and aftermath wut happens

#

send a pic

#

of that

tacit sequoia
slender thistle
#

In your case you can either:

  1. Wrap your entire loop body in a try-except. Example:
for each in ok:
    try:
        # yada yada
        # something causing an error
    except HTTPException, ValueError:
        continue
  1. Use an if statement to continue if member is empty. Example:
for each in ok:
    member = each.strip("<!@>")
    if not member: # member will be a "falsey" value, in this case an empty string
        continue
    # do other stuff
tacit sequoia
#

That load time tho

slender thistle
#

My laptop doesn't like it when I run PyCharm 🤷

rapid wharf
slender thistle
zenith terrace
slender thistle
#

ShareX

rapid wharf
zenith terrace
#

I installed OBS yesterday but recording kept lagging and idk why

slender thistle
#

Nah that's me listening to music and being lazy to turn off virtual audio recorder

#

OBS ain't a thing I wanna use KEKW

lusty quest
zenith terrace
lusty quest
zenith terrace
rapid wharf
#

@slender thistle thank you sir 😘😘 it worked

zenith terrace
rapid wharf
#

@slender thistle when i used anime girls pfp on my id, ppl thought i was a girl, and same goes for u also, i also thought u were a girl 😂😂

#

i wrote mam

#

and then i read ur name carefully

#

then wrote sir...

slender thistle
#

It happens, no worries

lusty quest
zenith terrace
lusty quest
zenith terrace
rocky hearth
#

@pale vessel tomorrow, u gave this snippet. "some34more9and+more78".match(/[a-zA-Z]+|[0-9]+/g).map(elem => isNaN(+elem) ? elem : +elem)
But now I want this string "long12+krt89df-efdhjj67nmn" to give this array,
["long", 12, "+kr", "t", 89, "df", "-ef", "dhjj", 67, "nmn"]
Basically, if there is + or - I want to extract its next two characters separately

lusty quest
zenith terrace
#

ok

stiff lynx
#

@lusty quest u knwo how to put a database into a discord collection?

#

or anyone

lusty quest
stiff lynx
lusty quest
#

idk what database did you use, what language did you use, what lib did you use

long crow
lusty quest
stiff lynx
#

but only for the profile

#

IDk how to explain it

#

but beg, bal, dep works

zenith terrace
lusty quest
#

if you call .set(key,data) on your collection you can add stuff to it

stiff lynx
#

let leaderboard = new Collection();
console.log(leaderboard);
for the moment this is my code, I know thath the declaration is made in the right way because I have the log Collection(0) [Map] {}

lusty quest
#

collections are mostly like maps

#

so you can use most methods that maps support also on collections

stiff lynx
lusty quest
#

then where is the issue?

stiff lynx
#

maybe because I'm stupid, or maybe because I'm blind I dont find anuthing about pushing database inside collection

lusty quest
#

what does the database return? if its a object you can store objects inside a map. if you want to store mutiple documents in the map, use a loop to set the stuff to the map

pearl trail
#

maybe this is what you want..

const database = await <mongo schema>.find()
for(let data of database) {
<collection>.set(anything, you want from data)
}
stiff lynx
#

leaderbord.map(function( serverID, UserID, bank)

lusty quest
#

forEach could cause issues bcs it does not respect async behavior

#

for in would be way better

pearl trail
#

so use for?

stiff lynx
#

for with the profileModel (my database name).lenght()?

worn sonnet
#

hey is there any way to get names of all commands a bot has

#

i mean i'm running bot on two different hosts

#

one with all cmds

slender thistle
worn sonnet
#

yeah

#

and other with no cmds

#

so what i wanna do is retrive all cmd names from that other instance of the bot

slender thistle
#

But why

worn sonnet
#

i'm using one instance for webpage

#

to show the details of number of servers

#

channels and all

slender thistle
#

You can do that in one instance though

worn sonnet
stiff lynx
carmine magnet
#

With slashs commands ?

stiff lynx
carmine magnet
#

Im not talking to you

#

Give the error

stiff lynx
slender thistle
#

So you have one instance on some host and the webpage on Heroku?

austere delta
slender thistle
#

In that case you'd need to implement an API

#

via HTTP requests

stiff lynx
worn sonnet
#

so basically something like

#

the bot post data to webpage

#

when requested isn't there any other way round?

slender thistle
#

I assume you do that via HTTP requests already?

#

What do you mean?

worn sonnet
#

i mean

slender thistle
#

You can make the API send and receive data just fine 👀

worn sonnet
#

well oke

austere delta
#

dont kekw me

stiff lynx
worn sonnet
#

dumb me thought i could fetch the cmds from discord API or something

slender thistle
#

Nah

worn sonnet
#

makes sense

slender thistle
#

Commands are what your bot does when receiving message events

#

It's all local unless you use slash commands, and even then I'm not sure you can fetch that KEKW

austere delta
slender thistle
#

So what you very possibly want is to have your bot host an HTTP/websocket listener that's attached to your bot object (which can be done via the superior aiohttp)

#

and then your API sends a request to that listener and receives a list of commands

#

Very possibly in a JSON format

stiff lynx
slender thistle
#

I believe you know how you can implement that for your own use case

austere delta
#

sorry i suck at explaining/teaching

stiff lynx
#

definetly lol

#

but I want to filter First by the serverID (guild.id) and after the userID (Primary Key) and the coins connected to userID

#

Sorry I suck in Reading comprehension

austere delta
#

hm

pearl trail
austere delta
#

i quit, my brain fried. sowwy.

pearl trail
#

so it'll be like:

let leaderboard = new Collection();
console.log(leaderboard);

const database = await ProfileModels.find()
for (let data of database) {
    if (!leaderboard.get(data.serverID)) {
        leaderboard.set(data.serverID, [{ userID: data.userID, bank: data.bank }])
    } else {
        const struct = { userID: data.userID, bank: data.bank }
        leaderboard.get(data.serverID).push(struct)
    }
}
console.log(`dopo il push del database ${leaderboard}`);

you can get all the stored user data by leaderboard.get('guild id here')

austere delta
#

pog

slender thistle
daring prawn
#

How do I make it show voted user avatar using top.gg/sdk

austere delta
slender thistle
#

It's ok

earnest phoenix
#

In SQL and javascript, when i select in my table, how can i get true (if record exist) or false (if record not exist)?
I do this but my send send me always « no » if record exists or no..

let antiFullCaps = options.database.promise().query(`SELECT * FROM antiFullCaps WHERE guild_id = '${message.guild.id}'`); antiFullCaps === true ? antiFullCaps = "yes" : antiFullCaps = "no";

tacit sequoia
#

Cause it's a promise, first thing

lyric mountain
#

SELECT COALESCE('yes', 'no') FROM antiFullCaps WHERE guild_id = :id

#

there's no true/false in sql

#

only 1 and 0

earnest phoenix
#

ok thx

lyric mountain
#

also don't use concatenation when it comes to sql

#

always use parameters

boreal iron
#

oops forgot to disable the mention

slender thistle
#

what

boreal iron
#

what it fetches... what an unlucky formulation

#

lmao

slender thistle
#

Well, that makes more sense KEKW

boreal iron
#

or... what you fetch, he/she/it ... err whatever, leave me alone

#

I'm done and being just here to fuck up KuuHaKu

#

just because he's a good guy

slender thistle
boreal iron
#

don't even understand myself the shit I'm talking... god

rare trail
#

running more bots with 300+ servers under the same ip can cause issues?

boreal iron
#

can't imagine the bandwidth limit would be an issue, so probably not

lyric mountain
#

also shit this is disgusting

pale vessel
cinder patio
#

Honestly that sounds pretty easy to do with a single for loop

lyric mountain
#

wtf is that doing?

slender thistle
#

I feel like that's literally overcomplicated beyond all recognition lmfao

lyric mountain
#

like, if it was to extract 2 letters preceeded by + or - it'd be just (?<=[\+-]).{2}

rocky hearth
#

omg, that so much appreciatate, thanks.
But how it took only 1.34ms to run?

slender thistle
#

because regex

stiff lynx
pearl trail
#

what do you want to log?

slender thistle
#

Regexes in small cases are fine, but large-scale you want to avoid them

stiff lynx
#

and after that the sort thing etc

pearl trail
#

just console.log(leaderboard)

stiff lynx
pearl trail
#

hmm, sus

stiff lynx
#

amongus

rocky hearth
#

but tomorrow, the stats were different, around 150ms with simple regex

lyric mountain
#

you logged an empty collection

stiff lynx
lyric mountain
#

it's obviously a [object Map]

stiff lynx
#

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

const model = mongoose.model('ProfileModels', profileSchema);

module.exports = model;```
pearl trail
#

did you want to log here?

stiff lynx
#

this is the schema

lyric mountain
#

regardless, you're showing the first log

#

not the second

stiff lynx
stiff lynx
pearl trail
#

it shouldn't give object map tho if you use console.log

lyric mountain
#

that second shouldn't (can't) show [object Map]

pearl trail
#

afaik it'll be object map if it's on string

stiff lynx
lyric mountain
#

it'll be dopo il push del database [object Map]

stiff lynx
pearl trail
#

yeah don't use that

#

log it separately

stiff lynx
#

with only console.log(leaderboard) shuld work?

pearl trail
#

yes

lyric mountain
#

I'm not sure it'll work

#

most likely it'll convert the collection to string and result in the same thing

pale vessel
#

I have no idea what I'm doing

#

Well, I do but

#

yes

lyric mountain
stiff lynx
pale vessel
#

and I'm not using a for loop

pale vessel
lyric mountain
#

yeah, but, what's the goal? extract 2 letters preceeded by + or -?

pale vessel
#

He wanted to separate the numbers and non-numbers

stiff lynx
# pearl trail yes

2021-05-12T12:46:28.176720+00:00 app[Worker.1]: { userID: '658234646932357140', bank: 20000 },

#

this is mine profile and i see a lot of others

#

it worked

pale vessel
#

but then he needs to split a part of the string that starts with either + or -, followed by 2 characters next to it

pearl trail
#

nice

pale vessel
#

That's where it gets complicated (for me)

#

but I tried

lyric mountain
#

I see

stiff lynx
slender thistle
#

Can't you just do that with a for loop

pale vessel
#

Definitely

#

but I'm too used to reduce()

rocky hearth
#

ok, thanks again

#

there's one more coming afterwards. 😛

pale vessel
#

Fuck me

subtle kiln
#

Hi, I've some questions related to the ShardingManager of Discord.js:

  • Can the number of shards evolves at runtime?
  • Can a guild change shard at runtime?
lyric mountain
#

no and no

#

afaik

subtle kiln
#

ok thx

slender thistle
lyric mountain
#

that's not the goal

slender thistle
#

Ah, I see

#

Yup, my bad

lyric mountain
#

if I understood right, it must:
A - separate strings from number and
B - separate pairs that are preceeded by + or -

#

tbf, a loop would still be easier for that

cinder patio
#

for loop way

lyric mountain
#

just fulfill B then check for A on the remaining string

cinder patio
#

probably can be shortened

#

but i cba

slender thistle
#

Ya well I cba to do that in Python

cinder patio
#

wait why isn't 12 a number

#

ah I see

#

there

#

yeah there's def a better way to do it with a for loop

#

^ And it takes 0.07 milliseconds

stiff lynx
#

leaderboard.filter(data => data.serverID === message.guild.id);
Why this doesnt filter?