#development

1 messages ยท Page 1515 of 1

gilded olive
#

type-ORM?

opal plank
#

i need a way to assign personal and system mails to an account without spamming it or spamming calls on a creationg of account

solemn leaf
#

Limits

#

?

opal plank
#

very descriptive, thanks

long marsh
#

Nah, there's not bugs or anything. I don't ever see that actually happening though? Is it a 1-to-1 process? If a shard is reconnected to the gateway that counts as +1 for that 24 hours? If that's the case, then, even on an update, I wouldn't ever see that. I could probably update the same bot multiple times in the same day. It wouldn't probably start becoming a problem until I hit millions of servers?

gilded olive
#

so a user can have many emails

opal plank
#

the mails are generated on my end, not on theirs

gilded olive
#

but you want a limit on how many emails?

#

then check

opal plank
#

ratelimiting isnt the issue at all

solemn leaf
#

Ok

long marsh
#

Also, Papi, I appreciate your time.

#

I'm learning ๐Ÿ˜„

lament rock
opal plank
#

imagine the following
-10 system mails that were sent the past 4 weeks.

with a new user => i'd have to create all those 10 system mails with their user id
not only that, the new user would have their own personal mails too.

Each user would end up having 15-20 mails each.

I already got a user base of 200k users, i cannot afford to have over 4 mil entries in a database, thats absolutely retarded and not scalable

#

not only do i need to add a new system mail to every account existent, i need to also add it whenevr a new user is created

long marsh
gilded olive
#

that is interesting

long marsh
#

If I hit that point, I'll just move from docker ๐Ÿคทโ€โ™‚๏ธ

lament rock
#

Would you rather rush to implement something when you could be prepared for potentially unexpected scale?

gilded olive
#

why are you creating 10 system mails?

opal plank
#

10 system messages were created last month, how do i have the user have those mails in their inbox without adding a new mail with their id?

long marsh
#

I see your point though.

opal plank
#

cuz i also need a read state, so i cant simply assign a base one

#

so i need a PER user mailbox

#

the issue becomes with the sheer scalability of it

long marsh
#

I haven't even conceptually thought about scale at that size because I truly have no idea if the bot will ever be that successful.

lament rock
#

Well. You most likely won't gain millions of servers overnight, but preparing for the worst case scenario makes your application more resilient when you need a competitive edge. Those few seconds of downtime is everything to an end user

gilded olive
#

hmmm

opal plank
#

now you starting to realise that the issue isnt a simple one to fix

gilded olive
#

yea....

opal plank
#

hence why i was calling tim

long marsh
opal plank
#

i said before, i know what im doing but i dont know how to scale it

gilded olive
#

Lemme do some debugging with a db to see

opal plank
#

actually, another person i might be able to bother is evie

gilded olive
#

I mean in my case I would just have those system mails as defaults

#

instead of creating new ones every time

opal plank
#

@umbral zealot can you provide some assistance with logic?

quartz kindle
#

wut

opal plank
#

to have them in a read or non-read state

lament rock
#

Then I guess that's all there is to it. Learn something new just in case

opal plank
gilded olive
#

let me try something

opal plank
#

k

opal plank
#

is call an option to you

long marsh
opal plank
#

its a lot simplier to explain with voice

quartz kindle
#

im gonna go sleep

#

lmao

opal plank
#

all gucci

quartz kindle
#

but like, is it like a database and users have access to a "mail" system, and they can view their mails?

opal plank
#

correct

quartz kindle
#

and each user should have these system mails in their inbox?

opal plank
#

not only when an account is created, but also when theres a new system mail

gilded olive
#

(make system mails default on created)

quartz kindle
#

then why not have a table for system mails

umbral zealot
#

provide assistance with what logic

opal plank
#

thats the thing

quartz kindle
#

and the content of the mail is a template that is replaced

umbral zealot
#

I've not been following the thread

opal plank
#

hmmm

#

not sure if that would work tim

opal plank
#

cuz i need those system mails to have meta too

umbral zealot
#

i cannot afford to have over 4 mil entries in a database, thats absolutely retarded and not scalable
false

opal plank
#

so i cant have just 1 system mail

quartz kindle
#

what kind of meta

opal plank
#

read / opened / used / amount

umbral zealot
#

Database entries don't matter, you can have a billion of 'em in most databases

opal plank
#

and possibly some more

opal plank
#

SELECT * FROM table WHERE user = userid

#

a prob LIMIT 10

quartz kindle
#

have your db be lazy loaded

opal plank
#

wdym?

umbral zealot
#

a good database with some redis caching is perfectly fine imho

hoary vine
#

i writed discord bot code on vsc now how do i run the code for the bot?

opal plank
quartz kindle
#

you have 10 system mails in a table for the system account
all users have access to these 10 mails, but the db is not populated, only when the user actually uses the email command, then those mail templates are taken, and added as mails to their accounts for full access

hoary vine
#

how do i run the code

quartz kindle
#

you have 200k users, but less than 10k will likely actually use these commands

umbral zealot
#

You're acting as if that's actually a non-solved problem, but it's literally solved. that's what redis is all about. you can add a TTL to remove stale entries after a certain amoun of time

hoary vine
#

i writed discord bot code on vsc now how do i run the code for the bot?

earnest phoenix
umbral zealot
#

I will keep linking this until you actually do it

umbral zealot
opal plank
earnest phoenix
#

but

hoary vine
umbral zealot
earnest phoenix
#

o wait

#

nvm

hoary vine
#

which do i click

umbral zealot
#

honestly scale isn't that much of a problem

umbral zealot
opal plank
#

i could just fetch all system mails from a table and add them on the private user every time theres a new user created

umbral zealot
#

go learn

hoary vine
#

ok

solemn leaf
#

guys

hoary vine
#

how

solemn leaf
#

ctrl t

quartz kindle
#

you dont need to add them to the user when a new user is created

solemn leaf
#

node .

hoary vine
#

k

opal plank
#

but that goes back to what i mentioned, imagine 200k users, that'd be 2 mil JUST on system message mails

umbral zealot
#

Erwin it's as simple as ```
get from redis or fetch & cache in redis for the next time

quartz kindle
#

add them only when a user actually uses the command

hoary vine
#

?

#

