#development

1 messages · Page 1727 of 1

opal plank
#

even if you do something like berry for the autoposter, your dependencies will likely be enourmous

#

since you'll need to install each lib as dep to check which type of client the user is providing

#

and if you go another router, you'll rely on the user to do it they way you need, which defeats the purpose of "quick and dirty, low effort package'

#

the idea in itself has too many major complications, one or two roadblocks is fine, as devs we deal with them

#

but there are SO MANY in what you want to do

#

not saying its impossible either, but you get the idea

#

just making sure you understand what it will entail and if you have the will to see it through

spare badger
#

Yea I get you, thanks for the feedback and heads up. I’m not really a super experienced Discord bot dev in perticular. Feel like I have to dive into all the packages people use to interact with the Discord API. Didn’t know there were so many.

opal plank
#

discord.js, eris.js, erala.js, discord-rose are the main ones i can get off my head

#

you'll need to check at least those

spare badger
#

Yea and then you have a tonne of people building in Python

opal plank
#

py is not my area unfortunately so i cant give input on that, though im fairly certain its mainly one lib there

spare badger
#

Well gonna think about it for now and look into all the technicals tomorrow. Thank you for all your input, time and knowledge. @opal plank

opal plank
#

np

opal plank
#

Is JavaScript really that slow? Or is that just a leftover impression from the old days?

Patreon: https://www.patreon.com/simondevyt

Follow me on:
Twitter: https://twitter.com/iced_coffee_dev
Instagram: https://www.instagram.com/beer_and_code/
Github: https://github.com/simondevyoutube/

In this video we talk a bit about JavaScript vs C++, and...

▶ Play video
split hazel
#

fast boi

#

cjavascript when

#

node gyp getting old

deep mantle
#

Well it appears you are checking if they have less than 100 dollars but then are subtracting an amount between 1 and 1000, which could be larger than the balance

#

Like if they had 400 dollars and you subtracted 800

#

You need to run the bot code through the bot token

soft glade
livid compass
quick willow
#
const topgg = require('@top-gg/sdk');
const topapi = new topgg('token'); // TypeError: topgg is not a constructor

why is this not working? edit oh i see im an idiot

deep mantle
#

Thats the way I would do it

quick willow
#

pick a number between 25 and 75, divide by 100, multiply by the amount of money the person has, and that is the amount you steal

deep mantle
#

That's a good method lol

quick willow
soft glade
opal plank
quick willow
deep mantle
#

Bad capitalization sorry

soft glade
#

its fine

#

ima try that

deep mantle
#

And if you want them not robbable if they have less than 100 then do

#

if bal < 100:
Await ctx.send('some message')
Return

soft glade
#

ok

deep mantle
#

There might be better ways to do that though

soft glade
#

i see what im suppose to change

#

but i dont know how

deep mantle
#

That should work

soft glade
#

ok i will parse you for ever if thats works

opal plank
#

should probably not spoonfeed

deep mantle
#

Oh ok sorry

opal plank
#

helping is fine, but straight up posting pre-made code at that length is probably going a bit far

deep mantle
#

Ok thanks

soft glade
#

sorry

opal plank
#

its fine, its for your own good in all honesty, its better a thorough explanation so you understand what you are doing instead of just copy pasting it, in case you need something similar in the future you know how to solve it logically

#

it basically gets rid of dependency

soft glade
#

ok

#

hey sorry if im bothing but how did you get a bots server count onto your profile

opal plank
#

its running on an API i did

soft glade
#

oh

#

look at my profile is it like that?

opal plank
#

its in c#

soft glade
opal plank
#

kinda, that looks the RPC package from discord.js

#

not the SDK

soft glade
#

yeah its RPC

opal plank
#

RPC is deprecated, just letting you know

#

https://discord.com/developers/docs/rich-presence/how-to
The SDK that this documentation references, Discord-RPC, has been deprecated in favor of our new Discord GameSDK. Replacement functionality for the Rich Presence SDK can be found in the Activity Manager of that SDK. This documentation can be referenced for education but does not entirely reflect the new SDK.

Discord Developer Portal

Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.

#

which is what you're using

soft glade
#

hm do you have to keep cmd open for the SDK? or is it the same for every one

opal plank
#

not at all, its just using my client id

#

it runs as a background task

#

i think its using 3mb, its super light

#

2.7mb

#

3mb to round it up

#

its just a loop() every 15 seconds fetching the data from my api

soft glade
#

hm i might have to find out how to do that bc i think mine is a ID aswell bc of this
client.login({ clientId : "My Clinet ID is here" }).catch(console.error);

#

i underlined think bc idk

opal plank
#

like i said, thats RPC not sdk

#

they are completely different things

soft glade
#

ik

opal plank
#

this example runs basically as is

soft glade
#

i see

