#development

1 messages · Page 687 of 1

topaz sphinx
#

that i can understand

inner jewel
#

and it gets worse the more code you have

topaz sphinx
#

doesnt everyone have an API ?

earnest phoenix
#

alright, thank you

amber fractal
#

what?

topaz sphinx
#

or create one

#

its not that hard to make an api smh

amber fractal
#

an api for what

quartz kindle
#

im rewriting my entire bot to work with pm2 clusters

topaz sphinx
#

for datastorage

#

and content sharing

inner jewel
#

i just run everything in a single process

topaz sphinx
#

i mean i got myself my own CDN and my own API

inner jewel
#

although the libraries i use can handle that

topaz sphinx
#

i see

#

i thought of doing clusters

#

one core one shard

inner jewel
#

i've done some message queue based stuff in the past but it was too much effort for too little benefit

#

M gateway process(es) send payloads to a queue, where N workers process them (with N possibly different from M)

topaz sphinx
#

that different to the python lib im using

#

or wait

#

does discord handle the sharding

#

i mean not splitting it

#

but i mean if i have lets say

#

shard 1 and shard 2

#

will discord handle it out

inner jewel
#

discord assigns guilds to shards

#

based on a formula

topaz sphinx
#

alright perfect

inner jewel
#

you send total shard count and shard id

topaz sphinx
#

thats what i need

#

yeah shard count is easy to fix

inner jewel
#

which is what makes scaling bots a fucking pain in the ass

topaz sphinx
#

not at all

inner jewel
#

it is

#

you can't just add more shards

topaz sphinx
#

i can easily automate the sharding

inner jewel
#

you need to restart everything to add more shards

topaz sphinx
#

if i put in the sharding information into an SQL database

quartz kindle
#

you need to restart all shards to increase

topaz sphinx
#

with TTL at 1 hour each

#

and 30 min refresh interval

inner jewel
#

and you need to track a ton of state on your end

topaz sphinx
#

state?

inner jewel
#

instead of eg "add one more worker to handle the increased load, then when it drops kill it"

#

the cache, the ws connection, ...

topaz sphinx
#

hmmhmm

#

i'll read more about this in the docs

inner jewel
#

and killing the ws connection kills all voice connections for that shard

#

even if you resume the ws

topaz sphinx
#

yeah i see

quartz kindle
#

what if you reboot shards sequentially with a different value? there is a risk of guilds overlapping, or will discord disconnect your other shards?

inner jewel
#

not sure

#

i think discord kills the others

quartz kindle
#

could make a test, if you increase the shards by a multiple that keeps the same guilds to the same shards

#

then reboot them one by one

#

idk if its possible with the formula tho

topaz sphinx
quartz kindle
#

it exists in most libs

inner jewel
#

that just fetches the shard count from discord

#

and starts that many connections

topaz sphinx
#

the guild count or the shard count

inner jewel
#

keeps the same guilds to the same shards
not possible

#

formula is shard_id = (guild_id >> 22) % shard_count

#

shard count

#

you can fetch the recommended shard count from /gateway/bot

topaz sphinx
#

what is ">>"

#

also the code i currently have doesnt care about what shard the user is in

#

shard 2 shard 9 it can switch whenever it wants

#

it doesnt matter

#

all the datastorage is handled in my webserver

inner jewel
#

right shift

topaz sphinx
#

ah alright

lusty dew
#

I legit forgot what I was doing

#

Oh yea sequelize oof

topaz sphinx
#

@inner jewel however if i were to add a voice chat that'd be a trouble

#

which i wont, cause currently my bot is very very dedicated to be good at one thing

lusty dew
#

My bot was dedicated to two things when I reached that and felt like it was good enough I branched out.

earnest phoenix
#

How i can make command without prefix and index.js AwooThink i can't defined 'args'

lusty dew
#

Uhm make command without prefix?

earnest phoenix
#

yep

lusty dew
#

Well if you don’t wanna use a prefix just check if message.content === theWord

earnest phoenix
#

args?

lusty dew
#

You don’t need args in this situation iirc

earnest phoenix
#

But i need!

brave anvil
#

Wha~?

lusty dew
#

Uhm okay.

#

I don’t know.

brave anvil
#

I’m confused

lusty dew
#

They are asking how to make a command without a prefix

#

I just told em

brave anvil
#

Oh

#

Yeah

#

Thats The Correct Way He Said

quartz kindle
#

@earnest phoenix whats your code?

brave anvil
#

Although I wouldn’t recommend doing that

lusty dew
#

message.content will get the content of the message they sent and if the content matches the word you’re checking then the command will work.

#

Same but I just answered their question

brave anvil
#

Cause someone Can Just spam the word

lusty dew
#

Eh

#

Not my reason why

inner jewel
#

someone could also just spam a normal command

brave anvil
#

But its also annoying

inner jewel
#

having a prefix or not doesn't make it less spammable

brave anvil
#

Ik

lusty dew
#

Someone who lines splits

#

Like

brave anvil
#

I’m not stupid

lusty dew
#

This can set it off

brave anvil
#

Yeah

#

Exactly

earnest phoenix
#

@quartz kindle 8ball command;


let message = msg;
 
    let cevaps = [
      'Kesinlikle Hayır',
      'Aynen',
      'Olamaz! Bu Imkansız!',
      'Öyle Düşünmüyorum',
      'Kesinlikle Evet',
      'Ne Desem Bilemedim',
      'Bilmiyorum',
      'Emin Değilim',
      'Kararsız Kaldım'     
      ];
    
  let min = 0
   let max = cevaps.length - 1;
let messageArray = message.content.split(" ");
    let command = messageArray[0];
    let args = messageArray.slice(1);