how do i run it

umbral zealot
opal plank
exotic zodiac
#

Hi

opal plank
#

my db is local, there shouldnt be much effect at all with queries

hoary vine
#

I writed Java for the bot now HOW do i run it?

solemn leaf
umbral zealot
solemn leaf
#

if you can do that

umbral zealot
#

ffs go follow tutorials

solemn leaf
#

then you can find a video on how to start it

opal plank
#

with duplicate entries and stuff. Even doing as tim said and only gen on the command, it'd still rack up

#

specially when i plan it to be a core command

umbral zealot
quartz kindle
#

well what else are you expecting to do?

earnest phoenix
#

it says "localhost refused the connection"
what do i do?

opal plank
#

what i was thinking was using bitwise to gen the system messages

umbral zealot
#

There's no magic solution other than "just use a database" that's their reason to exist - to store data

opal plank
#

that'd shorten the mails to a single int

#

at least the system ones

#

i could shorten the meta to a bool

#

either read or non-read

pure lion
#

What's going on here

earnest phoenix
#

can someone help me?

pure lion
#

With Erwin silly

opal plank
pure lion
#

Erwin wyd

gilded olive
#

looks like you did not start localhost

quartz kindle
#

sure you can do all of those optimizations, but they wont make that much of a difference

gilded olive
#

are you sure you did

earnest phoenix
quartz kindle
#

if you need 2 mil entries, you need 2 mil entries

gilded olive
#

run the file

opal plank
#

hmmmm

earnest phoenix
#

i did

quartz kindle
#

you can optimize them to be more efficient and use less space, but its still 2 mil entries

gilded olive
#

did it tell you it started?

#

which port it is on?

earnest phoenix
#

yep

quartz kindle
#

unless you go the lazy load route and use templates

opal plank
#

i might go with that then, and add redis to keep ti cached, or even let it in the process memory

earnest phoenix
gilded olive
#

how are you running this? the html or js file?

earnest phoenix
#

html

quartz kindle
#

whatever is shared between accounts can be templated so its only stored in a single location and generated for the user when needed

gilded olive
#

oh if its html file

#

get live server extension

#

and use that

#

ez pz works like a charm

quartz kindle
#

thats the only way to not need 2 mil entries

earnest phoenix
gilded olive
#

"Live Server"

opal plank
#

how does this sound

table 1 = system
all system messages with blank templates/default meta

table 2 = user;

when user uses command, check if user has system messages.
if it doesnt, SELECT * from system and then SET every one of them onto user with their id;
//cache entries

on new sys message => add onto system and add onto all users

quartz kindle
#

only add to users whose db has been initialized

#

dont add to users who have nothing

#

or

#

add to system

#

and whenever a user accesses their db

#

check if there is any new system

earnest phoenix
#

wich one? @gilded olive

quartz kindle
#

and only add then

opal plank
#

isnt that less performant? since it needs to check all sys entries?

#

COUNT() prob works

quartz kindle
#

but only when a user uses it

opal plank
#

but that'd be 2 queries

quartz kindle
#

on-demand is always better than a query that affects all users

opal plank
#

hmmmm

#

thats true

#

i might make a bigserial on the system table

#

and then fetch all and cache

quartz kindle
#

you can put a timestamp on the user for the last time they checked system

opal plank
#

or better yet, i think i can keep sys cached

#

that'd save that extra call i was talking about

quartz kindle
#

ye

#

welp im off to sleep, see ya

opal plank
#

alright, ty for the help

#

you too @umbral zealot

umbral zealot
opal plank
#

i might not use redis and use it in the mem instead

#

well, back to work

#

ty both

#

actually why do i need a second table again?

#

i can just add user as "system"

#

ye

#

single table ftw

earnest phoenix
#

how can i paste something into a VPS's cmd?

pure lion
#

right click

earnest phoenix
#

oh

solemn latch
#

weird thing about terminals.

long marsh
#

I just switched to redis, lol. Was it a bad choice?

opal plank
# long marsh Wait, why?

cuz there isnt a use case for redis here, i already have my users stored in the process memory, splitting what belongs to user outside doesnt make sense

long marsh
#

What about for sharding?

opal plank
#

depends on what you need for sharding

long marsh
#

I had a singular kevy cache instance stored as a frozen object ... but each 'shard' would actually spin up a new instance of it.

opal plank
#

last time i fucked with sharding i almost got banned from twitch

long marsh
#

So, the global caching didn't work ๐Ÿ˜ข

pure lion
#

What did you do lmao

opal plank
#

it does work if you set the cache to not attach on a single process

pure lion
#

Does twitch not support sharding

opal plank
pure lion
#

Bruh

long marsh
#

How do you set the cache to not attach on a single process?

pure lion
#

That's a bit stupid

opal plank
#

once you get past 100 ish streams, you fucked good time

pure lion
#

That's really stupid actually

opal plank
#

google it

#

my VPS has it setup, but if you ask how, i wouldnt be able to tell you

#

you connect with the port, just like in postgres

long marsh
#

Ah, yeah - at that point .. why not just use Redis though?

#

Singular point for your cache

opal plank
#

i explained

opal plank
#

splitting user into redis and process memory makes no sense

#

either i port everything to redis

#

oor keep it in process

gilded olive
long marsh
#

Ah, I'm sorry. Yeah, I use Redis for legit everything.

#

Keyv + redis

gilded olive
opal plank
#

redis is powerful, and most of the times the answer for most stuff, but not in this case

long marsh
#

Gotcha

#

Yeah, I saw a huge performance increase when switching from in-memory maps to redis.

#

I honestly wasn't expecting it

opal plank
#

yeah like i said, its powerful

#

but just like postgres, it has use-cases

fickle magnet
#
using System;


namespace Program   {
  class MainClass {
    public static void Main (string[] args) {

      Console.WriteLine(example()[0]);

    }
    public string[] example()  
    {

      string[] arr = {"aour","aour","aour","aour"};

      return arr;
    }
  }
}

Always had a hard trying to return arrays in this language

opal plank
#

java?

fickle magnet
#

c#

#

might ask how to do the samething incept in c++

blissful coral
#

I am pretty sure that is fine...

#

Do you get anything when you run it

fickle magnet
#