opal plank
#
    auto result = discord::Core::Create(461618159171141643, DiscordCreateFlags_Default, &core);
    discord::Activity activity{};
    activity.SetState("Testing");
    activity.SetDetails("Fruit Loops");```
blissful coral
#

I don't use _id anywhere in my code

quaint wasp
#

why

#

is this not working?

earnest phoenix
#

dafuq

quaint wasp
#

it does "Cannot read property 'send' of undefined"

#

C is clearly defined.

opal plank
#

@quaint wasp get() might return undefined

#

which is whats causing that

quaint wasp
#

..

#

then how else do I find a channel?

#

Thats somewhere else?

opal plank
#

are you sharding?

#

might be on other shards

quaint wasp
#

nope.

#

only 31 servers lol.

opal plank
#

console.log(giveawayC)

quaint wasp
#

no no no no

#

I dont want log into consol

#

I want it into my channel

#

😐

earnest phoenix
#

giveawayC.send(giveawayE)

opal plank
#

you need to know what that is

long crow
#

get only accept id

quaint wasp
#

o.

#

well

#

It is id

#

ID of channel

opal plank
#

are you SURE?

quaint wasp
#

YES.

opal plank
#

ABSOLUTELY SURE

quaint wasp
#

the id is in config.

earnest phoenix
quaint wasp
#

YES.

opal plank
#

then your id is wrong

#

either its a wrong type or the id is wrong

#

those are 2 only explanation

quaint wasp
#

I litilery copy pasted it.

opal plank
#

or you arent caching channels

quaint wasp
#

... what do u mean?

opal plank
#

if the channel is not cached

#

guess what?

#

its not there lul

#

you can try fetch() first

#

to amke sure it attempts to get it

quaint wasp
#

ok..

#

ok ok ok..

quaint wasp
quaint wasp
lyric mountain
#

Fetch from channels not from giveawayC

quaint wasp
#

I described it like this:

#

in config

#
    "giveawayChannelLog" : "831189428172226660"
quaint wasp
#

giveawC is GiveawayChannelLog.

lyric mountain
#

Fetch the giveawayC, not from giveawayC

quaint wasp
#

..

#

umm

#

how?

lyric mountain
#

client.channels.fetch(id)

quaint wasp
#

I have that.

lyric mountain
#

Still say not a function?

quaint wasp
#
        client.channels.cache.fetch(giveawayC).send(giveawayE)
lyric mountain
#

Not cache

quaint wasp
#

right..

#

one sec.

pale vessel
#

i didn't think extreme was this bad but then i realized it's not him

quaint wasp
#

umm

#

says value not snowfalke

earnest phoenix
#

Can someone help me with this, I made a kick command:

   async def kick(self, context, member: discord.Member, reason: str=None):
        embed = discord.Embed(
                description=f"Kicked {member.name} from {context.guild.name} 
                             successfully."
        )
        await member.kick(reason=reason)
        await context.send(embed=embed)```
But it says, ```memeber``` has no attribute "kick"
lyric mountain
#

Log giveawayC

quaint wasp
#

one sec afk.

#

ok.

#

back

soft glade
#

@deep mantle soo i think there is a problem

steep drum
# quaint wasp

you initialize giveawayC as the channel, you then go on to try to get the channel again, but using the giveawayC object

quaint wasp
#

alright

#

it sent this:

lament rock
#

object != string
is what they were trying to get at

quaint wasp
#

oh

steep drum
#

yes, but also, why get the channel again, you already have it in giveawayC

quaint wasp
#

because..

#

umm

#

actiauly I dont know.

steep drum
#

right, just do giveawayC.send

quaint wasp
#

but...

opal plank
quaint wasp
#

giveawayC is someting else

lament rock
#

the reference you store and the reference from cache would be the same data since Discord.js patches the data on an instance instead of overriding the instance

opal plank
quaint wasp
#

its not in server that the giveaway was amde at

quaint wasp
#

ID of the channel

steep drum
#

but you explicitly set giveawayC to the giveawayChannelLog

quaint wasp
#

yes because I am big brain

#

I like more consts.

#

joking

#

I just wanted to

#

😐

soft glade
#

@opal plank soo ik you didnt give this to me but you have any clue why its not even sending?

this is the new

@client.command(aliases=['rb'])
@cooldown(1, 20, BucketType.user)
async def rob(ctx, member: discord.Member):
    await open_account(ctx.author)
    await open_account(member)
    bal = await update_bank(member)

    if bal[0] < 100:
        await ctx.send('It is useless to rob him :(')
        return

    if bal > 1000:
        earning = random.randrange(1,1000)
    else:
        earning = random.randrange(1,bal)

    await update_bank(ctx.author, earning)
    await update_bank(member, -1 * earning)
    await ctx.send(
        f'{ctx.author.mention} You robbed {member} and got {earning} dollars')

this is the Old one this works the new one doesnt

@cooldown(1, 15, BucketType.user)
async def rob(ctx, member: discord.Member):
    await open_account(ctx.author)
    await open_account(member)
    bal = await update_bank(member)

    if bal[0] < 100:
        await ctx.send('It is useless to rob him :(')
        return

    earning = random.randrange(0, 1000)

    await update_bank(ctx.author, earning)
    await update_bank(member, -1 * earning)
    await ctx.send(
        f'{ctx.author.mention} You robbed {member} and got {earning} dollars')
opal plank
#

the advice i can give in python is very limited

#

so tis probably not the best to ask me

#

the methods are similar, and this is just mostly logic

steep drum
soft glade
#

Oof

opal plank
#

but i would still not trust myself with that

steep drum
#

.get returns a channel object

quaint wasp
#

yes..

#

but this time

#

it returned giveaway channel log

#

and that is the channel object

steep drum
#

exactly, so just do giveawayC.send at the bottom there

quaint wasp
#

ok...

soft glade
#