let ques = message.content.split(" ").slice(1).join(" ");
    if (!ques) return msg.channel.send('question.');
  let r = cevaps[Math.floor(Math.random() * cevaps.length)]
 msg.channel.send(r).catch()
  

});```
lusty dew
#

If the word they said matched the one set

brave anvil
#

Damn

#

Oh

#

Ehhe

lusty dew
#

That’s not even gonna work the way you have it

brave anvil
#

Yeah

#

Here

quartz kindle
#

@earnest phoenix if(message.startsWith("8ball"))

inner jewel
#

it'll keep spamming

brave anvil
#

Yeah

lusty dew
#

Why define it as msg if you’re just gonna use message

inner jewel
#

it has an ~80% chance of triggering itself

#

so it's chance of spamming the channel for a long time is high

quartz kindle
#

only 80%?

lusty dew
#

Kek

#

I have a question about sequelize.

inner jewel
#

7/9

#

actually

#

nvm

lusty dew
#

So if I use the unique thing in one of my tables

inner jewel
#

it'll spam forever

brave anvil
#

Hmm

inner jewel
#

if (!ques) return msg.channel.send('question.');
"question." triggers that if

#

so it'll keep triggering itself

lusty dew
#

And I set the unique for ID and guild ID

#

Wait nvm

#

Answered my own question in my head

earnest phoenix
#

Not work.

brave anvil
#

Itrying to make a command for a single guild?

lusty dew
#

?

earnest phoenix
#

Ex: 8ball <ques> not working only 8ball single working..

lusty dew
#

No

brave anvil
#

?

lusty dew
#

No spoon feeding

brave anvil
#

Oh sorry

#

I forgot

lusty dew
#

They won’t learn by just copying code.

brave anvil
#

First you need to have your replies

#

Of course

earnest phoenix
#

@lusty dew

lusty dew
#

What?

#

Why the random ping

brave anvil
#

Yea

#

I uhhhhhhhhh

earnest phoenix
#

Not random pinging

brave anvil
#

Yes

potent ivy
#

that code hurts my eyes

lusty dew
#

Lol

brave anvil
#

Heh

earnest phoenix
#

then help me

lusty dew
#

Same

earnest phoenix
brave anvil
#

Were trying

lusty dew
#

We are trying

brave anvil
#

Lol

earnest phoenix
#

belli

lusty dew
#

You’re not listening

earnest phoenix
#

sure?

lusty dew
#

Plus not even completely sure what you wanna do

brave anvil
#

First of all the code you have omg

#

Jk

earnest phoenix
#

then why I have 2 k servers?

brave anvil
#

...

#

Lemme check

lusty dew
#

Okay I’m not gonna help you with that attitude

#

If you have 2k servers figure the problem out yourself.

earnest phoenix
#

I'm, not wanting your helps. Thanks...

slender thistle
#

No fighting here ty

lusty dew
#

I’m not fighting :)

#

Just trying to help someone who won’t listen

#

Btw Shivaco I have a question

earnest phoenix
#

Seriously?

slender thistle
#

Ask your questions right away without the "I have a question" kind of thing please

lusty dew
slender thistle
#

ID

potent ivy
#
client.on("message", async (msg) => {

  if (msg.content == "8ball"){
    let stuff = [ 'a', 'b', 'c', 'd' ]
    let randomIndex = Math.floor(Math.random() * (stuff.length + 1))

    msg.channel.send(stuff[randomIndex])
  }
})```

not sure whats more to a simple command without a prefix that returns a random list element?
lusty dew
earnest phoenix
#

Hiname is right

#

:d

#

not working

potent ivy
#

well, what library are you using again? d.js?

earnest phoenix
#

If Hiname says it's true 😄

#

d js yes

#

What is the event ?

brave anvil
#

Hmm

slender thistle
#

No spoonfeeding here ty

potent ivy
#

i dont know what methods d.js has but theres no reason this code wouldnt work

#

¯_(ツ)_/¯

lusty dew
#

561619932442394627 Here is the ID:

#

That pasted in so wrong

#

Lmao

earnest phoenix
#

@potent ivy working but when I typing 8ball <text> not working i mentioning this.

potent ivy
#

then dont compare the content of the message to the string but rather check if it starts with that string

#

string.startsWith("")

earnest phoenix
#

@earnest phoenix Who did you name it?

#

@earnest phoenix

#

string ?

#

can you give me example command

#

@earnest phoenix

lusty dew
#

Couldn you just do:

let stuff = ['m', 'l', 'h']
let randomIndex = stuff[Math.floor(Math.random() * stuff.length)]

message.channel.send(randomIndex)
earnest phoenix
slender thistle
#

no spoonfeeding

lusty dew
#

No I was asking

#

Lol

earnest phoenix
potent ivy
#

@lusty dew i mean that wouldnt be a random index bur a random element, but yeah sure

lusty dew
#

Wasn’t giving them anything intentionally

potent ivy
#

not exactly an improvement though

late hill
#

Do you have a decent understanding of the library you're using

lusty dew
#

It’d get a random string from the array

potent ivy
#

yeah to a variable called random index

#

lul

lusty dew
#

Yea

#

Kek

earnest phoenix
#

Keep Calm Aq

lusty dew
#

But at least it’d still output the string :)

#

Not much of an improvement no

late hill
#

Research:
Math.random()
String#split
String#startsWith

#

You can solve your issue using those resources

lusty dew
#

Who me?

earnest phoenix
#

İ did'nt understeand,so thanks...

late hill
#

No not you

#

._.

lusty dew
#

Ah mk

#

Lol

earnest phoenix
#

"Ah mk"

#

no swearing

lusty dew
#

?

#

Huh

slender thistle
#

Can you not

#

@earnest phoenix you too

lusty dew
#

I’m confused

#

What did I say wrong

#

😂

slender thistle
#

There's a moderator here to watch the chat, no need for minimodding

earnest phoenix
#

"mk" word turkish in swear

#

ok.d

#

oke

lusty dew
#

I have never gotten in trouble for swearing

earnest phoenix
#

huh , right.

lusty dew
#

Is it against the rule Shivaco

slender thistle
#

Back to the issue maybe????

earnest phoenix
#

