#development

1 messages · Page 2055 of 1

round cove
#

Yes.

slender thistle
#

Follow-up question:

How?

round cove
#
slender thistle
#

Suggestion:

Smooch Dylan to show gratefulness

wooden ember
#

what sort of audio streams does discord accept? cuz like i found a package that gets audio from a usb device but i can only get the samples and idk how to get that to discord

round cove
#

👨‍❤️‍💋‍👨

slender thistle
#

Yee haw

wooden ember
#

or is there just a way to convert the samples into an audio stream

rigid maple
#

When I send a request here, I get a 404 page not found error.

round cove
#

Show your request (hide the secrets obviously)

rigid maple
#

I opened it from the browser 😃

round cove
#

Why are you opening it in the browser?

#

You're supposed to make a request with it.

rigid maple
#

oh I take it

#

thanks

fervent moss
#

How do I map, this array to like a msg like
User id votes

  1. User.id#1 9
  2. User.id#2 10

Somewhat this in this above way

#

It's a object which is converted to array

boreal iron
#

you loop your array and fetch the user IDs then print it

#

the sort order seems to be right

#

use a for loop and an index to have this #place in front of the user

#

for(let i = 1; i < (array.length + 1); i++) ...

lyric mountain
#

discord is going too far

solemn latch
#

rip mod bots 👀

#

the only feature in mod bots that actually make sense is auto mod.
everything else is implemented in discord by default pretty well

boreal iron
#

which makes sense as bots should be there to interact with external sources

round cove
lyric mountain
#

given how "good" discord "features" are, I think mod bots will still have the higher ground over vanilla features

solemn latch
#

it has been in testing I presume

round cove
#

I wonder if being partner gave me that for my server for awhile 🤔

lyric mountain
fervent moss
boreal iron
#

wut

lyric mountain
#

peace ☮️✌️

boreal iron
#

I guess mark it and press TAB

#

works in like any editor I know

#

except Windows editor

#

:D

#

or shift + tab to remove one indentation

round cove
#

Xd

boreal iron
#

that doesn't include his index nr

round cove
#

It does.

fervent moss
#

Ik how to do that ;-;

boreal iron
#

lmao

#

dirty little boy, I saw that edit

round cove
#

I forgot the +1

boreal iron
round cove
#

Is that easier to read?

boreal iron
#

idk

round cove
lyric mountain
#

I wouldn't trust those \t\t without rightpad btw

boreal iron
#

it's not what he needs

#

he gotta need to fetch the user IDs

round cove
#

unless you got someone that made their discord account a few months after the app came out it should be fine

#

But the user IDs are in the arrays?

lyric mountain
#
1) User#1234    10
2) BigNameUser#5678    8
3) Normal#1111    5
solemn latch
#

oh usernames?

round cove
#

Oh lmao I thought for some reason they legit just wanted the user ID

solemn latch
#

yeah me too

boreal iron
#

not really difficult

lyric mountain
#

I suppose he wants the tag since he included #

round cove
#

user.id

solemn latch
#

I thought the # was number 1 number 2

#

I guess we just need clarification

lyric mountain
#

we need disambiguation now

boreal iron
#

are you fucking drunk

solemn latch
#

👀 not yet

boreal iron
#

that's exactly what he wants

#

which is what he wrote

lyric mountain
#

but the original request has user.id

#

and #

boreal iron
#

it also has 1) and 1)

#

not 1) and 2)

round cove
#

9 is greater than 10

boreal iron
#

quiet!

round cove
#

There's a lot to unpack here

boreal iron
lyric mountain
#

Issue closed: request not detailed enough

solemn latch
#

when will discord become github?

#

gosh

quartz kindle
#

he wants usernames or mentions?

lyric mountain
#

yes

solemn latch
#

or ids

#

or ids and tag numbers

quartz kindle
#

or nicknames

boreal iron
#

oh no, he's here

#

RUN

solemn latch
#

nobody knows

quartz kindle
#

:run:

round cove
quartz kindle
#

🏃‍♂️

boreal iron
#

sheesh nitro users

lyric mountain
quartz kindle
#

i dont have nitro anymore

lyric mountain
#

since bot support servers are quite common now

boreal iron
quartz kindle
#

now gift me money

#

:^)

lyric mountain
#

Sa-sa-@civic scroll???

quartz kindle
#

cow

civic scroll
quartz kindle
#

@civic scroll nsfw artists make loads of money yaknow?

#

just sayin :^)

round cove
#

yeah

civic scroll
#

i'm nowhere near them

boreal iron
#

im sry

#

lmfao

wheat mesa
#

Free nitro!!!!11!!

round cove
#

.ru

#

Oh wait this actually might be a scam

#

lmao

#

thought it was a meme

boreal iron
#

it says safe

#

i wanna trust it

round cove
#

safe
suspicious activity
risky
recent spam

#

Which one is it

boreal iron
lyric mountain
#

don't forget

Not parked

round cove
#

Good

boreal iron
#

i wonder what the content was, probably some shady js

round cove
#

lemmie just execute it for you

boreal iron
#

i cant the domain is blocked in my pihole

#

:D

#

too lazy to turn it off

spark flint
#

We’ve tested and even redirect followers don’t work

boreal iron
spark flint
#

Oop discord moment

boreal iron
#

pihole moment

lyric mountain
#

blocked by gravity?

boreal iron
#

yes

#

it's too heavy

spark flint
#

Not sending my image

fervent moss
boreal iron
#

good thing, yandex is also on the block list lol

round cove
#

given my tim

fervent moss
#

By

#

Lol

spark flint
#

But if you come from the clck.ru link takes you to nitro scam

fervent moss
#

Yeah i can be in multiple server right lol jk :)

boreal iron
#

hmm I mean why not, if people fall for it

spark flint
#

They do fall for it sadly

#

I’m gonna discuss a good solution for following these domains with peopel in the anti fish server

fervent moss
#

Me being noob in d.js i only know advance thing with autocode api which i won't use due to their some limits

#

But if i can help in autocode well a good

boreal iron
#

if you got a problem with your code, post it in here and ask for tips

#

make a command

#

won't be enough

spark flint
#

I’m concerned that you have the bot dev role but don’t know how to add a command kek

fervent moss
#

Ig listen to some kinda reaction add event of d.js use new date() and get Unix epooch and convert it to timestsmp

#

If that event exists

#

D.jd too has event

#

Then idk shit about python

boreal iron
#

lol I'm aware what a ping command is, lmao

wheat mesa
#

Perhaps you should try this thing called problem solving

boreal iron
#

by coding it yourself

wheat mesa
#

You won’t always have examples of people for everything

spark flint
#

Isn’t it bot.latency

#

But format it all from there

#

As it returns a float

wheat mesa
#

You have to at least think of your problem before asking “how do I make an exact replica of this function without any effort on my end?!”