yea I thought so too but I kept getting this error however it is in repl.it
mcs -out:main.exe main.cs main.cs(8,25): error CS0120: An object reference is required to access non-static member `Program.MainClass.work()' Compilation failed: 1 error(s), 0 warnings compiler exit status 1 ๎บง ^C

blissful coral
#

hmm

fickle magnet
#

oh

blissful coral
#

wait

fickle magnet
#

I forgot I changed the name of the function

blissful coral
#

lmao

solemn leaf
#

nice

fickle magnet
#

but same thing weather it is work() and example()

#

I get the same problem incept different same for the function

blissful coral
#

I didn't read but

#

When I look up error

#

This stack comes up

#

so

#

Check on that

fickle magnet
#

alright I keep forgoting that website exist

blissful coral
#

lol

crimson vapor
#

why do you know c#?

fickle magnet
#

wdym by know C#

solemn latch
#

isnt c# super common for lots of things?

fickle magnet
#

well yea inspecially in applications

#

from what I heard people usually like that language due to how easy it is to compile

lament rock
#

I've heard it's common to mistake cs code for Java

solemn latch
#

wait really?

fickle magnet
#

that is understandable they look pretty simular in syntax

lament rock
#

Like I said, just what I heard. I cannot confirm or deny but Java is pretty easy

fickle magnet
#

u can type public static void in both java and C# I think

sudden geyser
#

does C# care about the order

fickle magnet
#

not sure haven't really went into how languages work in the background

lament rock
#

public or private usually comes before any type declarations

fickle magnet
#

closest I ever gotten to that knowledge was that intro to computer science I in the semester I just took

fickle magnet
lament rock
#

All statically typed languages

#

I forget if TypeScript would qualify as statically typed since JavaScript isn't but TypeScript kind of is based around types.

fickle magnet
#

interesting

#

I haven't coded in Java in such a long time I only did it in one class I took in highest last year

#

and at the end of the year before that

sudden geyser
#

TypeScript is statically typed.

fickle magnet
#

ok

lament rock
#

I messed around with Minecraft Forge for a while before I quit because it was horrendous to work with

sudden geyser
#

But only for correctness rather than performance

lament rock
#

Not a great intro for Java

fickle magnet
sudden geyser
#

Minecraft is another story.

#

Especially some servers

#

hypixel api

fickle magnet
#

Im not surpised like how do u generate an infinite world

lament rock
#

It was god awful. I constantly hated myself because people say the API has a lot to offer but it was so incredibly difficult to learn because the only docs to go by was intellisense from the IDE

sudden geyser
#

Java has documentation online, what do you mean?

lament rock
#

Forge specifically

sudden geyser
#

Oh

lament rock
#

Java wasn't hard

fickle magnet
#

see I would love to do modding in minecraft but what u described is as horrible as I imagine

lament rock
#

I already had a clear understanding from the beginning because I was already proficient in JS and TS

#

Not too hard to grasp concepts

#

Fabric is good. I took a look at that but still wasn't motivated to port some of the stuff I made

gilded olive
opal plank
#

is there a way to get the function name from inside the function?

fickle magnet
#

android studio lol

sudden geyser
opal plank
#

how'd you do it?

sudden geyser
#

You can just do Function.name

fathom nymph
#
const DBL = require('dblapi.js');
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});```
#

Hey in webhookAuth

#

password

#

what kind of password?

sudden geyser
#

anything

#

You use it to verify the request is from top.gg

fathom nymph
#

Oh oki

opal plank
earnest phoenix
#

Hi, I have a repository on GitHub and recently was thinking on somehow hosting my bot to be on 24/7 but I don't know how much it is going to cost and where to host it, any suggestions?

solemn latch
#

i suggest galaxygate, or even google cloud f1 micros(free) if you wanted.

earnest phoenix
#

Oh, thanks I will try these

static trench
#

hello. i want to make some webhooks in my server. i have the JSON file. how do i axtually host it?

solemn latch
#

you want to host a json file?

static trench
#

yes

#

or how do i make the webhook?

#

i have the file

#

what do i do?

solemn latch
#

so your looking to host a json file and make a webhook?

lilac owl
#

Sorry to interrupt - just wanted to ask if anyone knows if cdn.discordapp.com have a ratelimit? I want to do some stuff with images (profile pics, etc.) but dont want to be rate limited or banned

static trench
#

yes

static trench
solemn latch
static trench
#

ok

#

ill try

#

one sec

#

@solemn latch it worked. thx for the help

lament rock
#

If you're doing simple stuff like image manipulation, I really wouldn't worry about cdn ratelimits unless you're making a ton of requests in a short timeframe

lilac owl
#

ok thank you

long marsh
#

Woo, you kill me man lol

gritty bolt
#

I'm trying to make a bot that reminds users of a message when it is reacted to. I'm having an issue stating that my remindUser function is undefined, but I'm also not sure if I'm totally doing everything in the more straightforward way. Would anyone be able to help? https://pastebin.com/LK1Y1vKC

long marsh
#

I know you're just asking for clarification, but it's just funny to me nonetheless.

solemn latch
long marsh
#

Haha, I see

#

Excuse me for asking, but are you here on your own accord? Or is it entailed in the bot reviewer position to additionally moderate development / interact?

solemn latch
#

nope, i just come to development inbetween looking at support and doing other stuff.

#

third monitor op

long marsh
#

Haha, nice

#

I used to rock three monitors

long marsh
earnest phoenix
#

it's not

solemn latch
#

last time i checked the micros are free forever

earnest phoenix
#

it's free forever as long as you got a plan afaik

solemn latch
#

wait what ๐Ÿค”

earnest phoenix
#

from what I heard, I still got my trial period so, not sure.

long marsh
#

Is it 512mb ram?

solemn latch
#

trial period for googles free credit is temporary, the f1 micros i think are always free

#

yeah

#

they are tiny

long marsh
#

Hah, gotcha

solemn latch
#

but perfectly fine for tiny bots

long marsh
#

I haven't had any problems with my droplet

solemn latch
#

you get .2 of a cpu too

long marsh
#

.2!!!!

#

lmao

#

I was assuming .5

solemn latch
#

ikr

long marsh
#

That's hilarious

solemn latch
#

for free though, i have some random thing on it