The exact opposite :)

lusty dew
#

The issue has been resolved by the looks of it

slender thistle
#

So why is this channel used for off-topic crap then

lusty dew
#

I’m wondering the same thing

#

I was about to ask a question though

slender thistle
#

ily ask2ask

covert turtleBOT
#

Dont ask to ask
Just ask your question
it wastes time if you say "i need help" or "can someone help me?" instead of just saying what the problem is. Save your time and other people's time and just ask the question.

lusty dew
#

Ik...

#

I said I was about to..

#

But I think I figured out the answer

#

Thanks!

tall osprey
#

i bought the discord bot maker but idk how to use it. can someone help me?

potent ivy
#

discord bot maker isnt really how you make discord bots

earnest phoenix
#

it can be

tall osprey
#

wdym

earnest phoenix
#

go to dbm support

tall osprey
#

k

lusty dew
#

How can I make my economy system global?

#

How can I make my economy system global?

potent ivy
#

do you have it working per guild already?

lusty dew
#

I’ve thought about making the ID the db uses the userID but idk if that makes it global

#

I have it per guild in my old db

#

But I, rewriting it again

potent ivy
#

just make another table for global exp?

#

imagine its another server

#

dunno how exactly your structure looks like rn but yeah

lusty dew
#

I’m using sequelize

potent ivy
#

well uh, i assume you dont want to scrap your data, so you want to keep the currently gained "ecenomy" thingy whatever it is

#

that makes it a little harder since you cant just make a new fresh table and call it a day

lusty dew
#

Basically just:

module.exports.Economy = sequelize.define('eco', {
   id: {
      type: sequelize.TEXT,
      allowNull: false,
      unique: true
   }
})
#

That’s how the id would look

#

Oh the economy functions aren’t even out to public yet

#

So idc about scraping all the data from it and making a new table

#

I used better-sqlite3 for the old db

golden bone
#

Speaking of better sqlite3, is there a plugin to have direct array support?

sick comet
mossy vine
#

and what are the errors?

sick comet
#

when i try to boot it manully i get this

/app/events/Satellaplay.js:21
      "value": "This Service is only in the US."
      ^^^^^^^