#

Think about your problem, ask specific questions :p

#

There you go

#

Because you just made a function

#

To my knowledge you’re never calling the function

#

You probably want to annotate the function with like @bot.command() or whatever it is in python

#

Which is likely what maps it to respond to !ping

#

I don’t use python but every bot I’ve seen in python uses some sort of annotation like that above their commands, so that’s probably why yours isn’t working

fervent moss
wheat mesa
lyric mountain
wheat mesa
#

Lol

boreal iron
#

you had the chance to get some free java exorcism

wheat mesa
#

I find that Java annotations are annoying simply because it’s difficult to get much use out of them without using unsafe reflection

#

But when you get them figured out they’re nice metadata

fervent moss
wheat mesa
#

It might help to learn more javascript before hopping into using stuff like this, just saying

boreal iron
#

people try to move you into the right direction with examples, they don't write your code and share it for free to you

wheat mesa
#

Tim is the wizard of js, most things you get from him will be wildly efficient but also confusing if you don’t know what you’re doing

boreal iron
#

Tim is the wizard

#

yes

wheat mesa
#

Fake are you proud of me, I haven’t touched Java in like 3 weeks

lyric mountain
#

ever saw aspectj waffle?

wheat mesa
#

Nope

lyric mountain
#

it basically adds AOP to java

boreal iron
#

WITHOUT somebody pointing a gun at your head

lyric mountain
#

I use it only for measuring method execution time atm, but there are a ton of uses to it

wheat mesa
#

I’m moving on to rust now

#

Actually I guess the Java thing was a lie

boreal iron
#

i don't like it's horrible syntax

wheat mesa
#

I used it for something small a couple days ago

#

The syntax can be odd at times but I think it’s a very fair trade off for the power it provides

#

My biggest complaint is the parenthesis being optional on ifs and fors and etc

boreal iron
#

fake will ever stick with php, he's too old to learn new tricks

wheat mesa
#

Sorry for the embed idk how to get rid of it on mobile

fervent moss
#

So wat should I use for property in variable hi ?

radiant kraken
#

it's like python

wheat mesa
#

It just looks weird to me

#

I don’t like python KEKW

radiant kraken
#

you will get used to it

boreal iron
radiant kraken
#

plus it looks cleaner imo

wheat mesa
#

I’ve been getting used to rust

#

My lexer for “rlox” is now complete

#

The parser/ast is going to take a while though

radiant kraken
#

what's rlox?

wheat mesa
#

The lox specification but interpreted in rust

#

Lox is a fictional language designed in such a way that it’s relatively easy to parse and lex without too much lookahead

radiant kraken
#

what does it's syntax look like

wheat mesa
#

It’s kinda like a js clone

lyric mountain
#

RustScript?

radiant kraken
#

i'm currently thinking of rewriting my compiler from C to Rust

#

sadly idk how i would turn the AST into an executable though

wheat mesa
#

Rust has LLVM crates I believe

#

You could write it with that and get an optimized executable

radiant kraken
#

huh

wheat mesa
#

Actually wait I’m stupid

#

I haven’t actually gotten around to using LLVM but I know that you can turn an AST into optimized and JIT compiled assembly with it

radiant kraken
wheat mesa
#

420 stars

#

Nice

radiant kraken
#

don't mind if i ruin it

lyric mountain
#

bfc also doubles as Big Fuckin Code

radiant kraken
#

whooops i just realised i forgot to malloc in my c library sdForgor

split hazel
#

bro thought it was c++ and used new

round cove
#

it's 2022 if you're using new in C++ I got some news for you bro

wheat mesa
#

Smart pointer moment

split hazel
#

micro optimizers realizing smart pointers add overhead because they're runtime objects

radiant kraken
split hazel
radiant kraken
#

8008135 sdForgor

lyric mountain
#

leet moment

split hazel
quartz kindle
#

80085 or 455

split hazel
#

i asked in the rust server for advice on encryption algorithms for my database

#

i got a wall of text which requires 2 scrolls to read fully

austere surge
#

jeez

split hazel
#

im not saying you need to go outside but you need to go outside

#

this is basically me when i start talking about my os

lyric mountain
#

just noticed but...

#

new channel type?

austere surge
#

yes

split hazel
#

yeah they're forums

#

discords attempt to capitalize

#

doubt they'll replace standard and old style forums like xenforo and discourse

#

having them embedded in a chat app just feels wrong

#

with minimal control too

#

i sometimes wonder who makes these product and service ideas

#

they need to hire someone better and pay them more

#

MARK MY WORDS

#

they are eventually going to add profile walls where friends can see and comment on other peoples walls

#

mark my words

#

it will happen

austere surge
#

it will

regal lion
#

Hello guys,

My bot creates 2 channels when inserted, I realized that there should be only a button and some kind of text that should exist when a bot is invited to channel and to create channels via that button, if the channel admin wants it.

Can anyone tell me if I'm right? And should that text and button be on the default channel? If there is no default channel where should it say that? (first textable channel?)

solemn latch
#

I don't think default channels exist anymore(it was removed in 2017).
Honestly, I don't think most users like bots that send a message when its invited anyway. In my personal opinion you should wait to send that message until someone runs a command.

spark flint
#

ok smart question here

#

how can i fetch the latest X bans with DjS

#

had a server raided and I need all the user IDs

#

we have a modlog i can extract from if that helps

earnest phoenix
spark flint
#

how can you send in threads with djs

solemn latch
fathom sonnet
#

can someone explain why i getting this error on this code:

#

"Cannot access 'channel' before initialization"

pine nova
fathom sonnet
#

ahh yea could be

spark flint
#

i did manage to scrape my mod logs tho

#

then used a webhook to send to a thread

fathom sonnet
pine nova
#

💀

#

thats illegal

fathom sonnet
#

IK

#

xd

#

xd

spark flint
#

oop wrong copy paste

pine nova
#

u cant have a variable named channel if u already defined it in the callback or wtv u call it

#

prolly

spark flint
#

there

pine nova
#

💀

fathom sonnet
#

xd

#

buuuut, think is...it sends message to...dosent matter

#

i know the issue

#

now i need to figure out how to log new role name after it is updated

solemn latch
fathom sonnet
#

yep tried, but after that, when i doo ${newRole.name} i got that name is undefined

solemn latch
#

whats the specific error?

#

or it just returned undefined?

fathom sonnet
#

if i use only newRole, bot will log the messgae but it will log undefined instead of role name

solemn latch
#

name isnt undefined, newRole is
looks like you wrote your event incorrectly

#

so role = oldRole
oldRole = newRole
newRole = undefined

fathom sonnet
#

huh, now...role is undefined

solemn latch
#

yeah, you now have oldRole and newRole
role doesnt exist

fathom sonnet
#

ah yea, ur right

#

fixed it, it works, tnx so much

wheat mesa
#