long marsh
#

imagine ... ".2"

earnest phoenix
#

you can spend the free credit as much though

long marsh
#

Do your account replenish each month with the credits?

solemn latch
#

for the f1?

earnest phoenix
#

it's $300 in the first place

gritty bolt
earnest phoenix
#

seems like the f1 is available as long as you got billing enabled

frail siren
#

discord.py help needede

How will i make is check if the bot has perms or what not so the mods know what perms to give it

empty leaf
#

how do i change the roles and main settings

solemn latch
empty leaf
solemn latch
#

what bot?

empty leaf
#

the activity oe

#

one

solemn latch
#

this is top.gg support, not activity bot support.

frail siren
#

is this good?

solemn latch
#

you need to ask in the activity bots support server @empty leaf

solemn latch
frail siren
#

what price would you put on it for my discord bot?

#

like 1$ a month

#

i might of been scammed

solemn latch
#

price of hosting is generally more complicated than just those numbers

#

with those specs, it could be worthless, to $10 a month depending on other factors.

#

if it works for you, thats fine though.

frail siren
#

ok

ancient briar
#

Need-bot-maker-free-brain-not compatible AAAAAAAAAAA

solemn latch
#

learning to make bots is a long process

#

learning to code is an even longer process

#

ideally youd spend a month learning about programming before starting to make a bot.

ancient briar
#

Can someone do it for me? You guys should make a way to do that

solemn latch
#

yeah, its called hiring someone to do it.

ancient briar
#

No I mean for free

zenith terrace
#

you wont get anyone here to do it for free

shy turret
#

whats that link again that you reply to when people just say "HELP ME!!!" with no context?

ancient briar
#

Like to get robots to program- Other robots! Iโ€™m a dumb genius

solemn latch
#

you know it requires a somewhat skilled person to make a quality bot right?
its like expecting someone to give you a car for free, it just wont happen.

shy turret
#

thanks

frail siren
#

only a month i am way over qualified

frail siren
solemn latch
#

totally cool if you two want to do that, but you should take those kind of discussions to DM's

frail siren
#

yeah DM me for more info

gritty bolt
#
TypeError: core.remindUser is not a function
    at C:\Users\Sam\Desktop\RemindMe\RemindMe\core.js:104:43
    at Array.forEach (<anonymous>)
    at Object.scheduler [as nodeSchedule] (C:\Users\Sam\Desktop\RemindMe\RemindMe\core.js:102:43)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)```
const core = require('./core.js');
//Remind User Function
remindUser: async function remindUser(bot) {
try {
    let reminderEmbed = new discord.MessageEmbed()
            .setTitle(data.messageLink)
            .setDescription("You asked me to remind you at this time of the message linked above. Click the link to view the message. If the link does not work, the message may have been deleted or you do not have access to it anymore.")
            .setColor("#FF0000");
            await data.user.send(reminderEmbed)
            data.remove();
} catch (err) {
    console.log(err);
}
},
//Node-Scheduler Function
nodeSchedule: async function scheduler(bot) {
try {
    (await messageReminderModel.find({})).forEach(data => {
        let currentUnix = Date.now()
        if(data.time <= currentUnix) core.remindUser()
        schedule.scheduleJob(data.time, remindUser);
    console.log("Scheduled a reminder.");
});
} catch (err) {
    console.log(err);
}
}
``` Anyone know how to fix this?
ancient briar
#

Brain not compatible with that AAAAAAAAA

drifting wedge
#

how do i send a embed and a message in the same message? dpy
await ctx.send(embed=embed, f"> Viewing Profile [ {member} ]")

earnest phoenix
#

content parameter.

drifting wedge
#

wdym

swift cloak
earnest phoenix
#

either ...send(embed=embed, content=content) or ...send(content, embed=embed). both work as content is a pos arg.

drifting wedge
#

ill try

#

ty

solemn latch
#

for some reason i thought you didnt do , for named parameters in py

#

no idea why

earnest phoenix
#

wdym?

drowsy grail
#

like the comma separator?

drifting wedge
#

embed.set_image(url=discord.File('profile111.png')) can i do this?

#

spoiler: no

earnest phoenix
#

tias

drifting wedge
#

can i just get the file?

#

like send the file

#

just the file

drifting wedge
#

ty

lament rock
#

I've been at this for 3 years and I don't think my bot is good enough to net me the ability to accept commission work

#

idk what you guys are on

mellow kelp
#

epic pfp

distant cobalt
#

how do i delete a role using the bot? (djs)

#

is it something like role.delete?

#

or smth

distant cobalt
#

k

#

okay thanks

lament rock
#

I kinda hate how there's no way to delete a resource from the manager and instead requires the resource to be cached to delete it

drifting wedge
#
            embed.set_image(url='attachment://profile111.png')

            await ctx.send(f"> Viewing Profile [ {member} ]\n", embed=embed)``` like this?
#

Invalid argument: 'attachment://profile111.png'

earnest phoenix
#

Can't help much with that snippet.

drifting wedge
#

Wdym

#

@earnest phoenix

earnest phoenix
#

What am I supposed to do with such incomplete code and traceback

knotty stirrup
#

i learn code

#

print.log(ok)

drifting wedge
#

Like basically the docs say 2 things

#

It has the file=file part, and the url attachment part for embed

#

I only need the embed one right?

earnest phoenix
#

and you don't even have that file=file part

drifting wedge
#

Yep

#

I don't, I didn't understand it

#
file = discord.File(filename="profile111.png")``` i dont need the path right? this leads to the file already
#

like its in the same folder

earnest phoenix
#

then don't specify any kwarg

drifting wedge
#

mhm

earnest phoenix
#

it only needs 1 parameter, fp, which you don't provide. filename could be None and it'll take either the file name or the name attribute of the file-like object.

drifting wedge
#

mhm

#

i just deont get

#

why it needs the file = part

#

and the embed.set_image(url="attachment://image.png")

#

isnt ^ this just enough?

earnest phoenix
#

How is discord supposed to know which image.png?

drifting wedge
#

ok so i dont need the path?

earnest phoenix
#

attachment://image.png just basically moves the attachment to the embed

drifting wedge
#

filename="image.png" works?

earnest phoenix
#

no

drifting wedge
#