SyntaxError: Unexpected string
    at Module._compile (internal/modules/cjs/loader.js:723:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/app/bot.js:10:21)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)```
lusty dew
#

@golden bone better-sqlite3 doesn’t support arrays

golden bone
#

im aware but sqlite supports 3rd party modules

#

like the json support module

lusty dew
#

Oh idk then

mossy vine
#

@sick comet you forgot a comma on line 20

sick comet
#

oh

tall osprey
#

i still dont get how to use dbm

slender thistle
#

Tried asking in DBM support server yet

tall osprey
#

wdym

slender thistle
#

I thought DBM had a support server?

tall osprey
#

they do?

slender thistle
#

So why not ask there

tall osprey
#

can you send me an invite or smth?

slender thistle
#

Look around the app's About or use Google

tall osprey
#

ok

onyx summit
#

took me 3 seconds

topaz sphinx
#

@golden bone i suggest you using json dumps

#

cause sqlite3 doesnt have native json support

#

neither list

amber fractal
#

I wouldnt use json as a db if that's what you're talking about

onyx summit
#

why not mmm

lusty dew
#

Oh but Json databases are the best

brave anvil
#

I need help

#

Making a command for me to be able to change the status of my bot

onyx summit
#

json is not bad if you do it right. it has the same limitations as sqlite

earnest phoenix
#

no

brave anvil
#

Why did you send a serverinvite to the worst bot making software

onyx summit
#

because he asked for it you smartass
can you send me an invite or smth?

earnest phoenix
#

json lacks in data types and has huge space for syntax errors

brave anvil
#

Ok an

#

You could have dmed it

onyx summit
#

idc

brave anvil
#

But what ever

lusty dew
#

Oof

brave anvil
#

?

onyx summit
#

@earnest phoenix obviously, I never claimed its better than sqlite, but its not that bad like people think it is (because all the noobs use it wrong)

lusty dew
#

I think I was just banned from DBM 😂

brave anvil
#

Idk

onyx summit
#

so what do you need help with?

brave anvil
#

But I dont like dbm

onyx summit
#

I don't either, but I got him out of this channel by passing him to dbm

brave anvil
#

My opinion

lusty dew
#

Kek, I got banned for saying anyone who uses DBM aren’t real developers

brave anvil
#

But i need help making a command

#

For changing my bots status?

onyx summit
#

but something specific? thonkhappy

lusty dew
#

Read the docs?

brave anvil
#

????????

lusty dew
#

Read the docs of your language

brave anvil
#

FINE

lusty dew
#

I mean...status will be on it especially a way to change it

onyx summit
#

u do client.user.setStatus('sumStatus')
Use a switch and args if you want to configure it

brave anvil
#

Ik

lusty dew
#

Then why you asking for help

brave anvil
#

How to set status

#

But not using a command

lusty dew
#

...

onyx summit
#

wdym

lusty dew
#

He just told you

brave anvil
#

Shudup

zealous veldt
#

Keep things civil

brave anvil
#

XD

onyx summit
lusty dew
#

client.user.setStatus will set the status to whatever you want ?

brave anvil
#

Ik

#

But using a command

lusty dew
#

Then what is your problem

brave anvil
#

USING A COMMAND

lusty dew
#

Put it in a command?

brave anvil
#

With Args

lusty dew
#

What’s hard about that

zealous veldt
#

Keep. Things. Civil.

lusty dew
#

Then use args

brave anvil
#

Everything

lusty dew
#

I’m not gonna just give you the code.

brave anvil
#

Ik

#

I dont want it

lusty dew
#

Okay so

potent ivy
#

With Args

dont you hate when it happens? people copypasting some code from internet without understanding it D:

lusty dew
#

To get something from a message you sent use args

onyx summit
lusty dew
#

^

#

I was about to explain it

#

lol but that works

brave anvil
#

Stop Ik I’m a furry but jeebus

lusty dew
#

setUwuStatus

#

Lmao

brave anvil
#

Lmfao

potent ivy
#

you can either join args with a whitespace or not use them in the first place and just slice/substring/replace(cmd )

zealous veldt
#

/ +/g

onyx summit
#

first element of args should be enough because a status is one word

lusty dew
#

Yea online, offline, idle, dnd

#

Look I’m smart

#

Kek

potent ivy
#

i assumed he meant game name tbh

lusty dew
#

Status and game is different no?

slender thistle
#

That'd be presence

potent ivy
#

yeah its different

brave anvil
#

Im reading

lusty dew
#

Have we even asked if he uses d.js

potent ivy
#

i wouldnt be surprised if thats what hes after though anyways

#

lol

lusty dew
#

Yea same

brave anvil
#

Yes

#

I use djs

onyx summit
#

he is using d.js, I remember from last time

#

big brain time \s

brave anvil
#

The common

lusty dew
#

I don’t that’s why I’m asking 😂

brave anvil
#

Less things in common

lusty dew
#

Hey CHY4E wanna be Minecraft bros

#

Jk

brave anvil
#

...

lusty dew
#

Anyway time for an actual question 😂

brave anvil
#

Whats a snowflake?

onyx summit
#

basically an id

#

user ids are snowflakes

lusty dew
#

A userID is a snowflake

brave anvil
#

Uhhh...

#

Like 618179818516905984

lusty dew
#

533087906714091520

brave anvil
#

Hehe

lusty dew
#

That’s your ID

brave anvil
#

Or message ids

#

?

lusty dew
#

And I think that’s a server ID

#

Or message

brave anvil
#

Yes

#

Message

lusty dew
#

IDs are snowflakes

brave anvil
#

I have an id

#

Irl

#

Hehe

lusty dew
#

So it can be a message id, server id or user id

brave anvil
#

God discord is so smart 😊

slender thistle
#

Message, server, channel, user or client ID

potent ivy
#

they are called snowflakes because they have some special properties like date extraction, also javascript likes them as strings

brave anvil
#

You can make a bot be

online
idle
offline
dnd

potent ivy
#

and streaming, but thats a part of a different method

onyx summit
#

ye

brave anvil
#

Like my bot @unborn mulch

#

Hes dnd

lusty dew
#

I don’t think you can make a bot go offline at least I’ve never been able to do it

brave anvil
#

I have

potent ivy
#

pull the plug

brave anvil
#

Yes its possible

lusty dew
#

Lol

#

Pull the plug and never bring it back online

brave anvil
#

Hehe

lusty dew
#

I keep forgetting what I’m doing

#

Smh

brave anvil
#

Does Discord automatically shard your stuff tho?

onyx summit
#

no lol

brave anvil
#

Theres a method of autosharding or something

lusty dew
#

Uhm no

brave anvil
#

?

#

Uhhhh

lusty dew
#

Discord doesn’t automatically shard for you

onyx summit
#

d.js master can do internal sharding, so you don't notice/have to care

brave anvil
#

Yes

lusty dew
#

Lmao

brave anvil
#

I use d.js master

onyx summit
#

but if you have really large bots you should use internal sharding

brave anvil
#

Hehe

onyx summit
#

you still have to tell d.js it shouls shard

potent ivy
#

i like how you just went into sharding your bot right after asking how to set up your status
are you sure you know what sharding is? and are you sure you need it?

brave anvil
#

So incode sharding

#

Idk Just asking so Ik more about it

onyx summit
#

npo, d.js old sharding way: start x new processes connecting to the master
new way (internal) start new websocket connections

brave anvil
#

Its basically spawing more node.js clients?

onyx summit
#

the old way was spawning more node.js processes

brave anvil
#

For easier processes

lusty dew
#

I just have in the Discord.Client({
shardCount: 'auto'
})

onyx summit
#

very simple

lusty dew
#

Uhm

brave anvil
#

Lol

lusty dew
#

Pls no

#

😂

brave anvil
#

?

onyx summit
#

no it will shut my server down, lol, not doing that

brave anvil
#

Lol

lusty dew
#

Also is there anyway you can block my old dev from accessing the server?

potent ivy
#

just make the bot go invis

onyx summit
#

change pass

lusty dew
#

He kinda just left

#

I forgot how to change pass again

#

Lmao

onyx summit
#

passwd

brave anvil
#

Hmm

lusty dew
#

Isn’t it passwd

#

Ah mk

brave anvil
#

I use RethinkDB

#

Btw

onyx summit
#

its cool, yeah

brave anvil
#

XD

onyx summit
#

I mainly used it for session storage, I killed that project tho

brave anvil
#

I had to write my own command handler

#

I decided to

onyx summit
#

and?

brave anvil
#

It works

#

Thats what husky uses

onyx summit
#

not trying to be rude, but its not magic if you ever saw a command handler before

brave anvil
#

Hehe

#

Ik

onyx summit
#

write a command handler that uses classes

#

even better, a commandhandler using an abstract class in typescript mm

brave anvil
#

It has errors.js

#

And Everything But Not gonna go into that

valid frigate
#

typescript is epic

brave anvil
#

No

lusty dew
#

I wanna rewrite my command handler but I don’t know what I’d rewrite it to

#

Kek

valid frigate
#

like

#

eerything is structured

earnest phoenix
#

typescript is my wet dream

brave anvil
#

...

#

What!!!!!!???

onyx summit
#

everything is save, you don't have to guess if its the property or not

lusty dew
#

Uhm okay

valid frigate
#

it's 𝓫𝓮𝓪𝓾𝓽𝓲𝓯𝓾𝓵

earnest phoenix
#

OOP is amazing

onyx summit
#

everything is oop

valid frigate
#

i started understanding oop when i started using ts which is odd

lusty dew
#

typescript is my wet dream

onyx summit
#

yeah js is not very oop

valid frigate
#

and i oop

earnest phoenix
#

anna ou sksksksksk sis TEA PERIODT

onyx summit
#

tbh, I couldnt think to use angular without typescript, it would be awful

quartz kindle
#

im making a weird ass lib which has a built in command handler that uses djs events as command routes

#

lmfao

onyx summit
lusty dew
#

I’m making a useless bot that probably won’t get anymore then 30 servers

onyx summit
lusty dew
#

Lol

onyx summit
#

just noticed I don't need that if anymore

#

yeet, out with you

earnest phoenix
#

lock the user from using your command unless they use oauth2 to authorize your bot to have access to the user's email, guilds, location, IP & social security number

brave anvil
#

Hmm

lusty dew
#

Oof

#

Time to steal someone’s identity

zealous veldt
#

@onyx summit what theme is that?

#

also props for using fira code PES_FingerGuns

onyx summit
valid frigate
#

yo

#

webstorm looks ok now ngl

onyx summit
#

Palenight Theme @zealous veldt

zealous veldt
#

ah

#

thank

onyx summit
#

reported for ads \s

brave anvil
#

How would I write a cooldown for a command?

onyx summit
#

uhh, persistent over restarts, or in memory?

#

good that you mention it, I need it too

brave anvil
#

Hehe

#

I’m tired of commands being spammed

lusty dew
#

I’m making like 4 different tables with sequelize

#

Kek

#

Guild, User, Economy, and Promo

earnest phoenix
#

honestly you should always go for in memory unless the command has this gigantic cooldown and is really heavy on resources

onyx summit
#

I have to write an api at work that has like 15 tables mm

lusty dew
#

Big oof

brave anvil
#

Hmm

onyx summit
#

and they all had relations to each another

lusty dew
#

What does the api do

brave anvil
#

How do you write an api

lusty dew
#

With code

onyx summit
#

I currently do it with loopback 4

brave anvil
#

@lusty dew smartass

lusty dew
#

What does the API even do?

onyx summit
#

its for tracking time, vacations, projects, tasks, kitchenduty

#

just company internal stuff

lusty dew
#

Kitchen duty

onyx summit
#

yeah

#

we have that

brave anvil
#

XD

lusty dew
#

Got some chefs up in there

brave anvil
#

Discord

#

They have catering

#

For employees ohhhhh yeha

onyx summit
#

our company isnt that big

#

so no

lusty dew
#

Where is discord’s headquarters

brave anvil
#

In California

lusty dew
#

I knew it was on the west coast

brave anvil
#

San Francisco

onyx summit
#

for a that large company they have a very bad developing mechanism

harsh nova
#

very slow

onyx summit
#

very bad

brave anvil
#

Discord?

lusty dew
#

Okay well when I searched up Discord headquarters I got the police department

harsh nova
#

heRe ComES sERvER foLDERs... 3 years after betterdiscord

#

wack

brave anvil
#

You have to think

onyx summit
#

they allow major bugs to come into production

valid frigate
#

lol i live like an hour from discord hq

onyx summit
#

(like the fuckup with code blocks)
how can that get into prod?

brave anvil
#

You have to think discord is understaffed rn

earnest phoenix
#

discord is mostly amateur developers that'd rather spend their time in fursuits than doing their job

brave anvil
#

@earnest phoenix offensive

onyx summit
#

but true

brave anvil
#

Ehhh

lusty dew
#

Why dis the program you’re using

brave anvil
#

Kinda True Depends

harsh nova
#

so i digged a bit in the asar to kill time and some of the TODO's are funny

onyx summit
#

if you need to kill time help me finish my bot \s

lusty dew
#

Better air horn?

harsh nova
#

I am not good at code

onyx summit
harsh nova
#

discord should really add github integration

onyx summit
#

also true

harsh nova
#

but no need asking them for it since they would just redirect to their "feedback forum"

lusty dew
#

CHY4E let’s make an api that uses 20 tables

quartz kindle
#

discord should host out bots in their servers

harsh nova
#

that has always worked and brought so many new things

quartz kindle
#

0 ping

lusty dew
#

Kek

quartz kindle
#

huehuehue

lusty dew
#

Lmao

onyx summit
#

@lusty dew but with what

lusty dew
#

They could probably afford it

#

They make enough money off of us

harsh nova
#

haha yee, i thought that was how it worked when i was much younger 1 year ago

onyx summit
#

nah, they are mostly amateurs

harsh nova
#

ddg searched "how to have discord bot online without command promt" a few times

lusty dew
#

Oof

onyx summit
#

someone on d.js asked if he can compile his bot, so he won't have to run his pc

harsh nova
#

comile

earnest phoenix
#

you'd be surprised by how many kids search that

harsh nova
#

lel

onyx summit
#

I thought that too, for like 10 mins, then I got it

lusty dew
#

I just searched up how to put my bot online

onyx summit
#

but I learned very basic coding in school before

lusty dew
#

And found out it was just none mainFile.js

#

Node*

harsh nova
#

I would like to formaly apologise for all my bad questins i pestered d.js discord server with for my first 3 months

earnest phoenix
#

my old school offered almost to no programming classes

#

so im mostly self taught

onyx summit
#

@harsh nova yeah same, I literally had a fight with evie because I didnt understand enmap lmao

lusty dew
#

My Highschool has a robotics class but it’s all drag and drop

harsh nova
#

ah

#

github dev pack is really epic, get it if you can

lusty dew
#

I’m trying

harsh nova
#

you dont need a .edu mail

lusty dew
#

Don’t think they will accept me though

onyx summit
#

@earnest phoenix my old school didnt (and still doesnt) offer programming classes. I only learned it in a school that was specially dedicated for it (and is pretty much the largest and only tech school in the area)

lusty dew
#

I’d have to drive a bit of ways to get to a tech related school

#

At least a good one

#

We have some pretty crappy ones around me

harsh nova
#

I just put my mail and it said "<where i live> Municipality", i was accepted almost directly

#

very epic

onyx summit
#

my class was for losers who didnt got a job and are interested in computers

#

and 12 out of 30 people actually got their "degree"
15 people quitted after one year cuzz they did big zucc in programming

lusty dew
#

Lol

#

GitHub still hasn’t responded to my request for the student dev pack

onyx summit
#

took like 4 days for me

#

or smth

harsh nova
#

bootstrap studio was good

#

css is not

quartz kindle
#

counter strike source?

onyx summit
amber fractal
#

wait

#

is that ts?

lusty dew
#

How would I define a percentage in sequelize?

#

Just sequelize.SMALLINT?

#

Or smth

earnest phoenix
#

do it how you would do it in maths

#

you can express it either as a float (100% = 1, 50% = 0.5) or without the percentage symbol, as a number (100% = 100, 50% = 50)

lusty dew
#

Okay

#

So basically a SMALLINT

lusty dew
#

Is that supposed to be grey

earnest phoenix
#

yes

#

it's a nested switch that'll never get hit

lusty dew
#

Oof

#

Wait why is it nested tf

earnest phoenix
#

because it's inside of the first switch

#

for the first arg

lusty dew
#

I don’t think it’s supposed to be nested

earnest phoenix
#

i don't know, you tell me

lusty dew
#

I can’t remember what I was doing

#

Lol

#

Nah it’s not supposed to be nested

earnest phoenix
#

you probably want to switch inside of log_toggle case

lusty dew
#

Wdym?

#

Can’t I just move that switch to the bottom of the first switch

earnest phoenix
#

that is not how switch case works

lusty dew
#

And outside of the first switch

earnest phoenix
#

that is not how switch case works

lusty dew
#

Okay...

#

I don’t fully understand how they work.

#

I read MDN but it didn’t really explain that much other then stuff about forgetting a break, multi-chaining cases, etc

topaz sphinx
#

return is basically break

#

but the issue is that the switch case is nested

#

that's not allowed

lusty dew
#

👀

topaz sphinx
#

no wait now i see

#

you gotta make a case

#

before ur switch

#

case smth
switch

#

your indent says the switch is in a "case only" statement, that's not allowed

inner jewel
#

indentation doesn't matter

topaz sphinx
#

it doesnt matter

#

but in that code it shows how he made it

inner jewel
#

the switch is dead code because there's a return right before it

topaz sphinx
#

yes

#

dam u explained it better thanks

lusty dew
#

So removing the return will make it work?

topaz sphinx
#

do you need the return

#

no better question

#

do you know what you're doing?

lusty dew
#

I don’t use switch statements much so no

topaz sphinx
#

case (smth) is basically (if statement then)

inner jewel
#

we don't know what you want to do

#

so we can't tell you what to change to fix

topaz sphinx
#

mhm

inner jewel
#

and you can think of a switch as a bunch of if-elses

lusty dew
#

I’m trying to fix my settings cmd lol

#

I came across that as I was changing out the db stuff

inner jewel
#

and no one can help you if you don't say what's broken

lusty dew
#

Idk what’s broken yet I just saw it was grey

topaz sphinx
#

its grey

lusty dew
#

I’ll have to test it

topaz sphinx
#

cause it will not run

#

cause you returned it

#

before

inner jewel
#

as far as validity goes, that's perfectly valid code

lusty dew
#

That’s already been stated thank you

inner jewel
#

your editor is just warning you that the switch does nothing

topaz sphinx
#

return is same as break, so it stops

lusty dew
#

Okay thanks Nathan

topaz sphinx
#

you have to use a case (smth) before you create another switch statement

lusty dew
#

Natan*

topaz sphinx
#

alternative use closing brackets

#

for the return

lusty dew
#

Correct?

abstract crow
#

What do you guys think of making a mobile app in unity for Android? Still worth it in late 2019?

night fiber
#

when will my bot get verified

abstract crow
#

yeet faq

zealous veldt
#

@idle mountain @abstract crow has a unity question

warm marsh
#

In java is there any other way for filtering an array other than using .stream?

inner jewel
#

manually filtering

warm marsh
#

With a for loop?

inner jewel
#

yes

#

the easiest way is a stream

warm marsh
#

Yeah I kinda figured I was just maybe wondering if there was a better way.

#

Thanks!

brave elm
#

Runs node.js and visual studio c++ so it's perfect and cheap to just have on 24/7

#

Cheaper than a server vps btw. £15 for the pc total not monthly

west spoke
#

um

#

most vps are under £15/m

idle mountain
#

@abstract crow yes

lusty dew
#

I don’t understand this. The DataTypes is correct

#

I checked the docs to be sure

inner jewel
#

65w server (so 0.065 kWh/hour) x 24 x 30 = 46 kWh/month

#

which is most likely more expensive than a vps

#

@brave elm

lusty dew
brave anvil
#

I have a question about making a json file coin system?

#

Any reasources

#

?

lusty dew
#

Don’t use a Json as a db

brave anvil
#

...

#

Its something I wanna test

lusty dew
#

It’s something that will corrupt

brave anvil
#

And I really dont wanna code an entire thing for a RethinkDB

lusty dew
#

Don’t use Json as a db....

#

It can corrupt due to things being continuously written to it

brave anvil
#

So what use Rethink for that

lusty dew
#

Yes.

brave anvil
#

How

lusty dew
#

Use an actual db

#

Idk I don’t use rethink

brave anvil
#

XD

#

Fuck

lusty dew
#

I use sequelize

#

Kek

brave anvil
#

Are constables a solid value that doesnt ever change?

#

Idk I’m just asking random stupid questions

lusty dew
#

Uhm, don’t ask me kek

#

I’m trying to figure out my own problem

brave anvil
#

That Ik the answer to

#

Need help?

lusty dew
#

Unless you know sequelize

brave anvil
#

Hmmm

#

What type of db

lusty dew
#

Or the ability to read docs better then me

brave anvil
#

Yea Kinda

#

I write docs

#

Hehe

lusty dew
#

I’m using sequelize + sqlite3

brave anvil
#

FUCK

#

Hmm

#

RethinkDB is so small

#

XD

lusty dew
#

Wait I think I’m doing it wrong lol

brave anvil
#

That makes since

#

Hehe

lusty dew
#

Or not...

#

Well I was but

#

Still not working

#

Hmph

brave anvil
#

The thing is is when you use Rethink You Have to Have 3 replicas to have 2 shards

lusty dew
#

Oof

brave anvil
#

Hehe

#

Yeha

#

Its fine

#

I have like 6 replicas

#

Hehe

#

Friends Run RethinkDB with me

lusty dew
#

Oh cool

brave anvil
#

One lives in Mexico

#

4 in Europe

#

And one in us

lusty dew
#

I’m perplexed why this isnt working

brave anvil
#

Well 2 in US if you count TrisDevs Central My Server

#

So 7

#

But I think I might try to use a SQLDB for this project

#

Should I use A SQL DB?

amber fractal
#

Preference

#

You'll get nothing but bias from that question

#

Like me, I'll say no

#

But that's because Im bias towards nosql because I've never used sql dbs

#

Never bothered learning the syntax

lusty dew
#

My answer is No

#

I may use em but like, just because it’s easier to learn.

#

Though the syntax is weird

#

Not always very descriptive of where the error originated from or what caused it

#

Also it’s kinda fun ngl.

brave anvil
#

Same

lusty dew
#

How do I select something from a table using sequelize

#

Like I want to get the prefix of a guild

opaque eagle
#

If you used Guild.findOne(), the resolved object would contain all the fields that are in the table

#

@lusty dew

lusty dew
#

I am

#

It does nothing

opaque eagle
#

Show code

copper cradle
#

DO IT

#

NOW

lusty dew
#

...

#

Will you go away if you aren’t going to contribute

#

I tried:
const prefix = Guild.findOne({prefix}) kinda knew that one wouldn’t work but I tried
const prefix = Guild.findOne({where: {id: message.guild.id, prefix})

opaque eagle
#

What scenario are you writing this code for?

#

Like why do you need this

#

Is it for a prefix command, or when messages are handled, etc

lusty dew
#

Messages are handled like

#

If the message starts with a prefix from the db or if one isn’t set it will use the default prefix

opaque eagle
#

And do you have prefix defined as a variable somewhere in your code already?

lusty dew
#

Yea

#

Few times

opaque eagle
#

So you want to find a guild that uses that specific prefix?

lusty dew
#
let prefix = message.content.match(RegExp(`^<@!?${client.user.id}>`))
  if (prefix)
    prefix = prefix[0]
    else {
      prefix = Guild.findOne({where: {id: message.guild.id, prefix}}) || client.settings.prefix
      if (!message.content.startsWith(prefix)) {
      }
    }```