how can i make a bot send errors python bc im trying to find out why my bot is gay

quaint wasp
#

oh... lol

soft glade
#

like my bot only wants to work if its going to put people under 0 money

#

but when i think its going to work

#

it doesnt

steep drum
#

i don't know python particularly well but why are you using bal[0] in some places but bal in other

soft glade
#

i used to watch vids to learn so i have no clue i was just trying to learn python at the time

#

so idk just trying to fix everything so maybe it can be good

steep drum
#

fix that and it should be good to go

soft glade
#

the bal[0]?

lyric mountain
#

Wanna a tip? Rewrite the code

quaint wasp
#

I got this,

    execute(message, args) {


        const commandName = args[0].toLowerCase();
```,
#

but it doesnt know what toLowerCase is.

#

I mean args.

soft glade
steep drum
#

well, either bal or bal[0], your balance can't be both

lyric mountain
#

If that's old code from when you used to watch videos you might have very badly written or outdated code there

lyric mountain
#

Trust me

soft glade
lyric mountain
#

That coming from someone who've rewritten own 1m line code

#

Thrice

#

Rewrites tend to end up as way smaller codes

#

Also by rewriting you'll know exactly where everything is

#

And what they do

soft glade
#

the only reason i dont want to rewrite which i probably will in a bit but idk where to start

lyric mountain
#

Start by the concept

#

Like

#

Will you use a command handler? What structure will you use? Are you going to use databases? A centralized controller might be handy then. Etc etc

#

Put everything on paper

#

The create the foundation (controllers, interfaces, models, event handlers)

#

After that connect all the pieces and setup index file

soft glade
#

hm

#

what would be a good language to learn other than python

blissful coral
#

c#

soft glade
#

ok

lyric mountain
#

Java

neat harness
#

I rewrote my bot because it feels so weird looking at 7k lines index.js which if I hadn't rewritten would prob go up to like 25k+

lyric mountain
#

Lul

soft glade
#

which one is easy to learn

neat harness
#

I restructured them and made them dynamic with organized foldering

neat harness
soft glade
#

ok thats the one then

lyric mountain
#

Ngl tho, if you become self aware that your file is getting too big then you're making a great progress

neat harness
#

True xd

#

I used to think the bigger the better

lyric mountain
#

Noticing something is wrong is a great signal that your knowledge is getting more refined

#

Suddenly you're going full-modular with procedurally generated stuff

opal plank
#

sometimes more = less though

neat harness
#

Xd

neat harness
opal plank
#
[].forEach((a) => console.log(a));

for(let a of []) { 
  console.log(a);
}```
#

second is more performant for example

neat harness
#

Yeah

#

I go for flexibility > efficiency

#

But I still try to make it as efficient as possible

opal plank
#

what taught me about being an efficiency freak was my twitch project

#

those things stack

#

and QUICK

#

when you try to scale a project

lyric mountain
#

Don't talk about twitch

opal plank
#

shush

neat harness
#

I tried making a gacha system for my bot

#

It used up an entire 1k lines+ in a single command file

opal plank
#

wot

neat harness
#

I have no idea how to make it more efficient

lyric mountain
#

Actually

#

More lines don't necessarily mean less efficient code

neat harness
#

I'm a coding noob that just started coding as I started coding a discord bot last year

opal plank
#

i did my gacha in 200 ish

neat harness
lyric mountain
#

Nope

opal plank
#

and could be smaller im gonna be honest

neat harness
opal plank
#

me too

#

its fully dynamic

lyric mountain
#

What you see isn't what the computer sees

opal plank
#

i can literally edit the db and it updates the bots with each entry

neat harness
#

It's insanely flexible and easy to add new ones

opal plank
#

same here

lyric mountain
#

Sometimes a bigger code can be faster than a smaller code

opal plank
#

i literally type one command and it pulls everything from the db with the new items

neat harness
#

Hold on see if I still have it

opal plank
#

i gave an example

crimson vapor
#

wtf

opal plank
#

brakets arent even needed in all honesty

crimson vapor
#

talking here when we had a perfectly good conversation in general

#

smfh

opal plank
#

@neat harness

#

completely dynamic

#

also dynamically generated image

#

no matter how many entries, it'll always fit them

crimson vapor
#

Erwin are you being a salesman again?

neat harness
#

Mind you this is from back when I started coding like 2 months in

opal plank
#

DETRITUS! TWITCH! MUSHOKU TENSEI! REDIS! POSTGRES!

crimson vapor
#

redis?

#

thats a new one

#

why twitch

#

twitch is ass

opal plank
#

cuz my bot

neat harness
opal plank
#

aparently kuuhaku says i talk about it too much

crimson vapor
#

fair

opal plank
#

this triggers me on so many levels

#

i dont think i can fully put it in words

neat harness
#

Ikr

crimson vapor
#

gonna make another r/programming post?

neat harness
#

Haven't touched it for 10 months

soft glade
#

ehhhhh

const client = new Discord.Client();

const Discord = require('discord.js');
require('dotenv').config();

client.on('message', (msg) => {
  if (msg.content === 'JS test') msg.reply('Hi');
});

client.login(process.env.BOT_TOKEN);
opal plank
#

some are js, some are json, json db, multiple lines of declaration, the bottom doesnt use the keyword let anymore

#

like wtf

neat harness
#

It's not even up to date with my current base system

lyric mountain
#

This is my biggest work

soft glade
opal plank
#

fuckoff

#

use postgres or sqlite

crimson vapor
#

I need to rewrite it

opal plank
#

no u dont

crimson vapor
#

yes I do

neat harness
#

It's mongodb

opal plank
#

you need to delete it

crimson vapor
#

true

opal plank
#

mongo works even better

crimson vapor
#

ill put that on my list

neat harness
#

Json db is static

opal plank
neat harness
#

I use mongodb

#

👀

crimson vapor
#

I use mongodb

opal plank
#

mongo is good

#

i use postgres

neat harness
#

The js files are models

opal plank
#

as the clear superior db

lyric mountain
#

I use both post and sq

neat harness
#

The json files are char data

opal plank
#

im a postgres supremacist

crimson vapor
#

the high iq queries are just too big brain for me

neat harness
#

It isn't even using the dynamic cd tf

#

So old

opal plank
#

its literally 3 things u need to know

#

INSERT UPDATE AND SELECT

#

thats it

crimson vapor
#

3 confusing as fuck things

opal plank
#

THREE THINGS

neat harness
crimson vapor
#

3 things
lists 4

opal plank
#

insert for insertions, select for finding, update for editing

#

that simple

neat harness
#

AND for?

lyric mountain
#

Delete for fucking database

opal plank
#

AND isnt part of that

#

was just me on caps

neat harness
#

Oh

crimson vapor
#

oh

#

caps

#

ewww

soft glade
opal plank
#

its the same as js

#

its human redable

crimson vapor
neat harness
lament rock
#

sql resembles english more than most JS code does tbh

lyric mountain
#

Mongo is virgin, SQL IS CHAD

opal plank
#

SELECT * FROM TABLE WHERE THING = THING AND THING = FOO ORDER BY SOMETHINGELSE LIMIT 2

#

its literally human redable

neat harness
lyric mountain
#

Mongo uses small and discrete caps, no impact

neat harness
#

I can't fking read that

opal plank
#

thats literally what you use

neat harness
#

I don't understand

lyric mountain
#

SQL USES FULLCAPS WHUCH ARE LOUD AND RECOGNIZABLE ANYWHERE

crimson vapor
#

SELECT * FROM WEEB WHERE NAME = ERWIN AND SALESMAN = TRUE LIMIT 1

opal plank
#

read it as is

opal plank
#

that hard

crimson vapor
#

yes

neat harness
#

I am the person that gets 2/100 in math

crimson vapor
#

I got a 70 on my math test

#

pretty good grade

opal plank
#

INSERT INTO TABLE (ID, NAME, PROFESSION) VALUES(123, LERWIN, WEEB)

#

boom

#

now you know inserts

neat harness
#

I can't code until last year where I got interested into discord bot and instantly capable of coding one

crimson vapor
#

I don't understand

soft glade
#

is it like this for ever command

opal plank
#

after table it expects the colums its suppose to fill

soft glade
#

it @ me

opal plank
#

id, name and profession are the columns

#

thats it

#

the 3 querries (select, insert, update) is literally all u need

neat harness
crimson vapor
#

INSERT INTO WEEB (ID, NAME, SALES) VALUES (erwin.id, Erwin, Detritus)

neat harness
#

And stuck with it for another year

crimson vapor
#

sql kinda fucky wucky tho

opal plank
#

its human redable

crimson vapor
#

barely

opal plank
#

coming from js you should like human redable things

neat harness
#

@opal plank Teach rich presense

opal plank
#

there are a few bs things that even i dont like

crimson vapor
#

ive never been so insulted by something so true

opal plank
neat harness
pale vessel
#

actually it's called sdk 🤓

neat harness
#

Oh god

opal plank
crimson vapor
#

not equal

#

duh

neat harness
#

not equals strict

opal plank
crimson vapor
#

I mean

opal plank
#

this is the sql

crimson vapor
#

wait wait wait

opal plank
#

<>

crimson vapor
#

wait wait wait

opal plank
#

this means not equal

crimson vapor
#

<> is literally equals

neat harness
#

Lmao

crimson vapor
#

wait no

#

<> is not inclusive

opal plank
#

hence why i said theres even some shit i personally dislike

crimson vapor
#

at all

neat harness
crimson vapor
#

what in the world

neat harness
#

Sanity questionable

crimson vapor
#

x < y y > x

#

not inclusive at all

opal plank
#

dont get me wrong, the stuff im teaching u is basic shit to get by

#

you can have some really amazing querries

neat harness
opal plank
#

let me see if i can find here some of mine

lyric mountain
soft glade
#

hey in java is it possible to let commands or client.on what ever its called how would i make it only work for one person

lyric mountain
#

Yooooo java my boy

#

Time to sell my tuna

soft glade
#
const Discord = require('discord.js');
require('dotenv').config();

const client = new Discord.Client();

client.on('message', (msg) => {
  if (msg.content === 'JS test') msg.reply('Hi');
  if (msg.content === '!mod') {
  msg.member.roles.add('837501198297989171');
  msg.react('?');
  msg.reply('You are a MOD now');
  }
});

client.login(process.env.BOT_TOKEN);
#

trying to learn

lyric mountain
#

Thats js

#

My tuna just rotted

lyric mountain
#

Turns out it wasn't tuna

opal plank
#

fuck where is it at

neat harness
opal plank
opal plank
neat harness
#

Aaaaa

#

I don't understand what I'm reading

opal plank
#

thats if you want to verify your game with discord

#

so you get the nifty badge after ur game

soft glade
lyric mountain
neat harness
#

I take codes from people and integrate it with other people's code with some js logic to make a brand new code for different purposes

lyric mountain
#

I'm a java boy

neat harness
#

I most definitely do not know what the f I'm doing

soft glade
sudden geyser
soft glade
#

caps

neat harness
crimson vapor
#

oh yikes

#

don't say that

lyric mountain
#

If only I knew how to write compilers...

crimson vapor
#

compile js to java

opal plank
#

fuck i lost the querry

lyric mountain
#

I'd gladly make a js > java transpiler

crimson vapor
#

way better that way

opal plank
#

it was legit a 40 line query

sudden geyser
neat harness
#

T.T

crimson vapor
#

14ROVI has some cool queries

sudden geyser
#

I want to write a full-fledged compiler before I die

crimson vapor
#

I don't

#

im fine with high level languages

soft glade
neat harness
sudden geyser
#

to the 4th power

neat harness
opal plank
#

fuck i lost the big ass query i had

crimson vapor
#

whatever

sudden geyser
opal plank
crimson vapor
#

yes

#

I love scratch

#

its my favorite

neat harness
#

Javascript is logic script

crimson vapor
neat harness
#

It's easy

#

Just use logic and a tad of imagination

crimson vapor
#

javascript is not logic script

sudden geyser
#

functional with a dash of object oriented with a dash of hot sauce

crimson vapor
#

thats bytecode

#

iirc?

opal plank
#

JS is like a honey badger, it may be bleeding, withtou its teeths, without 2 legs, but it will continue limping without complaining

#

thats why ts is good

neat harness
#

Ts

opal plank
#

it doesnt swallow the errors for u

crimson vapor
#

TS

lyric mountain
#

Did you know? If you cut someone's arm off and offer a chocolate you get back 10% more chocolate

neat harness
#

TS?

pale vessel
#

__pycache__

crimson vapor
pale vessel
lyric mountain
#

Because 1 / 0.9 is 1.1

neat harness
#

Oooo

crimson vapor
#

no

#

typescript

neat harness
#

I had weird thoughts

crimson vapor
#

lmao

pale vessel
opal plank
crimson vapor
#

what?

opal plank
#

i had to slap 5 files with //@ts-nocheck while porting my user data

#

i shit you not

crimson vapor
#

I saw

opal plank
#

THAT many errors

crimson vapor
#

I saw

#

anyway

#

wanna see my emails

opal plank
#

no thanks, i dont wanna see your Horny moms in your area ads

opal plank
#

i would recommend firing whoever is doing that

#

and commiting -rm

soft glade
sudden geyser
#

noop

crimson vapor
soft glade
#

F

opal plank
#

just saying

crimson vapor
#

I know

sudden geyser
#

The comma doesn't make sense in this context. Replace it for a logical and operator (&&)

crimson vapor
#

I will die a painful death

opal plank
#

theres a special place in hell for people like you

crimson vapor
#

yes

#

the very bottom

opal plank
crimson vapor
#

where all you can hear is breathing noises

#

irregular breathing noises

sudden geyser
crimson vapor
#

x ? y : z

#

if (x) y
else z

crimson vapor
#

chaining ? : is the most shitty thing ive ever done tbh

#

worse than the github account name

opal plank
#

i love it

crimson vapor
sudden geyser
#

would be better if we ditched ternary operator and make if an expression

opal plank
#

i think i chained 9 or 10 here

#

holdup

crimson vapor
#

jesus

#

fucking hell

#

oh

opal plank
#
function returnType(staff) {
return staff === undefined ? "staff is undefined" : staff === null ? "staff is null" : typeof staff === "number" ? "staff is a number" : typeof staff === "object" ? "staff is an object" : typeof staff === "string" ? "staff is a tring" : "staff is unkown"  }```
crimson vapor
#

probably strings

#

yep

opal plank
#

i could've sworn i made it worse before

crimson vapor
opal plank
#

nah fuck that

#

fuck readability

crimson vapor
#

too readable ik

opal plank
#

--yolo it is

crimson vapor
pale vessel
#

nonono you do === 1

#

0 seconds not 0 second

#

only 1 is special

crimson vapor
#

lemme check one sec

opal plank
#
  let linkContent = ((client.channels.cache.get(args[5]) ? client.channels.cache.get(args[5]) : await client.channels.fetch(args[5])) as Discord.TextChannel).messages[this.cache.get(args[6]) ? this.cache.get(args[6]) : this.messages.fetch(args[6])]```
crimson vapor
#

defaults

pale vessel
#

why do you get() erwin

opal plank
#

if its not cached

#

fetch it

#

and then the messages

crimson vapor
#

just do ??

#

smh

opal plank
#

shush

pale vessel
#

no just fetch

opal plank
#

the idea of this is being cursed

pale vessel
#

oh ok

opal plank
#

legit 5 months ago

#

cant believe i remembered that

crimson vapor
opal plank
#

also this

#
try { ''.forEach('forcing error') } catch (err) { 
  if (!err) return;
  else if (err !== 'err') return;
  async function Handler_ERRoR(err) { 
    if (err) return err;
  }
  if (Handler_ERRoR(err).catch((err) => ())) try {
    throw new Error && () => { err }
  } catch (err) {
    if (err) return;
   }
  }
}```
crimson vapor
#

close

#

there ya go

#

what in the fuck

#

wait wait what

opal plank
crimson vapor
#

nope

#

youre insane

#

foreach on a string

#

passing a string as a function

#

and then not handling the error

opal plank
crimson vapor
#

because thats a constant

#

and error will never be 'err'

crimson vapor
#

yeah

#

thats why I added that

opal plank
#

fun times

lyric mountain
#

Imagine putting iframes in javadocs

#

Then embedding actual raid ads

opal plank
#

you welcome

#

theres a first for everything

crimson vapor
#

erwin

opal plank
crimson vapor
#

I fixed my shit function

opal plank
#

and i usually pick the cursed ones

crimson vapor
#
/**
 * Format the time broski
 * @param time how long in milliseconds
 * @example
 * formatTime(12308920)
 * // "3 hours, 25 minutes and 8 seconds"
 */
export function formatTime (time: number): string {
  let hours = 0
  let minutes = 0
  let seconds = 0

  // Hours
  while (time > 3600000) {
    hours++
    time = time - 3600000
  }

  // Minutes
  while (time > 60000) {
    minutes++
    time = time - 60000
  }

  // Seconds
  while (time > 1000) {
    seconds++
    time = time - 1000
  }

  const h = `${hours === 0 ? '' : `${hours} hour${hours > 1 ? 's' : ''}${minutes === 0 ? ' and' : ','} `}`
  const m = `${minutes === 0 ? '' : `${minutes} minute${minutes > 1 ? 's' : ''}${hours === 0 ? ' and' : ', and'} `}`
  const s = `${seconds > 1 ? seconds : 1} second${seconds > 1 ? 's' : ''}`

  return h + m + s
}```
opal plank
crimson vapor
#