alr

#

ill add the path ig

distant cobalt
#

How do you cache a user?

delicate shore
#

Hey there

mellow kelp
#

pretty sure discord.js does it automatically or something i think

distant cobalt
#

nvm

#

lol

#

How do you get the user's in server nickname?

delicate shore
#

@umbral zealot Hey there
GM

#

I did some logging

distant cobalt
#

...

delicate shore
#
[ 'Neutral' ]
undefined
undefined
0
 console.log(optionsboi) 
 console.log(predictions.className)
 console.log(predictions.probability)
 console.log(probboi)
#

predictions.className and predictions.probability is undefined

shrewd creek
ebon kelp
#

So it's never assigned

delicate shore
ebon kelp
#

Send code

distant cobalt
delicate shore
#

I will send in bits and pieces which I think is req

shrewd creek
#

js idk maan..

distant cobalt
#

ok

delicate shore
#
            async function fn() {
                const pic = await axios.get(Attachment.url, {
                  responseType: 'arraybuffer',
                })
                const image = await tf.node.decodeImage(pic.data,3)
                const predictions = await model.classify(image)
                image.dispose()
                console.log(predictions)
                console.log(predictions[0].className + " " + predictions[0].probability)
                let i = null
                for (i = 0; i < predictions.length; i++) { 
                console.log(optionsboi) 
                 console.log(predictions.className)
                 console.log(predictions.probability)
                 console.log(probboi)
            if(optionsboi.includes(predictions.className)){

             if(predictions.probability > probboi){

                Attachment.delete()
             }
            }
                } 
              }
              fn()
#

Here

#
 console.log(predictions)
 console.log(predictions[0].className + " " + predictions[0].probability)

Gives out -

[
  { className: 'Neutral', probability: 0.7704196572303772 },
  { className: 'Drawing', probability: 0.22774365544319153 },
  { className: 'Hentai', probability: 0.0018031611107289791 },
  { className: 'Porn', probability: 0.00002596447848191019 },
  { className: 'Sexy', probability: 0.000007494812052755151 }
]
Neutral 0.7704196572303772
ebon kelp
#

This is horrible to read on mobile xd

delicate shore
#

xD

#

OH WAIT

#

I FIGURED IT OUT

#

LMAO

ebon kelp
#

Lol

delicate shore
#

It was a small mistake

distant cobalt
#

k

ebon kelp
#

.author =/= .member

#

Read the docs

delicate shore
#
(node:6071) UnhandledPromiseRejectionWarning: TypeError: Attachment.delete is not a function
    at fn (/Users/navdeepsharma/Desktop/anti-nsfw/index.js:45:34)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:6071) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:6071) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
#

Should It be msg.delete()?

ebon kelp
#

It's not a function

#

It does not exist

delicate shore
#

oh

#

in djs

#

can we delete attachment

#

using msg.delete()

ebon kelp
#

You have to delete the message, you cannot delete 1 attachment

delicate shore
#

OMG

#

Holy shit

#

It worked

ebon kelp
delicate shore
#

My bot is now deleting NSFW Imges which is big pog

ebon kelp
#

Interesting

#

My bot does the same monkaHmm

buoyant aspen
#