#

That’s inside a message event

opaque eagle
#

I don’t see how , prefix helps you

lusty dew
#

Well yea.

opaque eagle
#

What do you think that does

#

Or what did u expect it to do

lusty dew
#

Load the prefix for the guild matching the ID

#

That’s what I expected it to do

opaque eagle
#

Ok get rid of , prefix because that’s not what it does

#

, prefix is shorthand for , prefix: prefix which means it’ll try to find only the DB entries that match prefix[0]

lusty dew
#

Okay

opaque eagle
#

The second problem I noticed was that Guild.findOne() returns a Promise, so you need to use async/await or .then()

lusty dew
#

Okay

#

So how would I get the prefix then?

#

Or would Guild.findOne({where: {id: message.guild.id}})

#

Pull all the info from that table matching the ID?

opaque eagle
#

It’ll resolve a promise that has all the info

#

From the thing it resolves, you can do .get(“field”) to get any field

lusty dew
#

So .get('prefix')

#

Okay thanks

#

Can it be an array if I want to get multiple things?

#

Or would I use commas

#

Like .get('prefix, log_channel')

opaque eagle
#

No just get the different things you want separately

#

Like const prefix = res.get(“prefix”);

lusty dew
#

Okay

#

So basically make the Guild.findOne a separate variable