your reactions are great

#

thank you

#

I accidentally copied and pasted the wrong function

#

there you go

opal plank
#

looks equally as shit

crimson vapor
#

its worse

#

im gonna see how shit I can format it

opal plank
#

use

#

the

#

fucking

#

%

#

operator

#

you dork

crimson vapor
#

later

opal plank
#

go work on my bot isntead then if you got nothing better to do

#

or go watch anime

crimson vapor
#

ok gimme your bot

opal plank
#

5 mil on the bank

crimson vapor
#

yes

opal plank
#

rn

crimson vapor
#

where did you get 4 of me?

#

wtf

opal plank
#

got it

crimson vapor
#

fucking

opal plank
#

its forever saved

crimson vapor
#

shit

opal plank
#

pay up and its urs

#

6.6k servers

pale vessel
opal plank
#

very juicy bot

opal plank
#

let me fetch ti, 1 sec

crimson vapor
#
/**
 * Format the time broski
 * @param time how long in milliseconds
 */
export function formatTime (time: number): string {
  let hours = 0
  var minutes = 0
  var seconds = 0
  // Hours
  while (time > 3600000) {
    hours++
    for (let i = 0; i < 3600000; i++) {
      time--
    }
  }
  // Minutes
  while (time > 60000) {
    minutes++
    for (let i = 0; i < 60000; i++) {
      time--
    }
  }
  // Seconds
  while (time > 1000) {
    seconds++
    for (var i = 0; i < 1000; i++) {
      time--
    }
  }
  return `${hours === 0 ? '' : `${hours} hour${hours > 1 ? 's' : ''}${minutes === 0 ? ' and' : ','} `}${minutes === 0 ? '' : `${minutes} minute${minutes > 1 ? 's' : ''}${hours === 0 ? ' and' : ', and'} `}${seconds > 1 ? seconds : 1} second${seconds > 1 ? 's' : ''}`
}```
#

fixed

pale vessel
#

Not cursed enough

crimson vapor
#

no?

crimson vapor
#

blur?

sudden geyser
#

The best code is code that documents itself.

opal plank
#

yes blur

crimson vapor
#

why blur?

lyric mountain
#

Blursed code

opal plank
#

cuz i was making this bot when nobody else had a genshin bot

#

the name would've given it away

#

and i wanted to keep the upper hand

#

most ideas are copied from here

lyric mountain
#

Nono, not like that

opal plank
#

cough cough like my presence

lyric mountain
#

It's called "higher ground"

crimson vapor
#

fast

pale vessel
#

oxford comma for life

crimson vapor
#

yes

#

I honestly only use it because you can group things differently

#

lemme think of an example

opal plank
crimson vapor
opal plank
#

no skip = no watch

#

what if theres a dickbutt in the end?

crimson vapor
#

ex. I like coding, pineapples and pizzas, and sleeping

#

see

#

thats why you need the oxford comma

pale vessel
#

yes

opal plank
#

actually

crimson vapor
sudden geyser
#

Can't JS's Date object help parse date components instead of writing your own (years, months, days, hours, minutes, etc.)

opal plank
#

i just had an amazing idea

#

like

opal plank
#

actually insanely good idea

crimson vapor
#

please share

opal plank
#

will do

#

how hard is it to make sharex add a rickroll bit to gifs in the end?:

#

toe every gif

#

with ffmpeg

crimson vapor
#

umm

#

not hard

opal plank
#

so when you share gifs it always ends with a rickrocll

crimson vapor
#

not hard at all

opal plank
#

make it a thing and gimme copy paste pls

crimson vapor
#

idk how

#

but you can use image effects probably

opal plank
crimson vapor
#

OR

#

you can do

opal plank
#

no fuckoff, i said it first

crimson vapor
#

perform actions -> cmd

opal plank
#

i already contributed to the idea

#

you go and do it

#

i want my royalties tho

crimson vapor
#

idk ffmpeg lmao

opal plank
#

go learn

crimson vapor
#

no thanks

opal plank
#

i wasnt asking

crimson vapor
#

oh shit

#

uhhh

opal plank
#

oddly kinky

#

but okay

#

we found an M here

crimson vapor
#

M?

opal plank
#

masochist

crimson vapor
#

oh

opal plank
#

ffmpeg shouldnt be that hard

crimson vapor
#

no thank you

#

not here

opal plank
#

not here

#

👀

crimson vapor
#

bad choice of words

#

not again

opal plank
#

or magiks

#

might even be easier

#

return await gif.prepend('rickroll.gif');

crimson vapor
#

can you do that?

sage bobcat
#

One message removed from a suspended account.

opal plank
#

no

crimson vapor
#

rip

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

opal plank
#

i was replying to million

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

opal plank
#

what have i done

earnest phoenix
#

Hello!

        const regex = new RegExp(':[^:\s]*(?:::[^:\s]*)*:');
        console.log(message.content)
        if(regex.test(message.content)) return;
``` this is my code. I am using TMI to send messages to a twitch channel but even when my discord emoji matches the regex it doesnt listen to my if statement here. any ideas? I tried .test and .match
#