breaks insta TOS, probably not a good idea to ask about that here

#

because insta does not have a public API

#

and trying to ask for help on breaking another company's TOS is against discord TOS

quartz kindle
#

im gonna make a website and make a tos that says you cant talk about anything anywhere while the website exists

#

so you're all breaking my tos just by talking

spark flint
#

lol

wheat mesa
#

that's messenger

#

not insta

boreal iron
#

Eww my gosh

wheat mesa
#

Oh my god crypto!!!1!1!! BatChest

wheat mesa
#

No they cannot

#

For good reason

#

Otherwise there would be a shit ton of Instagram dm bots

sharp geyser
#

God the horrors of that

regal lion
#

Hello guys,

My bot creates 2 channels when inserted, I realized that there should be only a button and some kind of text that should exist when a bot is invited to channel and to create channels via that button, if the channel admin wants it.

Can anyone tell me if I'm right? And should that text and button be on the default channel? If there is no default channel where should it say that? (first textable channel?)

P.S. Default channel is "General" (on start)

slender thistle
#

It's rather pointless. Perhaps you want to just show more information about the bot in its "About me" or status

#

That way users don't get unwanted messages and can see the information on demand that way

dry imp
#

damn sorry couldnt help you, i only know how to make slash commands in notepad and sublime text

slender thistle
#

Are you using any Discord API wrapper right now?

near stratus
#

is my vscode drunk rn ?

pine nova
#

💀

radiant kraken
#

that happens all the time for me

sick agate
#

.......

sick agate
#

Yeah uhh

#

If you are that new in python to don't know what you are using please don't make discord bot

#

Read python guides

#

Still :)

#

Read python guides

near stratus
#

Learn Python from here

Tutorial:
https://www.freecodecamp.org/news/tag/python/
https://docs.python.org/3/tutorial/
https://www.w3schools.com/python/
https://realpython.com/
https://www.tutorialspoint.com/python/
https://www.programiz.com/python-programming
https://github.com/TheAlgorithms/Python
https://python.land/python-tutorial
https://www.techbeamers.com/python-tutorial-step-by-step/
https://www.fullstackpython.com/
https://www.linuxjournal.com/article/3946
https://pythonspeed.com/performance/

Interactive tutorial:
https://www.codecademy.com/catalog
https://www.learnpython.org/
https://exercism.org/
https://www.sololearn.com/learning/1073
https://www.datacamp.com/learn/python
https://www.kaggle.com/learn/python

Course:
https://www.coursera.org/
https://www.udemy.com/topic/python/
https://www.udacity.com/
https://youtube.com/

Practice:
https://www.hackerrank.com/
https://leetcode.com/
https://codeforces.com/
https://www.topcoder.com/
https://www.codingame.com/
https://www.coderbyte.com/
https://www.codewars.com/

Videos:
https://youtu.be/rfscVS0vtbw
https://youtu.be/HGOBQPFzWKo
https://youtu.be/kqtD5dpn9C8

Books:
Python Crash Course
Head-First Python
Automate the Boring Stuff with Python
Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow
Programming Python: Powerful Object-Oriented Programming
Learn to Code by Solving Problems: A Python Programming Primer
Python from the Very Beginning
Leaving the Rat Race with Python: An Insider's Guide to Freelance Developing

Forums, Discussion:
https://stackoverflow.com/questions/tagged/python
https://www.reddit.com/r/Python/
https://python-forum.io/
https://discord.gg/dbl
https://discord.gg/python

civic scroll
#

no codewars?

pine nova
#

💀

rose warren
fossil bronze
#

Hmm analyzing JS memory dumps is kinda hard.

quartz kindle
#

what are you trying to analyze

fossil bronze
#

Well basically I have a memory leak in my bot. Memory used grows over time

#

After about 1 day it has grown over double

quartz kindle
#

discord.js?

fossil bronze
#

Ye

quartz kindle
#

thats just discord.js being discord.js

fossil bronze
#

I have two heap snapshots, one from fresh start and one from about 24h of running

fossil bronze
#

Does everyone just accept this?

quartz kindle
#

how many guilds and how much ram at start and and end?

fossil bronze
#

1910 guilds, 300MB ish at start and this after 24h heap snapshot is 865MB

quartz kindle
#

does your bot do music?

fossil bronze
#

No

quartz kindle
#

show prints of the snapshots

fossil bronze
#

It does a card game type thing, with sequelize/SQlite, Canvas for graphics, ffmpeg for gifs

quartz kindle
#

do you have an eval command?

fossil bronze
#

Oh nono

#

Here is the deltas it seems to be arrays of strings mostly

quartz kindle
#

hmm thats a bit unusual for djs, can you expand those arrays?

fossil bronze
#

lots of the same strings like this

#

Think thats a server name

#

Well there's 2M something arrays

quartz kindle
#

which version of djs?

fossil bronze
#

13.7.0

#

I used some version from 2020 for a long time, it also had this problem

quartz kindle
#

well, the memory usage seems a little more than just djs itself would do, but djs is still probably playing a major role in there

#

have you configured any of the djs cache options?

fossil bronze
#

I have not

#

I did not know of those haha

lyric mountain
#

since the strings are all equal, shouldn't js treat them like a single reference anyway?

quartz kindle
#

these are what i use on mine basically

#
const client = new Discord.Client({
    // default caching options, feel free to copy and modify. more info on caching options below.
    makeCache: Discord.Options.cacheWithLimits({
        ApplicationCommandManager: 0, // guild.commands
        BaseGuildEmojiManager: 0, // guild.emojis
        ChannelManager: 0, // client.channels
        GuildChannelManager: 0, // guild.channels
        GuildBanManager: 0, // guild.bans
        GuildInviteManager: 0, // guild.invites
        GuildManager: Infinity, // client.guilds
        GuildMemberManager: 0, // guild.members
        GuildStickerManager: 0, // guild.stickers
        GuildScheduledEventManager: 0, // guild.scheduledEvents
        MessageManager: 0, // channel.messages
        PermissionOverwriteManager: 0, // channel.permissionOverwrites
        PresenceManager: 0, // guild.presences
        ReactionManager: 0, // message.reactions
        ReactionUserManager: 0, // reaction.users
        RoleManager: 0, // guild.roles
        StageInstanceManager: 0, // guild.stageInstances
        ThreadManager: 0, // channel.threads
        ThreadMemberManager: 0, // threadchannel.members
        UserManager: 0, // client.users
        VoiceStateManager: 0 // guild.voiceStates
    }),
    intents: [ /* your intents here */ ],
});
#

0 means cache is completely disabled

fossil bronze
quartz kindle
#

Infinity (or remove the entry) means the cache is enabled

fossil bronze
#

oooo neat

quartz kindle
#

you will need to tweak that for your needs

#

for example if you need permissions and stuff, you need to enable roles and stuff