lusty dew
#

@opaque eagle it is like:
await Guild.findOne({where: {id: message.guild.id}}).get('prefix')

opaque eagle
#

No, store the Guild.findOne() in a separate variable first and get prefix from there

lusty dew
#

Okay, may I ask what the difference is?

opaque eagle
#

Guild.findOne() returns the promise, not get(). In that code above, await applies to the get(), when it should be awaiting the Guild.findOne()

lusty dew
#

Ah okay

#

Okay now I need to find a way to create a entry for the guild.

opaque eagle
#

Do it on the guildCreate event

lusty dew
#

Well what about the already existing guilds the bot is in

opaque eagle
#

guildCreate is the event that’s triggered when the bot is added to a new Guild

#

Manually add those I guess?

#

Adding it on guildCreate is the future-proof solution

lusty dew
#

That’s like 26 guilds oof

opaque eagle
#

Then write a script to do it for the current guilds

#

And then from that point on, do it on guildCreate

lusty dew
#

Yea

#

And I’d do Guild.create()

#

Right?

opaque eagle
#

Maybe time to read either the tutorial or docs

lusty dew
#

Okay

#

One thing though, I don’t think it’s listed on the docs at least I don’t see it

spare goblet
#

What's the cause for "Discord API Error: Unknown Message" error? I've tried fetching the message from the channel with eval and it fetches perfectly fine. Any suggestions on how I can fix this is appreciated.