This is the full code

opal plank
#

TMI is a Twitch lib tho

earnest phoenix
#

im using it to send discord messages to a discord channel

#

and discord messages to the twitch channel

opal plank
#

i dont think you can, nor should you

earnest phoenix
#

well im doing it

opal plank
#

oh, you doing the same thing i did lmao

earnest phoenix
#

its real simple

opal plank
#

i made a bot that does exactly that

crimson vapor
tacit sequoia
#

Lol

earnest phoenix
#

i dont have too much experience in regex

crimson vapor
#

I wonder what the time complexity of this is

opal plank
#

i assume its the regex itself

#

what is that even suppose to capture?

earnest phoenix
#

it matches my message

crimson vapor
#

I think its O(n)

opal plank
#

thats one weird way to capture that

#

why not this

tacit sequoia
#

(:.*:)

#

?

earnest phoenix
#

that wont catch animated emotes

opal plank
#

was about to say that

#

i usually prefer using capture groups and exclusion lists tho

tacit sequoia
#

Neither will the one you're using

opal plank
#

but it shouldnt affect mcuh

earnest phoenix
tacit sequoia
#

Oh?

earnest phoenix
opal plank
#

wait the point is using animated emotes?

tacit sequoia
opal plank
#

/^<a?:(\w+):(\d+)>$/