Quick dumb question. I have a website that requires you to sign in with Discord. How can I easily stop search engines from indexing pages that require a login? (Seeing as the search engine is not logged in, it will simply be server-side redirected to the Discord login page, and I don't want that indexed)

tribal siren
#

how to get a user's in-server message count?

ebon kelp
buoyant aspen
#

The redirect is server-side. How can I set meta tags?

ebon kelp
#

Oh wait

buoyant aspen
ebon kelp
#

So when you're not logged in you get redirected to the login page?

ebon kelp
#

So also count

buoyant aspen
ebon kelp
#

Are you using a web framework?

buoyant aspen
#

I use express and passport-discord

ebon kelp
#

Angular for example has Guards

#

Hmm

#

Page routing with Express, yes?

buoyant aspen
#

Not totally sure what you mean. It's handled by passport, but I assume it's a simple res.redirect() call

ebon kelp
#

You can check if a discord token if present if not redirect

buoyant aspen
#

But how does that help me with the seo issue? Would it work to redir to a different page if the user-agent is Googlebot or something?

ebon kelp
#

If no other page is returned first, I believe so

buoyant aspen
#

By the way, I did consider robots.txt, but that's not perfect.

buoyant aspen
ebon kelp
#

What

buoyant aspen
#

They have rules against a redir to a different page if a bot is detected

#

Like fraud prevention stuff

mellow kelp
#

why would robots.txt not work tho?

#

pretty sure the google crawler reads it

buoyant aspen
#

It does. However, I'm also trying to catch Twitterbot and discord's crawler.

mellow kelp
#

oh do those not read robots.txt?

#

dang

buoyant aspen
#

I'm not sure. I don't think they do, seeing as they aren't search engines.

mellow kelp
#

yeah i guess relying on robots.txt isn't the best idea

buoyant aspen
#

Also, if the bot (even Googlebot) follows a link from another site it doesn't read robots.

ebon kelp
#

Why not building your website with Vue.js, which you have experience with according to your gh

#

I bet vue.js has some sort of guard

buoyant aspen
#

Cause this website isn't great for Vue, and my experience is pretty basic.

#

I'm just looking for ideas here lol

ebon kelp
#

Just redirect to a different path if no token is found

buoyant aspen
#

That path is the discord login page ๐Ÿคฆ

ebon kelp
#

Then redirect to '/'

drowsy epoch
#

@earnest phoenix Have u installed github desktop

earnest phoenix
#

no

digital ibex
#

I obviously donโ€™t know exactly what ur doing but it seems like ur doing something with oauth and ull most likely wanna use a web framework even if it isnโ€™t vue

earnest phoenix
#

OKe

gilded olive
#
i = []
for x in range(1000):
  i.append(x)
for y in enumerate(i):
  yield y``` run this for good bot ๐Ÿ‘
umbral zealot
# delicate shore I FIGURED IT OUT

SEE I KEEP TELLING PEOPLE!
Tired Programmer are Dumbass Programmers.
You went to bed, you woke up, problem solved in 4 fucking minutes on your own ๐Ÿ˜‚

#

You could have been playing a video game instead of bashing your head against the desk on a stupid code problem ๐Ÿ˜„

earnest phoenix
#

Sometimes i prefer play any videogame instead make new commands

#

I have to get fun too, not program every time

mellow kelp
#

i just kinda have fun programming

#

until i don't

solemn latch
#

Programming is fun! That's why I haven't done any for a month

mellow kelp
earnest phoenix
#

I mean when i'm tired or i programmed all day

umbral zealot
#

Sigh. sometimes I really hate javascript and how it handles promises.

earnest phoenix
#

Lmao

long marsh
#

Anyone successfully configured OAUTH with actually having a redirect server?

#

Possibly 'faking' it?

mellow kelp
#

wdym by redirect server

#

the redirect uri thing?

umbral zealot
#
  async mapByFunction(fn) {
    const all = this.getAll();
    const promises = Object.entries(all).map((value, key) => fn(value, key));
    return Promise.all(promises);
  }

This gets an object from this.getAll(); and it returns a fucking array of [key, value] arrays and that's really pissing me off.

long marsh
#

OAUTH, as a protocol, requires a redirect /callback url.

mellow kelp
#

yea

#

thats how you handle the code and stuff

solemn latch
#

Discord makes it easy to setup that iirc

mellow kelp
#

oauth2 itself is pretty simple

umbral zealot
#

There... is a way, without a server, I think

mellow kelp
#

whoa there

umbral zealot
#

But it's been a damn while since I saw that discussion on discord-developers

mellow kelp
#

actually i can see that

long marsh
#

I'm trying to interface with the Patreon API, but it requires a callback uri.

earnest phoenix
#

gm

long marsh
#

When I feed it localhost, it comes back with a port 80 issue.

mellow kelp
#

client side oauth2 KEKW

long marsh
#

Of course, because that doesn't exist ๐Ÿ˜„

mellow kelp
#

how about specifying the port

long marsh
#

I don't have any open ports, that's the point. Do I really need to open up a port just to configure that.

umbral zealot
#

Oh! I thought you meant the discord oauth2

#

if it's patreon I have no idea

long marsh
#

Oh, sorry. Nope

umbral zealot
#

But your "issue" shouldn't be an issue

mellow kelp
#

i guess its kinda the same thing

long marsh
#

I mean, it's all the same at the ending of the day ๐Ÿ˜„

mellow kelp
#

oauth2 is oauth2

umbral zealot
#

what do you mean by "port 80 issue"?

long marsh
#

Connection refusal.

#

Which makes sense, because I don't have port 80 open lol

umbral zealot
long marsh
#

That's definitely true.

umbral zealot
#

OH! Well if oyu literally don't have any web service running, then no you can't use a callback URL

long marsh
#

OAUTH2 has different flavors

mellow kelp
#

dang

#

i overestimated the web

long marsh
#

I mean, it's not supposed too.

mellow kelp
#

of course any standard is broken at least 99% of the time

umbral zealot
long marsh
#

Yeah, I read that post.

#

Just wasn't sure if anyone here had actually configured their Discordbot with the Patreon API ๐Ÿ˜„

umbral zealot
#

Don't worry that post goes way over my head too

solemn latch
#

Samuel might have, I talked to him the other day about it.

long marsh
#

I just wish I was given an access code associated with my account, but Patreon doesn't provide that. They assume everyone wants to configure a web-facing authentication so that users can 'view' their Patreon status / your website can look up if they're a patreon.

formal vine
#

I'm fairly new to this whole coding thing, and I was able to get a bot out a couple months back. But I am yet to figure out how to get my bots guild cache, anyone able to lead me to the right direction?

mellow kelp
#

<Client>.guilds.cache

long marsh
#

OMG

#

I'm an idiot

#

They do provide an access token.

#

Nvm, forget I just said anything ๐Ÿ˜„

lusty quest
#

just beware the patreon API is Deprecated

solemn latch
#

Oh intresting

lusty quest
#

yea they stopped maintaining the api in July last year

#

well june but close enough

solemn latch
#

I wonder how they are having resource issues, I thought they are doing good money wise

lusty quest
#

they had issues to pay staff a while ago

solemn latch
#

Ah, yeah looks like they make less than I thought
500m for all their creators at on average 7% take is like what 30 million or so.

lusty quest
#

also the largest Patreon Creator deleted his Patreon Account back in December 2018 caused them to loose some money

zenith terrace
#

oof

long marsh
lusty quest
#

the url beneath the picture?

long marsh
#

Ah, my apologies.

lusty quest
#

also most API clients they offer are last updated 3-4 years ago

earnest phoenix
#

Does anyone use mongodb. I have a problem

lusty quest
#

yea

#

what is your issue?

long marsh
#

Do you guys use Atlas?

lusty quest
#

i used it before i switched to self hosted

#

bcs atlas is restrictive in some stuff

long marsh
#

What made you switch? Financial reasons?

earnest phoenix
#

I have a problem

#

While trying to connect to my database with mongodb compass. It says authantication failed.

lusty quest
#

well the features i need are aviable in atlas for 60$/Month

cerulean ingot
#

hey guys can i have some advice,

my bot just hit 100 servers and people really like it. but due to some things with my hosting provider we had to reset the database making all users lose all their coins and stuff

iโ€™m also not interested in coding the bot anymore and fixing all the bugs with it

should i continue with the bot or go on a new path?

earnest phoenix
#

Why is this happening

lusty quest
long marsh
#

Well, damn. It seems as if Patreon isn't doing so hot, haha

#

rip

lusty quest
earnest phoenix
#

mongodb+srv://<username>:<password>@cluster0.e3q6j.mongodb.net/test(Where it says username and password, my username and password are written)

lusty quest
#

looks fine

#

did you allow external connections?

#

if you use atlas you have to allow external connections

cerulean ingot
#

well it was my friends vps

#

now he stopped paying,

lusty quest
#

you can download the Database and upload it to a better host

#

well rip

#

this is then another issue

cerulean ingot
#

and i shouldโ€™ve just kept mine

earnest phoenix
lusty quest
#

does it still error out?

cerulean ingot
#

so what should i so

#

another project?

long marsh
#

Or are you removing those too?

cerulean ingot
#

ayy mongodb gang

long marsh
#

Sorry, haha. Never can be too careful ๐Ÿ˜„

#

DynamoDB gang??!?!?! Haha, nope.

earnest phoenix
lusty quest
# cerulean ingot so what should i so

well its up to you, if you want to keep the bot running maybe make an Announcement and maybe recode the bot to improve it overall. also maybe switch to an Externally Hosted Database like MongoDB Atlas

long marsh
#

Such as, as you said, MongoDB Atlas

#

Not wrong wording, possibly misleading ๐Ÿคทโ€โ™‚๏ธ

cerulean ingot
lusty quest
#

yea but some people run them local

cerulean ingot
#

switched to the atlas

long marsh
#

Ah, true.

#

Wait - you guys don't keep your bots running on your computer 24/7?

#

๐Ÿ˜„

lusty quest
#

no?

long marsh
#

I'm kidding, lol

cerulean ingot
#

uh no

#

vps

long marsh
#

Jesus, lol

#

I'm kidding

lusty quest
#

i have a NAS a RPI and a VPS

earnest phoenix
#

I've been trying to solve this error for almost 1 hour

cerulean ingot
#

maybe i should fix the current bugs, then keep the bot up and let it grow itself?

long marsh
#

I have a NAS for completely unrelated things, lol

cerulean ingot
#

well itโ€™s grown to 109 itself

long marsh
#

Mainly media / home security

cerulean ingot
#

what

lusty quest
#

i have my Lancache and Plex on the NAS

cerulean ingot
#

anyways

#

yeah i think iโ€™ll do what i sad

#

said

long marsh
#

I don't host Plex on my NAS. I strictly use it for hosting media

lusty quest
long marsh
#

Plex is running on a RPI

#

Albeit, not the best idea

lusty quest
#

rip RPI gets I/O Locked by Plex pretty easy

#

also it will get set on fire if you have to transcode 4k to 1080p

#

got myself a nice p400 for HW transcoding

long marsh
#

I only have 1080p media files, lol

earnest phoenix
#

I guess nobody knows the solution to the error

long marsh
#

Not without debugging myself, nope.

lusty quest
long marsh
lusty quest
#

would guess Turkey bcs of the name

earnest phoenix
#

what's bot id

#

i never heard it

#

uwu

long marsh
#

๐Ÿ‘€

lusty quest
#

wtf? the snowflake id for your Discord bot

long marsh
#

"What's a snowflake id"

#

Next question ๐Ÿ˜„

formal vine
#

Could someone work me through finding how my guilds my bot is in, I've gotten "client.guildsize" like 1500 times and I have no clue where to go from there

earnest phoenix
#

bot id like this? 608120740100964372 this is @long marsh id oops

formal vine
lusty quest
#

ok

earnest phoenix
#

when i copy id from bot it same like cleint id

formal vine
#

I don't need args so rn I have this, I'm not even sure if this is a start to anything

#

ignore bad formatting

#

and just bad code ingeneral lmfao

cold lagoon
#

It's a stupid question but... How do I get my bot to recognize an NSFW channel?

lusty quest
#
client.guilds.cache.size
```will show you your guilds, but it will return an array of sizes if you get shards
lusty quest
earnest phoenix
#

please tell me what's bot id

#

welp

cold lagoon
#

oH

#

thx?

earnest phoenix
#

I want to know it

lusty quest
earnest phoenix
#

how is it look like?

lusty quest
#

772803287786455040

earnest phoenix
#

oh

lunar citrus
#

Hi

lusty quest
#

this is your id, the one from your bot will lookslike this

earnest phoenix
#

oh

lunar citrus
#

How to get roles

formal vine
earnest phoenix
lusty quest
lusty quest
# earnest phoenix yes

its possible that your isp for some reason switched the IP while you whitelisted yours. or even blocks the Hoster for some reason

lusty quest
earnest phoenix
#

OK I did it. I was finally able to connect

#

@lusty quest I use copy ID option and I get this 794123427375874060 and it same as client id

lusty quest
#

well maybe its the same

earnest phoenix
#

<dbname> Will I write something in this section?

umbral zealot
#

you got the wrong bot list, buddy

earnest phoenix
#

bruh

formal vine
#

awkward

earnest phoenix
#

mhm

earnest phoenix
umbral zealot
#

you know?

earnest phoenix
#

but i just want to ask what bot id

#

huh

earnest phoenix
umbral zealot
#

I mean, ok fine about the bot ID

#

but don't ask us how to fix some other bot list's avatar

earnest phoenix
#

i just ask what bot id

#

yeah

umbral zealot
#

that's their problem not ours

formal vine
#

lmfao

earnest phoenix
#

im wronbg with that ;-;

earnest phoenix
formal vine
#

You are very sassy evie

earnest phoenix
#

its not even the same site

#

as this discord

lusty quest
earnest phoenix
#

I am sorry. :( That picture is just wrong place.\

#

D:

umbral zealot
#

No no it's really just because I'm a sassy bitch ๐Ÿ˜‚

earnest phoenix
#

๐Ÿ˜ณ

formal vine
#

lmfaoo

umbral zealot
#

I wanted to post a "wrong neighbourhood" meme but they all say MF in the end and I wanted to be sassy, but still polite.

earnest phoenix
#

mmmm

#

e

#

a

formal vine
#

sports?

earnest phoenix
#

its in the game

#

What DSL for though

#

I never use it

umbral zealot
#

The @pliant gorge bot? That's for the server list, it gets stats and data from the servers it's on to display them on top.gg/servers

umbral zealot
earnest phoenix
#

evie how did you become a bot reviewer

solemn latch
#

the applications, they closed months ago now.

earnest phoenix
#

oh

#

ok

umbral zealot
#

uhm...

#

are you sure you're on discord.js v12?

formal vine
#

I'm gonna assume no...

earnest phoenix
#

smh my head

formal vine
#

๐Ÿ˜ฉ

earnest phoenix
#

update it then

random heron
#

I have a problem, I'm doing an nsfw command everything works, I test it on my pc with visual and it works well, then I pass it to repl it and install the modules well and what happens is this, if you're on a channel no nsfw works correctly the "this is not an nsfw channel", but when it's nothing happens, and on the console does not throw error D: this is the code

formal vine
#

I was gonna just switch that section back to v11, is that illegal

random heron
#

help D:

formal vine
#

lmfaoo

earnest phoenix
#

hahahaha

formal vine
#

homie just direct your server to the hub if they gonna be that thirsty

earnest phoenix
#

good timing

#

yeah like

#

module.exports = {
name: 'hub',
description: "hub",
execute(message, args){
message.channel.send('cornhub.com');
}
}

umbral zealot
# random heron

So, your code is for the anal command but you're trying the vagina command. Which tells me that you're not looking at the correct code.

formal vine
#

lmfaoo

solemn latch
umbral zealot
#

That was a damn awkward sentence to type.

earnest phoenix
#

yeah...

formal vine
lusty quest
#

is the channel marked as nsfw?

umbral zealot
#

Ok well, your "example" is wrong because the code you showed looks fine to me

random heron
random heron
earnest phoenix
#

bruh

#

I CANT

umbral zealot
#

OH! I had it the other way around

formal vine
umbral zealot
#

I was looking at the wrong thing. alright

#

try logging err

earnest phoenix
#

The problem is the bot doesn't send the embed when the channel is marked as nsfw

earnest phoenix
umbral zealot
#

it's probably not able to send anything because there's an error

random heron
#

console doesn't throw error

lusty quest
#

there is an error

#

it needs to be async or solve the promise

earnest phoenix
#

"Project working!
StrawBerry is online :D"

formal vine
#

That's actually a super cute way to show the bot online

random heron
lusty quest
#

this doesnt run the API Call async

random heron
#

how i can solve it?

formal vine
lusty quest
#

learn about Async code and Promises

formal vine
#

sorry idk why I @ 'd

earnest phoenix
formal vine
#

all g, thanks!

random heron
#

I tried it on my pc with visual and everything worked properly, but I got it back to repl and nothing

solemn latch
lusty quest
#

did you have all the packages installed on the server

random heron
#

i have all

solemn latch
#

oh no your code is v12

#

sorry im tired lol

earnest phoenix
#

bruh

#

M

earnest phoenix
solemn latch
#

nah, 2 more hours leggo ๐Ÿ˜„

earnest phoenix
#

You must rest

#

2114_die go to bed or else...

solemn latch
#

in a call pandasad

earnest phoenix
solemn latch
#

surfing in csgo, reading development. totally paying attention

lusty quest
#

online school?

earnest phoenix
#

yeah sure

solemn latch
#

nah another discord server

lusty quest
#

some guy wrote a bot that attends for him in Online Classes,

solemn latch
#

oo

earnest phoenix
#

nice

lusty quest
#

like the bot knows his schedule and automatic joins the Microsoft Teams channel and mutes himself

#

when the lession ends the bot leaves the channel

earnest phoenix
#

Lol

lusty quest
#

well he found the 2020 Solution for a 2020 problem

earnest phoenix
formal vine
#

is this accurate or is it just shooting out a number

lusty quest
#

it is accurate

#

unless you shard

#

also it only gets updated if you restart the bot

formal vine
#

I don't need a constantly accurate number, just a general sense of where I'm at tbh

#

Thanks โค๏ธ

pale vessel
#

That looks like v11 code

lusty quest
#

yea

solemn latch
#

no idea whats going on, aparently he has v12 installed, he even gave a specific number ๐Ÿคทโ€โ™‚๏ธ

long marsh
#

It may have the old version installed ๐Ÿ‘€

slim void
#
@client.event
async def on_message(message):
    if message.author == client.user:
      return
    
    await client.delete_message(message)```
#

I've never really messed with deleting messages like this before.

#

But how would I delete any message sent from anyone, anywhere? Just trying to do something.

#

it says "no defined"

earnest phoenix
#

take a guess

slim void
#

Client not deined?

#

Did I write it wrong?

earnest phoenix
#

that's not what the error says

#

where did you find that code

slim void
#

docs

earnest phoenix
#

๐Ÿค”

slim void
#

Did they change it?

#

I just recently got back into .py

#

I've been doing js

formal vine
slim void
earnest phoenix
slim void
#

oh

#

I'm doing async

earnest phoenix
#

you couldve searched this yourself

slim void
#

I forgot rewrite came out

earnest phoenix
#

oh

slim void
#

๐ŸŒด

#

๐Ÿ˜‚

#

So it looks like in rewrite

#

they use message.delete()

formal vine
slim void
#

Wait

lusty quest
#

this is node.js not discord.js

slim void
lusty quest
#

check your packages.json

slim void
#

@earnest phoenix

eternal osprey
#

hey

eternal osprey
#

how do i transform a given channel id to channel ping?

slim void
#

uh

eternal osprey
#

like #35239582952 > #channel1

slim void
#

<#channelid>

eternal osprey
#

ty

earnest phoenix
#

@slim void no clue i dont use dpy, just picked this up from the docs

slim void
#

ah

lusty quest
#

discord.js parses channel objects to mentions

slim void
#

How do you fetch the channel id in py

formal vine
#

lmfao yea 11.5.1 in package.js, whats the difference between the bot.js and the package.js (in regards to the version it says its running)

lusty quest
#

bot.js is your code. package.json is what packages are installed with npm

#

run npm update or npm i discord.js

#

but beware d.js v12 got a lot of breaking changes

slim void
#

How do you get a channel id in python is it get.channel_id

formal vine
lusty quest
#

there is more stuff that got changed.

formal vine
lusty quest
#

there is a list of breaking changes

formal vine
#

I'm not seeing anything related to msg.content and that is literally what the other 4 commands consist of

#

along with var answers

#

I'll install tmrw and fix whatever messes up

lusty quest
#

var is bad, also deprecated, its still there to keep older code working

#

use cont or let instead. const is not mutable while let is mutable

formal vine
#

I made this thing a year ago with no previous knowledge ๐Ÿ˜ณi bet that is evident

lusty quest
#

var is for quite long deprecated

marble juniper
#

its from es5

#

which is from 2009

formal vine
#

I think im a tad bit behind then

marble juniper
#

mmmm juuuuust a bit

#

stop living in es5

formal vine
#

Im assuming that was the best tutorial I could find ๐Ÿ˜ญ

marble juniper
#

let me guess