lusty dew
#

Can I do Guild.create({id: guild.id})

wheat jolt
#

You want to enter a guild?

#

With your bot?

lusty dew
#

What?

wheat jolt
#

What are you trying to do

lusty dew
#

I’m using sequelize

#

And I’m trying to write a new guild to a db

#

Now as I was saying

wheat jolt
#

I tought you wanna add your bot to a guild by the guild id 😂

#

What db?

lusty dew
#

No...

#

Sequelize + sqlite3

#

Anyway can I please finish explaining?

wheat jolt
#

Yes

#

Sorry

#

😂

lusty dew
#

Since id is the primary key it’d write everything that the table has to that guild right?

#

So like the guildMemAdd column, guildMemRem column, prefix column, etc

#

@opaque eagle how can I create it manually if it isn’t even allowing me to use the default prefix cause the prefix from the db is null cause there is no entry for the support server

opaque eagle
#

If there’s no entry for the support server, I’d add it manually

#

Like using the command line

lusty dew
#

Oh?

#

I didn’t know you could do that

opaque eagle
#

Yeah lol, you can run regular sql queries in the command line

lusty dew
#

Oh shoot.

#

Would I use SQLite syntax

#

Or sequelize

opaque eagle
#

SQL syntax

lusty dew
#

And I installed sqlite3 so ima assume I use that