#

use that then

earnest phoenix
#

im trying to detect all custom emotes and tell the bot to stop

#

ill try it

opal plank
#

thats the default emoji regex

tacit sequoia
#

Custom emotes are not :name:

earnest phoenix
#

im aware

#

im also a developer

#

thanks

crimson vapor
opal plank
#

@earnest phoenix

tacit sequoia
earnest phoenix
#

give me a sec to test it

opal plank
#

this is the recommended regex for emotes

#

context is given with the actual full thing

#

not what you write

earnest phoenix
opal plank
#

you write :mmulu:

earnest phoenix
#

it still sends it

opal plank
#

discord recieves it like that ^^

#

its suppose to send it, no?

earnest phoenix
#

no its not

opal plank
#

like i said, try my regex

#

it captures that

earnest phoenix
#

i did

opal plank
#

/<a?:(\w+):(\d+)>/g

#

it 100% works

earnest phoenix
#

this is the code

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

earnest phoenix
#

he wasnt trying to use 3

sage bobcat
#

One message removed from a suspended account.

opal plank
#

@earnest phoenix

#

works like a charm

earnest phoenix
#

i dont see why your saying anything why would he use a whole extra line just for :wobble: or whatever

#

ill console log my if statement

opal plank
#

/<a?:(\w+):(\d+)>/g.test('![mmulu](https://cdn.discordapp.com/emojis/587328389929500692.webp?size=128 "mmulu")')