fossil bronze
#

looks like something like 30% of the arrays are empty

#

There are also many arrays like this

quartz kindle
#

those are normal

fossil bronze
#

I really wish there was some way to group the arrays/strings by content

earnest phoenix
#

Thank you

lyric mountain
#

just noticed the context

fossil bronze
#

hehe

quartz kindle
#

kweeb

fossil bronze
#

I guess i'll just keep using forever, but thanks to everyone that tried to help

quartz kindle
#

also, an eval command would help you debug these kind of issues, for example running process.memoryUsage() can give you further insights

fossil bronze
#

As for the "containment" tab when looking at the memory dumps, There's thousands of CompiledFnEntry

#

Nothing else takes up much space

#

Makes me think its this unfixxed node bug maybe

quartz kindle
#

you dont use vm tho, do you?

fossil bronze
#

I do not but it's CompiledFnEntry

#

Some dependancy is likely to

#

Oh I did require vm at some point

#

But not use it

quartz kindle
#

hmm

#

well try the djs caching options and see how it goes

fossil bronze
#

Ye I am thanks for that c:

#

Isnt this weird

quartz kindle
#

thats probably rss

#

which can be two things: c++ memory that js cant see (sqlite, canvas, ffmpeg) or memory fragmentation by the system allocator

fossil bronze
#

Ah...ha..

#

This is unfortunate, seems it has grown more

idle coral
#

Hey I'm having a tiny bit of issues.

#

My source code:

#
  import requests
  @command(aliases=["crypto", "stonks"], description="Provides data, indexes, analysis and insight on the cryptographic asset marketplace.")
  async def crypto_stonks(cls, ctxself, ctx):
    url = "https://bravenewcoin.p.rapidapi.com/ohlcv"
    querystring = {"size":"10"}
    headers = {
      "Authorization": "Bearer <append token here>",
      "X-RapidAPI-Key": "SIGN-UP-FOR-KEY",
      "X-RapidAPI-Host": "bravenewcoin.p.rapidapi.com"
    }
    response = requests.request("GET", url, 
    headers=headers, params=querystring)
    await ctx.channel.trigger_typing()
    await ctx.send(response.text)
#

My self error detecting system said this:

#

Ignoring exception in command <discord.ext.commands.core.Command object at 0x7fa4e16b36d0> at AstraBots.xyz Member: Real_IceyDev#3339 Message: ctx is a required argument that is missing.

lyric mountain
#

wherever it's calling that command, it's supplying 2 arguments but you require 3

#

where do u call the command?

idle coral
#

That's how I learned py.

#

So I don't know what calling the command means, so if u could dumb it down for me...

lyric mountain
#

crypto_stonk(some, thing)

#

and what you did wasn't learning but copypasting

idle coral
#

I originally did yes, copy and paste.

#

But I do now type code myself.

#

Yet when I do, I always make a mistake, and screw it up.

idle coral
lyric mountain
lyric mountain
idle coral
#

I still have a while to go, deciding what I want to do with my life. Only 14.

lyric mountain
#

I didn't mention py tho

#

like, you might know how to write, but there are valuable knowledge regarding programming itself that you need to have to be able to progress as a programmer

#

not necessarily learning through courses, you can do some tutorials, read some books, delve into documentations, you call it

ancient nova
#

can you send a message to a user based on their ID only?

#

I know you can message them from the guild or channel endpoint

#

I wonder if you can do it by user ID only

#

it should right?

wheat mesa
#

I believe you'd have to fetch the user object with their ID

ancient nova
#
client.users.cache.get('<id>').send('<message>');
``` like this?
wheat mesa
#

No

#

That's cache

#

Fetch

ancient nova
#
client.users.fetch('<id>').send('<message>');
``` this?
wheat mesa
#

Yes

#

fetch returns a promise though, you need to await it first

ancient nova
#

great

#

my bot still crashes after updating to v13.7

#

^ if my bot gets added to a guild

earnest phoenix
ancient nova
#

I changed the package.json file's discord version to ^13.7 it and ran npm i it should've at least fixed the guild fetching bug didn't it

wheat mesa
#

why not use npm to update it

near stratus
#

npm i discord.js@13.8

lyric mountain
#

discovered railgun operator is a thing (not called like that but fck it, it looks like a railgun)

wheat mesa
#

lol

quartz kindle
#

=?

#

cant understand that font style

lyric mountain
#

ye

#

same as bits = bits >> n, which is kinda useful ngl

#

careful with dm commands

quartz kindle
#

get the user id from the mention, create a new dm channel with that user, send message to that user

#

then you did it wrong

lyric mountain
#

it's against tos unless the receiver opts-in to receive DM messages from anyone

#

you still need to add an opt-out feature

#

allow people to choose not to receive dms

quartz kindle
#

any error?

lyric mountain
#

look at the last 2 characters

#

``

#

that's a syntax error

quartz kindle
#

when you show errors you have to show the full error including all lines

#

but yes, remove that

#

thats your full code or only that command?

#

any error?

#

then thats why

#

if you have errors just say so, no need to wait until someone asks if you have one

#

make_embed does not exist

#

it should be discord.Embed

#

again... errors?

#

did you login with bot or with client?

#

no

ancient nova
#
(Use `node --trace-deprecation ...` to show where the warning was created)```
quartz kindle
#

where you login

ancient nova
#

what is this?

proven lantern
#

what type of license should i add to my bot if i open source it? i want people to be able to make their own clones, but not be able to sell it or derived stuff

quartz kindle
#

where you do .run()

#

so you logged in with client

#

but you defined the command with bot

#

yes

ancient nova
#
(Use `node --trace-deprecation ...` to show where the warning was created)``` wut is this
#

I never passed a string to setAuthor I don't even use that

#

I use setTitle

quartz kindle
#

again... any errors? also discord.Embed has a capital E

ancient nova
#

hello?

fathom sonnet
#

question: How can i solve this Error:

const { QueryType } = require('discord-player')
lyric mountain
#

you want to clone my bot? sure

just dont try to sell it or make it closed source

quartz kindle
#

GPL doesnt protect from server usage tho, which is covered only by AGPL

lyric mountain
#

server usage?

quartz kindle
#

ie buiding a webservice and selling subscriptions/access

ancient nova
#

can anyone tell me where tf that deprecation warning came from pelase

quartz kindle
ancient nova
#

I can't, once I start the bot I can't use the CLI

proven lantern
lyric mountain
#

LICENSE.md

#

then add a header on all your files

proven lantern
#

noice

#

thanks

lyric mountain
#

like this

#

if ur using jetbrains IDEs they have an auto-notice feature where it adds those headers automatically

ancient nova
#

still nothing

proven lantern
#

thanks!

proven lantern
quartz kindle
#

basically yeah

#

GPL only protects code that is distributed to clients

#

doesnt protect code that says in servers

