#development
1 messages · Page 2055 of 1
Follow-up question:
How?
Suggestion:
Smooch Dylan to show gratefulness
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
👨❤️💋👨
Yee haw
or is there just a way to convert the samples into an audio stream
When I send a request here, I get a 404 page not found error.
Show your request (hide the secrets obviously)
I opened it from the browser 😃
How do I map, this array to like a msg like
User id votes
Somewhat this in this above way
It's a object which is converted to array
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++) ...
discord is going too far
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
which makes sense as bots should be there to interact with external sources
This has been out for a few weeks now?
given how "good" discord "features" are, I think mod bots will still have the higher ground over vanilla features
it has been in testing I presume
I wonder if being partner gave me that for my server for awhile 🤔
received the notification today
Why looping like loop the object or array?
peace ☮️✌️
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
for (const index in userVotes) {
message += `${index + 1}) ${userVotes[index][0]}\t\t${userVotes[index][1]}\n`
}```
Xd
that doesn't include his index nr
It does.
Ik how to do that ;-;
I forgot the +1

Is that easier to read?
idk
@fervent moss Does this not do what you want or am I confused
I wouldn't trust those \t\t without rightpad btw
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?
1) User#1234 10
2) BigNameUser#5678 8
3) Normal#1111 5
oh usernames?
Oh lmao I thought for some reason they legit just wanted the user ID
yeah me too
well u need to detect the user name length in order to get the right TAB count
not really difficult
^
I suppose he wants the tag since he included #
user.id
we need disambiguation now
are you fucking drunk
👀 not yet
9 is greater than 10
quiet!
There's a lot to unpack here

Issue closed: request not detailed enough
he wants usernames or mentions?
yes
or nicknames
nobody knows
:run:

🏃♂️
sheesh nitro users
I wish discord had some kind of github integration that allowed u to open/manage issues from here
i dont have nitro anymore
since bot support servers are quite common now
I will remember you had it, forever
only had it twice, both times it was gifted
now gift me money
:^)
Sa-sa-@civic scroll???
cow
just testing my new AsbstractRenderer

yeah
i'm nowhere near them
need to share it here
im sry
Peter tries Red Bull and gives Chris some
lmfao
Free nitro!!!!11!!

don't forget
Not parked
Good
i wonder what the content was, probably some shady js
lemmie just execute it for you
Oh the domains use clck.ru and Yandex to avoid filters
We’ve tested and even redirect followers don’t work
Oop discord moment
pihole moment
blocked by gravity?
Can you just checkout my code more over given by Tim but the part of msg is pretty much wrong ig-
good thing, yandex is also on the block list lol
given my tim
They abuse the query redirects, so if you visit just the yandex url it takes you to their search engine
But if you come from the clck.ru link takes you to nitro scam
Yeah i can be in multiple server right lol jk :)
hmm I mean why not, if people fall for it
They do fall for it sadly
I’m gonna discuss a good solution for following these domains with peopel in the anti fish server
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
if you got a problem with your code, post it in here and ask for tips
make a command
won't be enough
I’m concerned that you have the bot dev role but don’t know how to add a command 
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
lol I'm aware what a ping command is, lmao
Perhaps you should try this thing called problem solving
by coding it yourself
You won’t always have examples of people for everything
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
Am I doing something wrong or i am whole wrong 😕
What are you doing with for(const a[1] of …)
when you're so rooted in java that you start using annotations everywhere
Lol
you had the chance to get some free java exorcism
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
I don't have any idea what to do...
I just did what dylan told me to do ;-;
It might help to learn more javascript before hopping into using stuff like this, just saying
people try to move you into the right direction with examples, they don't write your code and share it for free to you
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
Fake are you proud of me, I haven’t touched Java in like 3 weeks
ever saw aspectj waffle?
Nope
it basically adds AOP to java
I can't be any longer since I know you touched it
WITHOUT somebody pointing a gun at your head
I use it only for measuring method execution time atm, but there are a ton of uses to it
i don't like it's horrible syntax
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
fake will ever stick with php, he's too old to learn new tricks
https://youtu.be/PuMXWc0xrK0 thought this was a very good video about rust
A 10-minute lightning talk explaining two features of rust that no other popular language has.
Start your Rust journey here: https://doc.rust-lang.org/stable/book/
Transcripts for all videos here: https://github.com/0atman/noboilerplate
CREDITS & PROMO
My name is Tris Oaten and I produce fast, technical videos.
Follow me here https://twitter...
Sorry for the embed idk how to get rid of it on mobile
So wat should I use for property in variable hi ?
wdym isn't that good
it's like python
you will get used to it
my gosh... dude it's way too hot to listen to videos atm
plus it looks cleaner imo
I’ve been getting used to rust
My lexer for “rlox” is now complete
The parser/ast is going to take a while though
what's rlox?
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
what does it's syntax look like
RustScript?
i'm currently thinking of rewriting my compiler from C to Rust
sadly idk how i would turn the AST into an executable though
Rust has LLVM crates I believe
You could write it with that and get an optimized executable
huh
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
found this https://github.com/Wilfred/bfc
don't mind if i ruin it
bfc also doubles as Big Fuckin Code
whooops i just realised i forgot to malloc in my c library 
what did you use instead 💀
bro thought it was c++ and used new
Smart pointer moment
micro optimizers realizing smart pointers add overhead because they're runtime objects
nah i just forgot to add a malloc statement to an uninitialized pointer
mf you think a @radiant kraken pointer or a pointer with a random value of @uncut nexus is good
8008135 
leet moment
bruh i just realized
80085 or 455
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
jeez
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
yes
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
it will
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?)
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.
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
Just fetch the audit logs by ban type and get the latest ones
https://discord.js.org/#/docs/discord.js/stable/class/Guild?scrollTo=fetchAuditLogs
how can you send in threads with djs
same as normal.
threadChannel.send()
https://discord.js.org/#/docs/main/stable/class/ThreadChannel?scrollTo=send
can someone explain why i getting this error on this code:
"Cannot access 'channel' before initialization"
prolly cuz u using variable "const channel = channel.guild.wtv" but u already defined channel in async (channel)
ahh yea could be
didn't work
i did manage to scrape my mod logs tho
then used a webhook to send to a thread
well, i removed const, and now instead of bot sending name of created channel, it sends name of channel saved to DB where logs are sent
oop wrong copy paste
u cant have a variable named channel if u already defined it in the callback or wtv u call it
prolly
i forgor... you are GOD
💀
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
yep tried, but after that, when i doo ${newRole.name} i got that name is undefined
i got "undefined" while using newRole.name
if i use only newRole, bot will log the messgae but it will log undefined instead of role name
name isnt undefined, newRole is
looks like you wrote your event incorrectly
these are the only two parameters, you have three.
https://discord.js.org/#/docs/main/stable/class/Client?scrollTo=e-roleUpdate
so role = oldRole
oldRole = newRole
newRole = undefined
yeah, you now have oldRole and newRole
role doesnt exist
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
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
lol
the instagram api?
https://developers.facebook.com/docs/instagram-api
https://developers.facebook.com/docs/instagram-basic-display-api
they have two
Eww my gosh
Oh my god crypto!!!1!1!! BatChest
No they cannot
For good reason
Otherwise there would be a shit ton of Instagram dm bots
God the horrors of that
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)
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
damn sorry couldnt help you, i only know how to make slash commands in notepad and sublime text
Are you using any Discord API wrapper right now?
based
is my vscode drunk rn ?
💀
that happens all the time for me
.......
Forget something
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
Fixed after restarting
Probably some plugin having seizure
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
💀
Thanks for those resources!
I pinned your message here.
Hmm analyzing JS memory dumps is kinda hard.
what are you trying to analyze
Well basically I have a memory leak in my bot. Memory used grows over time
After about 1 day it has grown over double
discord.js?
Ye
thats just discord.js being discord.js
I have two heap snapshots, one from fresh start and one from about 24h of running
I have heard this before but...
Does everyone just accept this?
how many guilds and how much ram at start and and end?
1910 guilds, 300MB ish at start and this after 24h heap snapshot is 865MB
does your bot do music?
No
show prints of the snapshots
It does a card game type thing, with sequelize/SQlite, Canvas for graphics, ffmpeg for gifs
do you have an eval command?
hmm thats a bit unusual for djs, can you expand those arrays?
lots of the same strings like this
Think thats a server name
Well there's 2M something arrays
which version of djs?
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?
since the strings are all equal, shouldn't js treat them like a single reference anyway?
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
Yes I would think so right? But it seems not, I think?
Infinity (or remove the entry) means the cache is enabled
oooo neat
you will need to tweak that for your needs
for example if you need permissions and stuff, you need to enable roles and stuff
looks like something like 30% of the arrays are empty
There are also many arrays like this
those are normal
I really wish there was some way to group the arrays/strings by content
Thank you
oh, hey, tcg bot bro!
just noticed the context
hehe
kweeb
I guess i'll just keep using forever, but thanks to everyone that tried to help
also, an eval command would help you debug these kind of issues, for example running process.memoryUsage() can give you further insights
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
you dont use vm tho, do you?
I do not but it's CompiledFnEntry
Some dependancy is likely to
Oh I did require vm at some point
But not use it
thats probably rss
which can be two things: c++ memory that js cant see (sqlite, canvas, ffmpeg) or memory fragmentation by the system allocator
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.
wherever it's calling that command, it's supplying 2 arguments but you require 3
where do u call the command?
You see, I self taught myself picking things up here and there over the course of 5 years.
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...
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.
So that I assume is the command calling.
you should take some courses to learn the basics of programming then (not in the sense of "easy and noob stuff" but "coding fundamentals")
what you showed is the command declaration, you probably have another place where you call that function
I've tried that twice, wasn't my thing. But those were after school like code camp stuff. So I may do a course for py in college though.
I still have a while to go, deciding what I want to do with my life. Only 14.
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
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?
I believe you'd have to fetch the user object with their ID
client.users.cache.get('<id>').send('<message>');
``` like this?
client.users.fetch('<id>').send('<message>');
``` this?
great
my bot still crashes after updating to v13.7
^ if my bot gets added to a guild
The latest version is v13.8, the lower versions are known to crash when the Text-in-Voice feature is used, or some other features
maybe I haven't updated properly
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
why not use npm to update it
npm i discord.js@13.8
discovered railgun operator is a thing (not called like that but fck it, it looks like a railgun)
lol
ye
same as bits = bits >> n, which is kinda useful ngl
careful with dm commands
ye i use it sometimes
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
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
any error?
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
(Use `node --trace-deprecation ...` to show where the warning was created)```
where you login
what is this?
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
where you do .run()
so you logged in with client
but you defined the command with bot
yes
(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
something like AGPL maybe
again... any errors? also discord.Embed has a capital E
hello?
question: How can i solve this Error:
const { QueryType } = require('discord-player')
I use GPL v3
you want to clone my bot? sure
just dont try to sell it or make it closed source
GPL doesnt protect from server usage tho, which is covered only by AGPL
server usage?
ie buiding a webservice and selling subscriptions/access
can anyone tell me where tf that deprecation warning came from pelase
Use
node --trace-deprecation ...to show where the warning was created
I can't, once I start the bot I can't use the CLI
do you just put a license.txt in the github repo and it's enforced?
like this
if ur using jetbrains IDEs they have an auto-notice feature where it adds those headers automatically
executed it using child_process
still nothing
thanks!
license stuff is tricky. should i use AGPL for my backend code and GPL for the frontend code?
basically yeah
GPL only protects code that is distributed to clients
doesnt protect code that says in servers
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)
}
good thing my frontend and backend codebases are separate
(All my check_collision function does is reverse the velocity vector when it detects a collision in the bounding box)
is this for unreal engine?
No
The values are way too small for that
Not to mention it would probably have a lot worse behavior than this: https://gyazo.com/431811388fc78f11a60c3d2f0de6696e
is there deceleration applied ever?
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
if there is gravity, but only when you fall then that will happen
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
actually i see it slow down a bit
do note, btw, gpl is viral
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
i see
like, my bot is licensed under gpl because I do not want people to make it closed source
if i wanted to make it closed source or sell it later can i still do that?
💀
you as the original owner can change the license whenever u want
but previous versions wont be affected by the new license
that makes sense. that's what amazon did to elastic
btw, anyone have an idea on how to fix this?
client.player is undefined
ouu. tnx
i think i got iždea on how to fix it
what's the most unique bot a person can come up with?
A bot that nobody here can come up with except for you because then it wouldn’t be unique
Refresh tokens don't expire right?
Only if the user deauthorizes
no idea
but I never saw discord logging out after a long period without entering
so I guess they don't
Discord only provides an expiration for access tokens, so I guess it doesn't expire refresh tokens.
that's what I'm saying
if they did expire, discord (browser) would log u out after a long period without accessing the site
Yeah thanks. Just needed a sanity check
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
hey guys, does anyone know or have json data that contains countries and their 2 letter code?
like {"australia" : "ac}
actually its sped up to 10 seconds so its probably because of a cold start but still 10 seconds is quite long
took 1 second for me
💀
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
I can't imagine why the timings would vary to this degree
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
yeah but those often vary to the scale of microseconds
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
I was just about to test it there
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
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
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
I have no ideas for commands though
can you give me an idea : )
though any command you can think of I probably made
tbh, so many unique bot ideas come through developer channels but no one notices it could be a bot.
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)
I also don't really use bots.
@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?
unfortunately yes, thats how it works
Ok
why do you have to clone tho
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
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
Is there a better way to handle result? https://cdn.hamoodihajjiri.com/33oJqIBCIM
hmm, might be moving to "large bot" sharding by next week
im only 450 servers away
what is it again
@radiant kraken c devs have humor?
have you seen C/C++ devs in stackoverflow
god complex haven
💀
hes the kind of guy to not use references and copy everything when passing to functions
does it even have boundaries
149500 ish
just added shards, decided to stay with 18 clusters
that dashboard is so sweaty
sweaty? lol
very op
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
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
Idk... You can make news bot, to post like TOP News from some websites like CNN, BBC etc... They have, as I know, "unofficial" APIs that can be used
You could make compiler maybe
who read news
People...
oh shit i am not people 😱
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
maybe a bot that lets you listen to an RSS feed
this
before creating a bot you need to know which audience you're targeting if you want success
What exactly is the difference between clusters and shards?
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 🥲 👍
iirc clusters are a collection of shards
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
exactly what I did
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
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
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
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
it's a combination of memory and innodb tables
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
yeah myisam is a joke lol
thats quite healthy
does phpmyadmin scream at you for anything?
the warnings
when i still ran the bot phpmyadmin would be full of warnings lol
im not an expert at tuning mysql
what kind of warnings?
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
80 days? rookie numbers i had one run for a year
it auto updates
you mean you ran one for a year and didnt apply security patches to it? 
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
you should run unattended-upgrades
bruh i got a voip server that been running fedora 8 for the last 15 years
if there is a security vulnerability burning through the news then i'll probably go out of my way to update
it does important non-breaking security upgrades for you
never knew that existed
you do now 🙂
that is actually pretty cool
it wont reboot for kernel upgrades tho
it will email you and you have to do that yourself
i mean its not windows 
email? 😂
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
god i forget how old some technology is
pm2
yeah, a linux server has internal email, with each user having a mailbox
when you log in, it'll go ' you have mail'
even if you arent running an smtp daemon iirc this works
is that something i gotta install
Yes
Not exactly easy to run something on startup without fucking around with settings, pm2 takes like 5 minutes to set up
yes for node, npm install pm2 iirc, but for anything else, crontab is enough
add an @reboot line to crontab
did that
the shell script runs cuz it beeps the bios speaker
but there are no screen sessions started
imagine having a bios speaker
Well if you ever can’t figure that out (I have never used crontab), pm2 is a really easy option for running node projects
when is this, 1983?
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
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
😄
why would i do that?
install jarvis
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
add it as a service on systemd?
if you want to start screen from cron do this
@reboot cd /path/to/bot && screen -dmS botname ./startbot.sh
where startbot.sh is a script that boots your bot
-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
By using a shell script, I think you’re making things more complicated lol
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
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
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
fair enough
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
its async
would be a shame if someone made a request to /vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php
on my other server i use sleep 10 && command or somthing to order them
this way i can be sure that clusters and shards start syncronously
yeah that would be unfortunate, especially if i was using php unit 😄
you nit
someone tried running that exploit on my server while i was testing a website in dev mode so it popped up in logs
looked like an automatic bot
will make a file in that exact location, and put in it echo "bzzt wrong answer fool" 😄
thats a nice easter egg
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!"
"uh uh uh, you didnt use the magic word."
or however the jurasic park thing went
there we go
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
these days sure
ipv6 is still in its infancy and not many people use it
eh, that's a LOT of data to scour over
especially as there are lists of null routed subnets, some really large, that you can exclude from the scan
that is if your ISP even supports it
used to be that scannin the whole ipv4 space was impossible because peoples internet was too slow
not any more
ipv6 only?
Yeah
thats futuristic
It's unfortunate, not futuristic
we cant even get our isp to give us an ipv6 tunnel, had to get one from tunnelbroker
I can't host a minecraft server because it doesn't support ipv6 :C
discord should support v6 too
thing is, most services still rely on ipv4 
they dont atm
its a good thing for you that cloudflare automatically proxies ipv6 to ipv4 if the server doesnt support it
most things allow you to connect with an ipv6 connection but some services don't allow you to host things on ipv6
namely minecraft
i got a mate that has a scanner doing that
takes about 30 minutes to scan the entire web
he logs mc servers
though iirc from my workplace, isnt there a arpa thing or smth to translate ipv6 into a domain that then allows connecting?
yeah really doesnt take long and its a little worrying
reverse dns?
lemme find it, I somewhat remember something like that
or was a local microsoft thing
yeah reverse dns
ip6.arpa
someone showed me vcpkg last night, my god I'm in love with it
yup people do it all the time looking to badly secures routers servers and vounrablt stuff
it's much better than compiling a 13 year old C library in VS22
there are people that try to spam my voip server with numbers trying to get free calls but the never get through
lmaoo
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
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
when you gonna make a C++ discord bot with DPP, waffle? 😄
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
i need to properly get back to discord bot dev
Currently I'm doing a physics engine with rust and sdl2
probably not make my own thats too much work but join someone elses team
discord bots are pretty easy to make tbh
going back to ts after doing low level stuff feels like a breeze
its amazing how many bugs crop up at scale you otherwise would never see in a dev build
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>,
}
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
imagine having a workplace
rust programmers dont work
I'm trying to compensate for not having a job by learning as much as I can over my summer break
ive yet to meet someone employed as a rust dev
in an actual real job, for a company
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>>
}
i heard discord has some
I've seen a lot of rust stuff on linkedin and indeed and stuff like that
but theyre expected to know python and elixir too
By the time I graduate college there's gonna be a lot more rust jobs available most likely
i start a new job in 2 weeks
Still have 5 years until I graduate college though, plenty of time to master rust
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
I think rust is going to overtake many new projects over C/C++
It'll never replace c or c++, but it'll certainly become favored over them for some projects
lmao
they're too busy in the rust server telling people what they just coded is bad practice or unsafe
but rust has an awful lerning curve for newcomers
I started rust about 2 weeks ago
it means its userbase is going to be smaller
It's not too difficult so far, there's just some stuff you have to think about differently
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
Rust is sorta like "do it right or don't do it at all"
problem is, people dont start out as experts 😄
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
too friendly and active
just dont dwell down to the more specialized areas of the server
thats where it stops
totally not me in the games and graphics channel
im more recently vibing in the cryptography channel
i dont use rust anymore but the advice there is still helpful
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
One message removed from a suspended account.
One message removed from a suspended account.
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
worst things to happen
- red text on a terminal
- poop splash
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
its going to work if you rename all your stuff to Gayme instead of Game
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 🥲
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 {
// ...
}
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
}
How can I setup a vote webhook in my bot?
yes you can do that
music bot in 2022: 💀
bruh i just made my bot play sound comming fromt he mic jack of my server
music time
discord live radio station
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
you could do that or you could use regex, regex is probably better for this because there's a few different forms that youtube links can come in
something like thisif (url.match(/^(https?:\/\/)?(www\.)?(m\.)?(youtube\.com|youtu\.?be)\/.+$/gi))
As much as I hate regex, this is definitely a valid use for it
?
Mine was if(url.match('^(http(s)?://)?((w){3}.)?youtu(be|.be)?(.com)?/.+'))
idk i just used that cuz it was on some code i "borrowed" a while ago
it works as far as i know though
same
hahaha
what about this ^(https?:\/\/)?(www\.)?youtu\.?be(\.com)?\/.+
no idea, just stole that regex off the internet somewhere a long time ago
i mean...this is what I have: ```js
if(!url.startsWith('https://youtube.com/watch?v=') || !url.startsWith('https://youtu.be/')) {
return interaction.reply('You need to provide a valid YouTube URL')
}