#

literally just that

#

try it yourself

earnest phoenix
#

returned false

opal plank
#

you dont realise what you did didnt you?

earnest phoenix
#
        const regex = new RegExp('/^<a?:(\w+):(\d+)>$/');
        console.log(regex.test(message.content))
opal plank
#

look closely at my example

#

and urs

#

you blindly copied the regex

#

that includes the start and finish of a string

#

thats what $/ is for

earnest phoenix
#

aaah my bad

opal plank
earnest phoenix
#

sorry I just never used regex. I should take my time and properly learn it next time.

#

ill quickly test ur example out

opal plank
#

its fine, just let me know you're new to regex and i'll give you an extra hand

opal plank
#

well, NOW you said it lul

earnest phoenix
#

lmao

#

aye it worked man thanks for the help

opal plank
#

no problemo

#

also

#

@earnest phoenix before you leave

#

let me ask you a very serious question

earnest phoenix
opal plank
#

is that bot/app u making for a few servers or you planning on scaling?

earnest phoenix
#

its only for 1

opal plank
#

then go right ahead

earnest phoenix
#

and its open sourced so if someone wants it they can just download it

opal plank
#

perfect

tacit sequoia
#

Recruiting? weirdsip

opal plank
#

i just like to enforce that twitch bots shouldnt be using the same discord mindset. Twitch does NOT scale