wheat mesa
#

So if anyone here is good with physics (my knowledge is... not amazing), I'm not quite sure why but for some reason the velocity here keeps increasing, when it should go down, and bounce up to the same exact spot it was at, right? ```rs
fn update(&mut self, dt: f32) {
self.position = calc_position(&self.velocity, &self.position, dt);
self.velocity = calc_velocity(&self.velocity, &Acceleration::new(0.0, 350.0), dt);
self.check_collision(self.collide.clone());
}
// Different file
#[inline]
pub fn calc_position(velocity: &Velocity, position: &Point, dt: f32) -> Point {
Point::new(
(position.x as f32 + velocity.x * dt) as i32,
(position.y as f32 + velocity.y * dt) as i32,
)
}

#[inline]
pub fn calc_velocity(velocity: &Velocity, a: &Acceleration, dt: f32) -> Velocity {
Velocity::new(velocity.x + a.x * dt, velocity.y + a.y * dt)
}

proven lantern
#

good thing my frontend and backend codebases are separate

wheat mesa
#

(All my check_collision function does is reverse the velocity vector when it detects a collision in the bounding box)

proven lantern
#

is this for unreal engine?

wheat mesa
#

No

#

This is just SDL2 with Rust

#

My own engine I guess you could call it

proven lantern
#

nice

#

could it be int overflow?

wheat mesa
#

No

#

The values are way too small for that

proven lantern
#

is there deceleration applied ever?

wheat mesa
#

No but in theory this should be a perfectly elastic collision

#

Since the sign change of the velocity and the acceleration should cancel each other out at the same spot it started at

proven lantern
#

if there is gravity, but only when you fall then that will happen

wheat mesa
#

It's not meant to be an accurate simulation yet, it's just meant to have a perfectly elastic collision where all kinetic energy is preserved

proven lantern
#

actually i see it slow down a bit

lyric mountain
#

that means u should only use it when u want to preserve your work as open-source

#

so by no means use it for libraries or other linkable code

proven lantern
lyric mountain
#

like, my bot is licensed under gpl because I do not want people to make it closed source

proven lantern
#

if i wanted to make it closed source or sell it later can i still do that?

quartz kindle
#

you can dual license

#

GPL for free version, professional license for paid version

pine nova
#

💀

lyric mountain
#

but previous versions wont be affected by the new license

proven lantern
fathom sonnet
fathom sonnet
#

i think i got iždea on how to fix it

ancient nova
#

what's the most unique bot a person can come up with?

wheat mesa
#

A bot that nobody here can come up with except for you because then it wouldn’t be unique

solemn latch
#

Refresh tokens don't expire right?
Only if the user deauthorizes

lyric mountain
#

no idea

#

but I never saw discord logging out after a long period without entering

#

so I guess they don't

solemn latch
#

Discord only provides an expiration for access tokens, so I guess it doesn't expire refresh tokens.

lyric mountain
#

that's what I'm saying

#

if they did expire, discord (browser) would log u out after a long period without accessing the site

solemn latch
#

Yeah thanks. Just needed a sanity check

split hazel
#

can someone do me a favour and open up a node.js repl in their computer and run this

const s = Date.now();
crypto.createDiffieHellman(2048, 2);
Date.now() - s
#

its taking a very long time to generate a 2048 bit RSA key on my laptop

#

like 30 seconds

eternal osprey
#

hey guys, does anyone know or have json data that contains countries and their 2 letter code?

#

like {"australia" : "ac}

split hazel
#

actually its sped up to 10 seconds so its probably because of a cold start but still 10 seconds is quite long

woeful pike
split hazel
#

💀

woeful pike
#

oh no I see it's taking a long ass time for me too now

#

about 10 seconds yeah

split hazel
#

its very odd

#

its a standard 2048 RSA key it should take around 1-2 seconds

woeful pike
#

craaaawling iiiiin my skiiiin

#

node.js moment

split hazel
#

hm could it be because its using the operating systems entropy (dev/random) and thats why its slow?

#

a key with a length of 1024 is very quick to generate

woeful pike
#

I can't imagine why the timings would vary to this degree

wheat mesa
#

Probably node stuff, you’d probably need an actual benchmarking environment for accurate results

#

Running two identical loops one after another gave me drastically different results in node

woeful pike
#

yeah but those often vary to the scale of microseconds

split hazel
#

i tried generating it in a c++ program with openssl and its taking a similar amount of time so i dont think its isolated to node

#

and node uses openssl so it adds up

woeful pike
#

I was just about to test it there

split hazel
#

i'll probably use an algorithm thats faster and more secure soon

#

but if the generation was really that slow we'd prob be waiting that long for a website to load

woeful pike
#

how are you generating it in openssl?

#

openssl genrsa 2048 takes <0.3s for me

#

though I don't think that's the right command

split hazel
#

thats something else

#

im doing it in c

#

but yeah it doesnt seem the rsa algorithm is fucked

#

but rather the implementation of the diffie hellman in openssl

lyric mountain
#

Or this

ancient nova
#

can you give me an idea : )

#

though any command you can think of I probably made

solemn latch
#

tbh, so many unique bot ideas come through developer channels but no one notices it could be a bot.

wheat mesa
#

True

#

Some ideas are just too ambitious though

#

Gotta have a good balance between feasibility and usefulness

#

Personally I barely use bots other than maybe esmbot once in a while (which btw was a fantastic bot idea, it’s just kind of unreliable sometimes)

solemn latch
#

I also don't really use bots.

eternal shoal
#

@solemn latch Hello goodnight! My bot was rejected because it is offline but it was due to a quick host drop, it is already online. How do I do now? Do I have to resubmit and wait up to 2 weeks?

quartz kindle
eternal shoal
#

Ok

radiant kraken
wheat mesa
#

I had a bad design and I was cloning simply because I was lazy and didn't want to fix it, just wanted to get the math working first

#

I got the math working now

wheat mesa
#

In reality all the collision checks are going to be done in the main loop where I can keep track of all of the objects being rendered and their positions

feral aspen
green kestrel
#

hmm, might be moving to "large bot" sharding by next week

#

im only 450 servers away

split hazel
#

@radiant kraken c devs have humor?

radiant kraken
vivid fulcrum
#

god complex haven

split hazel
#

hes the kind of guy to not use references and copy everything when passing to functions

green kestrel
#

just added shards, decided to stay with 18 clusters

split hazel
#

that dashboard is so sweaty

green kestrel
#

sweaty? lol

split hazel
#

very op

green kestrel
#

next addition of shards is at 300,000 guilds

#

somehow i doubt i'll reach that for many years

#

but time will tell - discord's app directory rolls out soon

rose warren
#

I'm personally not expecting much from the app directory

#

If it's anything like server discovery I don't expect to see much from it

fathom sonnet
#

You could make compiler maybe

dry imp
#

who read news