opaque eagle
#

The SELECT * FROM etc etc etc are SQL queries. SQLite is a file-based database that allows users to interact using the SQL language

lusty dew
#

Yea

#

I’m trying to figure this out but it isn’t wanting to work.

spare goblet
#

@lusty dew check if there's a row in the table for the guild ID, if not, let prefix be default prefix

lusty dew
#

I got it kek

#

I just removed using the db and put let prefix = client.settings.prefix

#

To create an entry for the db

#

Okay nvm

#

It was me being dumb

#

How did I miss it twice

#

😂

lusty dew
#

Why do I get object Promise

#

I’m pretty sure that happens when you don’t await something

#

But I already awaited it

earnest phoenix
#

what's your code

lusty dew
#
let res = await Guild.findOne({where: {id: message.guild.id}})
res.increment('case_counter')

@earnest phoenix

fallen gulch
#
    embed.set_author(name=f"User Info - {member}")
                                                ^
SyntaxError: invalid syntax```
#
async def userinfo(ctx, member: discord.Member = None):
    member = ctx.authot if not member else member
    roles = [role for role in member.roles]

    embed = discord.Embed(colour=member.color, timestamp=ctx.message.created_at)

    embed.set_author(name=f"User Info - {member}")
    embed.set_thumbnail(url=member.avatar_url)
    embled.set_footer(text=f"Requested by {ctx.author}", icon_url=ctx.author_url)

    embled.add_field(name="ID:"), value=member.id)
    embled.add_field(name="Nickname:"), value=member.display_name)

    embled.add_field(name="Joined at:", value=member.joined_at.strftime("%a, %#d %B %Y, %I:%M %p UTC"))

    embled.add_field(name=f"Roles ({len(roles)})", value=" ".join([role.mention for role in roles]))```
#

-=- python -=-

opaque eagle
#

I’m going to do the unthinkable

#

I’m outside with no laptop and only my phone

#

I’m gonna be one of the plebs that make a bot on their phone

#

Nvm we’re leaving

lusty dew
#

Lol

slender thistle
#

@fallen gulch ctx.authot

#

why not just do roles = member.roles

#

Why is embled there

fallen gulch
#
@bot.command(pass_context=True)
async def userinfo(ctx, member: discord.Member = None):
    member = ctx.author if not member else member
    roles = [role for role in member.roles]

    embed = discord.Embed(colour=member.color, timestamp=ctx.message.created_at)

    embed.set_author(name=f"User Info - {member}")
    embed.set_thumbnail(url=member.avatar_url)
    embed.set_footer(text=f"Requested by {ctx.author}", icon_url=ctx.author_url)

    embed.add_field(name="ID:"), value=member.id)
    embed.add_field(name="Nickname:"), value=member.display_name)

    embed.add_field(name="Joined at:", value=member.joined_at.strftime("%a, %#d %B %Y, %I:%M %p UTC"))

    embed.add_field(name=f"Roles ({len(roles)})", value=" ".join([role.mention for role in roles]))

    await ctx.send(embed=embed)```
#

embed.set_author(name=f'User Info - {member}')
^
SyntaxError: invalid syntax

cursive dagger
#

what python version?

fallen gulch
#

3.5

brave elm
#

I know this issue, but I don't know how to fix it. I need to make it look in another folder (dist)

#

How can I change the directory to go through a folder called dist?

#

I'm using Visual Studio Code

onyx summit
#

Edit your config

cursive dagger
#

@fallen gulch F strings was implemented in python 3.6

brave elm
#

My config currently just has my bots prefix and token.

#

tsconfig

onyx summit
#

I mean package.json
you need "main": "dist/index.js"

brave elm
#

Has other stuff

#

Ahh okay I understand

#

Thanks so much 🙂

onyx summit
#

For development I recommend to use ts-node, and not compile all the time

brave elm
#

I'm new to this so I need to learn things and it's not hard, but somethings like that, I know what's wrong, but I don't know how to set it.

#

Yeah, I'm currently using .ts

#

I'm following a youtube playlist for now.

#

He explains everything, how it all works so it's good.

onyx summit
#

Yeah, typescript. And while developing you can do ts-node src/index.ts instead of compiling

brave elm
#

Ahh okay

#

Thanks

#

I still get the sma error

#

same*

#

That's how I've done it, that's in package.json

#

It's still trying the other directory.

#

@onyx summit

solar cosmos
#

I might be asking this in the wrong place, but I could not find where to ask.
If I have a finished bot, and do not want to permanently keep DBM active on my pc 24/8, where would I need to upload the project to, to have it active at all times?

#

and yes I understand I am meaning a server 😛

lusty dew
#
let res = await Guild.findOne({where: {id: message.guild.id}})//outside embed
res.increment('case_counter') // Inside embed
earnest phoenix
#

are you sure increment doesn't return a promise

lusty dew
#

Yea now it does this

#

It increments but doesn’t show the number

onyx summit
#

@solar cosmos any server will do (like a vps).
Some people use glitch cuzz it's free, but I can't recommend for "bigger" bots