earnest phoenix
#

using TMI wouldnt be scaleable and my system wouldnt work either way

opal plank
#

none of the public libs scale

#

i had to make my own to get it scaled

earnest phoenix
#

lol

opal plank
#

its a pain

earnest phoenix
#

im not too into using vanilla APIS

opal plank
#

its in 52k twitch streams on the main lib i thnk

earnest phoenix
#

too much of a pain to make a wrapper for

opal plank
#

i went full on

#

kubernetes doesn properly handle it either

#

you're 100% stuck with making your own wrapper

earnest phoenix
#

lol. right now im trying to make my own API and wrapper so I can learn

opal plank
#

then by all means feel free to ask if you got any question, i might be one of the few here to ever touch twitch api

earnest phoenix
#

lol, I added you if i need future help

opal plank
earnest phoenix
#

you play Genshin impact?

opal plank
#

yup

#

also, this might be the same thing you are working on, but on scale btw

#

letme get a quick snippet

earnest phoenix
#

lol I use to play it before I got a uipgrade. I might get back into it. We should play sometime

#

I am high enough level to mutiplayer i believe

opal plank
#

custom currency per chat/stream + currency carries over

#

also crosschat

#

which is what you'r currently doing

crimson vapor
#

wait a minute

opal plank
#

though this is focused for scaling

crimson vapor
#

selfbot????

earnest phoenix
#

that seems alot smoother then mine

opal plank
#

selfbot?

crimson vapor
#

on twitch

#

I mean

earnest phoenix
opal plank
#

kinda, yeah

crimson vapor
#

yea ik

earnest phoenix
#

twitch doesnt detect bots like discord

opal plank
#

theres no difference in users and btos on twitch

#

they are the same

earnest phoenix
#

^

opal plank
#

its only discord that makes the distinction

crimson vapor
#

Erwin how did you deal with the sharded message event?

opal plank
#

though twitch has verified my bot

#

i needed a lot more ratelimits

earnest phoenix
#

i believe you need to apply for the bot badge

opal plank
#

and blood

crimson vapor
#

microservices?

opal plank
#

i dont have the bot badge, just the verified icon

earnest phoenix
opal plank
#

might wanna check 2 things if you want ideas @earnest phoenix

#

botghost(which was my only competitior) and Leviathan (which is my bot)

#

botghost is selfhosted, leviathan is free for all, just subscribe and i'll join the stream

crimson vapor
#

botghost for twitch?

opal plank
#

not the same, no

#

actually

#

no

#

its phantombot

crimson vapor
#

ah

opal plank
#

or something like that

crimson vapor
#

nightbot

earnest phoenix
#

so y'all make bots

#

so cool

opal plank
#
GitHub

Leviathan Discord AND Twitch Bot. Contribute to erwin1234777/leviathan development by creating an account on GitHub.

#

afaik those are the only 2 discord/twitch/youtube bots

crimson vapor
#

phantombot is bigbrain

opal plank
#

should probably categorise them into multi-platform bots

crimson vapor
#

actually thats smart

earnest phoenix
#

I wouldn't say so

crimson vapor
#

let people host their own

opal plank
# earnest phoenix I wouldn't say so

afaik , it is, most small bots dont have the reach to compete nor do they do much in terms of interacting with both apis, mostly its just stream services to warn someone is streaming

#

i made a point to actually get better caching and bringing new things to the api community for twitch

#

managed to beat nightbot and streamlabs in terms of latency

earnest phoenix
#

But the last update was 7 months ago, not saying that's a bad thing but I see that as outdated mostly

opal plank
opal plank
opal plank
#

the service is fully up and running on the latest api endpoint

earnest phoenix
#

Anyways sometime we should play genshin

opal plank
opal plank
twilit hemlock
#

so
if i wanna make a seperate discord collection

bot.commands = new Discord.Collection();
bot.helpcommands = new Discord.Collection();```
do i just copy and change
earnest phoenix
#

I’ll copy the message link

opal plank
opal plank
#

until twitch releases a new twitch api versioning, i doubt i'll be touching that code

#

theres too many people using it for me to deprecate it

crimson vapor
#

using what

opal plank
#

its currently on helix iirc

twilit hemlock
#

someone answer please

#

how add more collections

opal plank
#

we dont use numbers as api versioning

lyric mountain
#

collections = collections + 1

opal plank
#

at ALL

lyric mountain
#

more collections

crimson vapor
opal plank
#

trust me when i say that, you're shooting your own foot

#

it is

crimson vapor
#

doesn't look like it

opal plank
#

actually

#

no

#

its fs.readFile

#

use require() instead

#

compltely my bad

#

already a tad too buzzed

lyric mountain
#

most dbs represent animals, json.db is a wolverine

opal plank
#

actually, you cant do that directly

lyric mountain
#

it's furry

opal plank
#

wasnt there a require method for folders/

lyric mountain
#

only furry because everything else is molten lava devil