fathom sonnet
dry imp
#

oh shit i am not people 😱

vivid fulcrum
#

news bots are practically useless

#

nobody goes on discord for their news

#

apple and google already do a good job at providing you with news with a swipe

#

i can see it being useful if you're targeting a specific blog though

spark flint
#

maybe a bot that lets you listen to an RSS feed

vivid fulcrum
#

this

#

before creating a bot you need to know which audience you're targeting if you want success

feral aspen
vivid fulcrum
#

then proceed to analyze your competition, what are pros and cons of your product and how you can win over the audience from your competitors

#

this is the reason why 90% of generic bots end up in failure, "a bot for everyone" just means you don't know which audience you want to target

#

rythm was insanely successful because they focused on music only

#

they took what their competitors had (dyno and mee6 mostly) and improved it by a margin

#

people fail to understand that successful bots are a business and should be treated as such

#

learned from my own mistakes 🥲 👍

vivid fulcrum
#

you can implement them in various ways

#

usually a cluster is n amount of shards in one process

#

this improves performance by a tremendous amount because, let's say instead of one process processing gateway events from 25 connections, you can split it into one process per 5 connections

green kestrel
#

and I continue to incrementally improve

#

now I'm ahead gotta stay ahead

#

speaking of

#

update to latest dpp is looking great

#

per cluster CPU usage has halved

vivid fulcrum
#

damn that's nice, did you make a full switch to your own lib?

#

oh also, im super interested in how you handle caching on such a large scale

green kestrel
#

I switched a year ago, this was a major version upgrade

#

I cache guilds, roles, channels in ram, users, membership in SQL

#

and synchronise roles, guilds and channels to SQL in real time one way for use by the dashboard

#

the bot relies on the "resolved" users and guild members from the slash command to cut down on need for cache

#

until today I was stuck on DPP 9

#

which uses api v9 and doesn't have some threading optimisations

#

7 months behind lol

#

but I had such good uptime didn't want to update till I had to

vivid fulcrum
#

interesting approach with sql, is it an in-memory storage or is it traditional?

#

im guessing by offloading to sql you don't experience bottlenecks either

#

i might mock a huge amount of entities to simulate stress an actual bot would experience just to see how far i can get with optimization

#

never got the chance to play around with optimizing large projects like that

green kestrel
#

stuff that I don't mind if it gets wiped when the server reboots, is memory tables

#

like some command rate limits

#

and i did get some bottlenecks

#

each cluster only had two sql connections back in the old days, and they had to execute syncronously, so the sql thread would be the bottleneck... newer versions have a threadpool of sql connections, and round robin requests amongst the threads that arent busy as queries come in

#

within reason, its faster, but theres a limit to how many idle threads you can spawn, as mysql has limits on number of concurrent connections, normally 60-something, i had to raise it

#

i host my own mysql instance, here are the stats

#

startup was 490 days ago

#

so thats 2.4 billion queries per 1.2 years

split hazel
#

isnt innodb obsolete

#

oh thats myisam

green kestrel
#

yeah myisam is a joke lol

split hazel
#

does phpmyadmin scream at you for anything?

#

the warnings

green kestrel
#

nope

#

i tuned the server lol

split hazel
#

when i still ran the bot phpmyadmin would be full of warnings lol

#

im not an expert at tuning mysql

green kestrel
#

what kind of warnings?

split hazel
#

i forgot i'll try find them i think i posted them somewhere

#

i know one of them were connections that werent closed properly because the clusters crashed often because of a poor choice to use a clustering solution that was no longer maintained

#

@quartz kindle you know which one im talking about

#

i think another one was that tables keep being reopened which costs io

#

it advised to increase cache or something and i did but it didnt seem to fix it

green kestrel
#

nice, nearly 6tb

split hazel
#

80 days? rookie numbers i had one run for a year

green kestrel
#

it auto updates

#

you mean you ran one for a year and didnt apply security patches to it? kekeke

split hazel
#

wont lie i usually leave things running and rarely update them

#

well if an update pops up on sudo apt update then yeah but thats about it

green kestrel
#

you should run unattended-upgrades

wooden ember
#

bruh i got a voip server that been running fedora 8 for the last 15 years

split hazel
#

if there is a security vulnerability burning through the news then i'll probably go out of my way to update

green kestrel
#

it does important non-breaking security upgrades for you

split hazel
#

never knew that existed

green kestrel
#

you do now 🙂

wooden ember
#

that is actually pretty cool

green kestrel
#

it wont reboot for kernel upgrades tho

#

it will email you and you have to do that yourself

#

i mean its not windows kekeke

split hazel
#

email? 😂

wooden ember
#

also anyone know how to make node project run at boot? used to have everything working fine on centos through cron but now the shell script runs but never starts the projects

split hazel
#

god i forget how old some technology is

green kestrel
#

when you log in, it'll go ' you have mail'

#

even if you arent running an smtp daemon iirc this works

wooden ember
wheat mesa
#

Yes

wooden ember
#

bruh

#

i just want to know why i cant get it to run from a shell script

wheat mesa
#

Not exactly easy to run something on startup without fucking around with settings, pm2 takes like 5 minutes to set up

green kestrel
#

add an @reboot line to crontab

wooden ember
#

did that

#

the shell script runs cuz it beeps the bios speaker

#

but there are no screen sessions started

green kestrel
#

imagine having a bios speaker

wheat mesa
#

Well if you ever can’t figure that out (I have never used crontab), pm2 is a really easy option for running node projects

green kestrel
#

when is this, 1983?

wooden ember
#

i mean i like having a bios buzzer

#

cuz its usefull

#

means i know boot is successful and i can also beep it from shell scripts too so i know their status without having a monitor attached

green kestrel
#

if you got something that has gpio pins like an ardruino or an rpi, you can plug a buzzer to the pins

#

or a piezo speaker

#

and then control that from software

#

😄

wooden ember
#

why would i do that?

quartz kindle
#

install jarvis

wooden ember
#

is there really no way to get it just to run from the shell script?

#

it works if i run it manually but just never starts the screen sessions when run from chron

#

i just want to keep things simple

quartz kindle
#

add it as a service on systemd?

green kestrel
#

if you want to start screen from cron do this

#

@reboot cd /path/to/bot && screen -dmS botname ./startbot.sh

#

-S names the session so you can attach it later with botname as the name

#

-dm runs it detached

#

i start my entire bot that way and all its helper processes

wheat mesa
wooden ember
#

the original reason behind the shell script was to make it halt untill there was network

#

but now im using ubuntu it just doesnt boot untol there is network i think

#

I'll try putting the command directly in the cron file

#

and see if that works

green kestrel
#

heres part of my crontab

#
# Start bot clusters on reboot
@reboot         cd /home/trivia/triviabot && ./start.sh

# Queue processes, started on reboot
@reboot         cd /var/www/vhosts/triviabot.co.uk && screen -dmS rolequeue /usr/bin/php rolequeue.php
@reboot         cd /var/www/vhosts/triviabot.co.uk && screen -dmS dmqueue /usr/bin/php dmqueue.php
@reboot         cd /var/www/vhosts/triviabot.co.uk && screen -dmS premium-role /usr/bin/php premium-role.php
@reboot         cd /var/www/vhosts/triviabot.co.uk && screen -dmS translation /usr/bin/php translatedb.php
@reboot         cd /var/www/vhosts/triviabot.co.uk && screen -dmS welcome /usr/bin/php welcome.php
#

the php scripts do background dashboard stuff

#

or long running batch things i dont want in the bot process

#

like, assigning the role to premium subscribers on my support server when they join

wooden ember
#

mmm interesting

#

didnt think you could put /path/to/whatever/ into screen

green kestrel
#

you can if you put cd on the start

#

its just passed to sh after all

#

threres a cd command first, then && to tell it to only run screen if cd succeeds

wooden ember
#

fair enough

green kestrel
#

also crontab MAY run these tasks asyncronously

#

theres no guarantee that the third entry you put in crontab runs after the second if they both have the same start time or are all @reboot

wooden ember
#

its async

green kestrel
#

this is why my bot boots via a scrip called start.sh

split hazel
#

would be a shame if someone made a request to /vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php

wooden ember
#

on my other server i use sleep 10 && command or somthing to order them

green kestrel
#

this way i can be sure that clusters and shards start syncronously

green kestrel
#

you nit

split hazel
#

someone tried running that exploit on my server while i was testing a website in dev mode so it popped up in logs

green kestrel
#

😄

#

hmmmm

split hazel
#

looked like an automatic bot

green kestrel
#

i might make a file on that path now

#

i love making honeypots like that

split hazel
#

it tried a bunch of different exploits

#

such as also accessing .dsstore

green kestrel
#

will make a file in that exact location, and put in it echo "bzzt wrong answer fool" 😄

split hazel
#

thats a nice easter egg

green kestrel
#

i used to do that sort of thing all the time

#

actually, bad idea irl

#

because it causes issues with PCI scans

#

they dont see the funny side

#

"it answered! YOURE VULNERABLE!"

wooden ember
#

or however the jurasic park thing went

wooden ember
#

there we go

split hazel
#

i also constantly see bots scanning random ips to index the web or whatever

#

thinking about it such a bot isnt too difficult

#

ipv4 only has about 4 billion combinations

#

you can scour every ip in not a very long time

green kestrel
#

these days sure

split hazel
#

ipv6 is still in its infancy and not many people use it

wheat mesa
#

eh, that's a LOT of data to scour over

green kestrel
#

especially as there are lists of null routed subnets, some really large, that you can exclude from the scan

split hazel
#

that is if your ISP even supports it

green kestrel
#

used to be that scannin the whole ipv4 space was impossible because peoples internet was too slow

#

not any more

wheat mesa
#

my ISP didn't even give me a public ipv4

#

Defaults to ipv6 only

green kestrel
#

ipv6 only?

wheat mesa
#

Yeah

green kestrel
#

thats futuristic

wheat mesa
#

It's unfortunate, not futuristic

green kestrel
#

we cant even get our isp to give us an ipv6 tunnel, had to get one from tunnelbroker

wheat mesa
#

I can't host a minecraft server because it doesn't support ipv6 :C

green kestrel
#

that sucks, fix minecraft

#

ipv6 is the future

wheat mesa
#

lol

#

they'll change it eventually

green kestrel
#

discord should support v6 too

rustic nova
#

thing is, most services still rely on ipv4 KEKW

green kestrel
#

they dont atm

split hazel
wheat mesa
#

most things allow you to connect with an ipv6 connection but some services don't allow you to host things on ipv6

#

namely minecraft

wooden ember
#

takes about 30 minutes to scan the entire web

#

he logs mc servers

rustic nova
#

though iirc from my workplace, isnt there a arpa thing or smth to translate ipv6 into a domain that then allows connecting?

split hazel
#

yeah really doesnt take long and its a little worrying

green kestrel
#

reverse dns?

rustic nova
#

lemme find it, I somewhat remember something like that

#

or was a local microsoft thing

#

yeah reverse dns

#

ip6.arpa

wheat mesa
#

someone showed me vcpkg last night, my god I'm in love with it

wooden ember
green kestrel
#

vcpkg isnt the best

#

its just "ok"

wheat mesa
#

it's much better than compiling a 13 year old C library in VS22

wooden ember
#

there are people that try to spam my voip server with numbers trying to get free calls but the never get through

wheat mesa
#

the commits for that lib

#

lmao

rustic nova
#

lmaoo

wheat mesa
#

I had to modify the source code for it to compile

#

Basically just commented out 15 lines that were causing naming conflicts

#

Got lucky that nothing depended on that code

green kestrel
#

which lib

wheat mesa
#

Then I compiled it, but it didn't work with rust because I had only compiled for x86 and not x64

#

SDL_gfx

#

So after that 2 hour headache, I just used vcpkg to compile and build the 64 bit version automatically and it took me literally 5 minutes

#

Time to refactor my physics engine to actually be structured properly now that I know my math works

green kestrel
#

when you gonna make a C++ discord bot with DPP, waffle? 😄

wheat mesa
#

I actually made a tiny bot with DPP, couldn't manage to get it compiled for my VPS and didn't really have a use for it, so I just trashed it pretty much

#

But I've turned away from the DAPI unless I get a really good idea

split hazel
#

i need to properly get back to discord bot dev

wheat mesa
#

Currently I'm doing a physics engine with rust and sdl2

split hazel
#

probably not make my own thats too much work but join someone elses team

wheat mesa
#

discord bots are pretty easy to make tbh

split hazel
#

managing it at scale tho

#

takes some time

wheat mesa
#

going back to ts after doing low level stuff feels like a breeze

split hazel
#

its amazing how many bugs crop up at scale you otherwise would never see in a dev build

wheat mesa
#

hmmmm... how would I structure this properly, seems scuffed to enforce get_position and such, but I'm going to need to detect all collisions in the main loop

#
pub trait Renderable {
    fn render(&self, canvas: &mut Canvas<Window>) -> Result<(), String>;
    fn update(&mut self, dt: f32) -> Result<(), String>;
    fn get_position(&self) -> Position;
    fn get_width(&self) -> u32;
    fn get_height(&self) -> u32;
}
#

I think I need to store them differently instead of a boxed trait ```rs
pub struct Simulator<'a> {
width: u32,
height: u32,
fps: u32,
components: Vec<Box<dyn Renderable>>,
ctx: &'a Sdl,
canvas: Canvas<Window>,
}

split hazel
#

just want to share something here about my workplace

#

so i work in a supermarket right and the server room is in the management office but the thing is the door to the server room is always open and the room is positioned away from everyone in the office and its not unusual to walk into the office as a normal employee

#

i can literally go in there unplug a single usb or plug something in and bring the entire store down

#

now if that isnt negligence

wheat mesa
#

imagine having a workplace

split hazel
#

rust programmers dont work

wheat mesa
#

I'm trying to compensate for not having a job by learning as much as I can over my summer break

green kestrel
#

ive yet to meet someone employed as a rust dev

#

in an actual real job, for a company

wheat mesa
#

Also I think I've devised a solution ```rs
struct GameObject<T: Renderable + ?Sized> {
object: Box<T>,
properties: SomePropertiesStruct
}

struct Simulator {
// props
objects: Vec<GameObject<dyn Renderable>>
}

green kestrel
#

i heard discord has some

wheat mesa
#

I've seen a lot of rust stuff on linkedin and indeed and stuff like that

green kestrel
#

but theyre expected to know python and elixir too

wheat mesa
#

By the time I graduate college there's gonna be a lot more rust jobs available most likely

green kestrel
#

i start a new job in 2 weeks

wheat mesa
#

Still have 5 years until I graduate college though, plenty of time to master rust

green kestrel
#

if youre lucky, rust will have matured by then, and wont suffer the fate of other 'trendy upstarts' like ruby

#

abandoned for the next hot thing

wheat mesa
#

I think rust is going to overtake many new projects over C/C++

green kestrel
#

it depends

#

i think its viable for new projects

wheat mesa
#

It'll never replace c or c++, but it'll certainly become favored over them for some projects

split hazel
#

they're too busy in the rust server telling people what they just coded is bad practice or unsafe

green kestrel
#

but rust has an awful lerning curve for newcomers

wheat mesa
#

I started rust about 2 weeks ago

green kestrel
#

it means its userbase is going to be smaller

wheat mesa
#

It's not too difficult so far, there's just some stuff you have to think about differently

green kestrel
#

you can become a mediocre C++ programmer in a year or so, and increment your skills over time

#

rust doesnt allow for the concept of a mediocre coder

#

you have to be an expert or the compiler spits you out

wheat mesa
#

Rust is sorta like "do it right or don't do it at all"

green kestrel
#

problem is, people dont start out as experts 😄

wheat mesa
#

I'm still a beginner and I made a little recursive descent parser and interpreter for math expressions in rust, I think it's pretty intuitive as long as you have previous experience

#

You certainly would NOT want rust as your first language though

#

That'll be guaranteed to burn you out

#

And the rust community server has been extremely helpful and friendly in the process

#

They're surprisingly active in there

split hazel
#

too friendly and active

#

just dont dwell down to the more specialized areas of the server

#

thats where it stops

wheat mesa
#

totally not me in the games and graphics channel

split hazel
#

im more recently vibing in the cryptography channel

#

i dont use rust anymore but the advice there is still helpful

wheat mesa
#

fuck I forgot that my renderables need to have access to their own properties

#

time to rethink again

#

I could change my trait to give the properties to the update and render functions I guess

#

but that sounds like it'll run into borrow checker issues

#

oh wait

sage bobcat
#

One message removed from a suspended account.

wheat mesa
#

I think I could do something like ```rs
pub struct GameObject<T> {
object: Box<T>,
properties: GameObjectProperties
}

impl Renderable for GameObject<ComponentName> {
// stuff
}

#

Oh yeah that would totally work if I can get the vector to work

split hazel
#

worst things to happen

  1. red text on a terminal
  2. poop splash
wheat mesa
#

we do a little traiting ```rs
pub struct Simulator<'a> {
width: u32,
height: u32,
fps: u32,
components: Vec<Box<dyn GameObject>>,
ctx: &'a Sdl,
canvas: Canvas<Window>,
}

trait GameObjectProperties {
fn properties(&self) -> &GameObjectData;
fn properties_mut(&self) -> &mut GameObjectData;
}

trait GameObject: GameObjectProperties + Renderable {}

struct GameObjectData {
center: Position,
width: u32,
height: u32,
}

impl<T> GameObject for T where T: GameObjectProperties + Renderable {}

impl GameObjectProperties for HollowBox {
fn properties(&self) -> &GameObjectData {
todo!()
}

fn properties_mut(&self) -> &mut GameObjectData {
    todo!()
}

}

#

I think this is going to work

quartz kindle
#

its going to work if you rename all your stuff to Gayme instead of Game

vivid fulcrum
#

is that rust

#

i keep on saying I'll learn it but never get to it

#

right now it looks like cpp but gibberish to me 🥲

wheat mesa
#

yeah that's rust

#

it's actually pretty nice, I just think that the trait GameObject: GameObjectProperties + Renderable is annoying, because I have to do two impl blocks for each of those traits instead of just being able to do ```rs
impl GameObject for SomeComponent {
// Force you to implement Renderable and GameObjectProperties functions
}

// INSTEAD I have to do
impl Renderable for SomeComponent {
// ...
}

impl GameObjectProperties for SomeComponent {
// ...
}

fathom sonnet
#

Quick Question: So I have string option in my slash command which is used to enter url of the song you want to bot to play.

my question is: can I check if the content inside dosent start with an youtube url, bcz bot is playing music from the youtube?

I tought that I could do something like: ```js

const url = interaction.options.getString("url")

if(!url.startsWith("https://youtube.com/")) {
interaction.reply("You need to provide valid YT URL in order to play the music")
}
els {
// Do Something Else
}

ivory dove
#

How can I setup a vote webhook in my bot?

split hazel
#

music bot in 2022: 💀

wooden ember
#

bruh i just made my bot play sound comming fromt he mic jack of my server

#

music time

quartz kindle
#

discord live radio station

wooden ember
#

indeed

#

trying to get my software defined radio to go over discord but there isnt any way to get the audio directly from what i can work out

#

but i can get it to play from the radio out the headphone jack and then i can plug that into the mic jack

#

and that works

#

i know its a bit of a redneck solution but it works

wheat mesa
wooden ember
#

something like thisif (url.match(/^(https?:\/\/)?(www\.)?(m\.)?(youtube\.com|youtu\.?be)\/.+$/gi))

wheat mesa
#

As much as I hate regex, this is definitely a valid use for it

wheat mesa
#

Mine was if(url.match('^(http(s)?://)?((w){3}.)?youtu(be|.be)?(.com)?/.+'))

wooden ember
#

idk i just used that cuz it was on some code i "borrowed" a while ago

#

it works as far as i know though

wheat mesa
#

same

wooden ember
#

hahaha

radiant kraken
wheat mesa
#

no idea, just stole that regex off the internet somewhere a long time ago

fathom sonnet
wheat mesa
#

your logic is incorrect

#

NOT or NOT doesn't make sense

#

That condition will always evaluate to true