#development
1 messages · Page 1735 of 1
Lol. I don't think I'm going to rewrite by bot anytime soon, maybe for the next project.
@opal plank v9 support for my lib soon™️
I also love how the docs say that v9 is available
even though it's not released
What library..
Ugh. Use prettier or something. When I see line lengths over 80 characters it makes me feel sick.
a cacheless discord.js-like library
Ah, that's cool
discord.js-like
caps
mapped to resemble it's API, but cacheless and does it's best at memory management
well yeah discord.js caches literally everything
So what is the lib called?
I need to implement a Fast Cache so that I can avoid duplicate constructed resources
me working on quite literally the most barebones lib seeing all these people have to actually work on supporting new discord features 
it's called ThunderStorm, but it's not on NPM. Only on GitHub
There's already a ThunderStorm on NPM :(
dunno why you want to use v9 since they'll add most of the cool features back in v8
Thunderstorm cool
Threads won't be sent over v8

threads wont
if there isn't, make one
Lol sure
Threads are a new Discord feature, only available in API v9. Bots that do not update to API v9 will not receive gateway events for threads, or things that happen in threads (such as Message Create). Threads can be thought of as temporary sub-channels inside an existing channel, to help better organize conversation in a busy channel.
I would probably go for Rust over Go 🤷♂️
threads are like stanging channels
you use them for 5 minutes
then stop it
probably will be used for reddit-like servers
they're still important to cover
they kinda trash tho
like i wouldn't want censor bot to just ignore messages sent in threads lmao
hmmm it must be temporary then
Every day, v6 comes closer to actually being retired, but some "official" clients aren't updated yet. Taking a look at Eris
Threads, that's kinda cool. Although is it just for bots?
Ahh
and never again remember abot it
They're temporary channels within channels
Its a guilded feature
ik, i have access to them
I've tried that out
wait what
yeah "guilded"
yeah, both buttons, some other stuff and threads
I think
erwin what do u think abt this?
Are you using a client mod to enable experiments or did you use the console command
i got access into the private betas

Erwin the stage channels are good for online classes
Lmfao
sure
im also pretty sure this is cap lmao
like "online classes" servers have more than 500 members to qualify as community server
wdym?
only discord employees can have experiments without client mods
Only unmute kiddos when necessary so you dont end up with an eternal fan noise in the meeting
how much you wanna bet?
lemme see

cuz even bmg tries to strangle employees into allowing them but they cant lmao
umm
this channel is for bot development not discord
We're talking about dev related stuff
probably tbh
w h y
docs stable search slash doesn't return anything
try searching on master in github
Hey, What are you trying to do? Like configure a webhook when a user buys premium?
im thinking about whether or not to do a redirect url or a webhook to link a user
What is this for?
a bot
Ah
my concern is if someone uses a different email
store their user id in a database in a list of premium users
that's what he is doing, he said so
linking with something relatively static is a good idea. Most logins are keyed by email
how about discord oauth
could even offer a feature of secondary email or email changing
Adding emails, that's what GitHub does
So basically you are linking a user's email to the database right?
Why not use a webhook
What database are you using?
@slim heart
mongo
are you hosting your app on the cloud
Just use a webhook
because then you can use a serverless function
message.author.presence.status always returning me "offline", but with my other bot it say dnd, does someone know why, and i get all intents
Is the presence intent enabled on the dev portal

So you want to get a user's presence status right
yes
it work fine on my other bot, but i created a bot to test it, and it doesn't work
it's the same code, and intents are enabled
Welp looks like there's something wrong with the intents here
If the message author has the bot blocked, the client won't receive PRESENCE_UPDATE events
const Discord = require('discord.js');
const intents = new Discord.Intents();
intents.add('GUILD_PRESENCES', 'GUILD_MEMBERS');
const client = new Discord.Client({ ws: { intents: intents } });
Try this too
And maybe reinvite your bot
i get this already, idk if something is wrong with that
const client = new Client({ intents: Intents.ALL, fetchAllMembers: true, disableMentions: 'all' });
getting this error while setting up MongoDB, any idea why?
Here's the code :
mongo_url = (os.getenv('url'))
cluster = MongoClient(mongo_url)
dab = cluster["discord"]
collection = dab["toggle"]```
You are using pymongo?
yas
import pymongo
from pymongo import MongoClient
dis one
https://stackoverflow.com/questions/65489987/configuration-error-when-trying-to-connect-mongodb-database-in-python basically you gotta update dnspython
Similar to your console errors
i've seen you today here 4 times already, asking the same question, getting the same response
it cnt work
i do
what?
why cant work?
wait i give codes of that place
my english is not good
google translate then
here i want add it
let thing = new MessageEmbed()
.addField("START PLAYING", song.title, true)
.setColor("#fffa69")
queue.textChannel.send(thing);
};
i need add mention user
ok
let thing = new MessageEmbed()
.addField("START PLAYING ${user}", song.title, true)
.setColor("#fffa69")
queue.textChannel.send(thing);
};
here
eriht
@opal plank cnt work error comes
Wtf is that bot name
hahha
but dont abuse our prime minister
i can talk in hindi but i cant help you now because i have online class
modi kutta
ara bhie
pls na bol
Unhandled Rejection at: Promise {
<rejected> ReferenceError: user is not defined
at play (/home/runner/explain/commands/play.js:136:34)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
} reason: ReferenceError: user is not defined
at play (/home/runner/explain/commands/play.js:136:34)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
ya error a raha
ha
error padho
user is not defined
tumne user variable ko kaha define kiya hai
ara wo nhi
embed hie nhi a raha wha
error hoga to embed kaise send hoga
whi to
bolo na mention kasa kara
tumne user variable ko define nahi kiya hai
use define karo
let thing = new MessageEmbed()
.addField("START PLAYING", song.title, true)
.setColor("#fffa69")
queue.textChannel.send(thing);
};
yaha
pa karna ha
mention
user variable define karo
ara wahi to nhi ata muja
ma noob hu '
is liya puch raha na
sahi kar da na ps
dude is working on a bot but doesn't know how to define a variable

wha bc
this is how you do it:
let variable = smth
english ma ya angrajo ka samna apna bhie ka majk urata
wha
asa nhi kar sakta
let thing = new MessageEmbed()
.addField("START PLAYING", song.title, true)
.setColor("#fffa69")
queue.textChannel.send(thing);
};
embed ma dal d
One message removed from a suspended account.
One message removed from a suspended account.

One message removed from a suspended account.
ok
@earnest phoenix dm kar sakta bolo
One message removed from a suspended account.
yes
One message removed from a suspended account.
One message removed from a suspended account.
@earnest phoenix
let user = message.author.tag;
let thing = new MessageEmbed()
.addField(`START PLAYING ${user}`, song.title, true)
.setColor("#fffa69")
queue.textChannel.send(thing);
};
ye lo
@sage bobcat what's bothering you turk
One message removed from a suspended account.
One message removed from a suspended account.
i alredy do
i am not noob
bro
One message removed from a suspended account.
One message removed from a suspended account.
i alredy do that cnt eorl
you do what you want i just give you the code because im tired of avoiding spoonfeeding
kk ty brotha
bro lisen one time
Np brotha
How can I get a file path of a file in the project without specifying the exact path
java
forgot to mention
from Moderation.java to data.json
@knotty obsidian not sure if this works in java but ./data.json
java is an awesome language
why are you using it then
-needdev
You seem to be asking for something you don't have experience for or something that hasn't been done yet, but really need for your bot/server.
You can hire developers from Fiverr or Freelancer to code the things you need for your bot/server.
👀 wasnt exactly what i wanted it for but sure
nope. you have to hire developers. the vast majority of developers its how they make money to live and whatnot.
the ability to program, understanding the very basics of http
Understand net/http
Having spare ctrl, c and v buttons
{
"name": "test webhook",
"type": 1,
"channel_id": "199737254929760256",
"token": "3d89bb7572e0fb30d8128367b3b1b44fecd1726de135cbe28a41f8b2f777c372ba2939e72279b94526ff5d1bd4358d65cf11",
"avatar": null,
"guild_id": "199737254929760256",
"id": "223704706495545344",
"application_id": null,
"user": {
"username": "test",
"discriminator": "7479",
"id": "190320984123768832",
"avatar": "b004ec1740a63ca06ae2e14c5cee11f3",
"public_flags": 131328
}
}
i have the code
but i do not know how to run it
pls tell can i run it through github
yes
Use a programming language like javascript
using a discord api wrapper like discord.js
how much rs?
No thanks, I don't do hires. I'm fucking busy with my own job.
ok
it is not my webhook tocken
it is fake a webhook token
Is it really fake
the webhook token does not work
Ok it doesn't look fake
I cba to test it kekw
cba means
and keke means
@earnest phoenix your games lags
it was in the discord site
they gave an example
do you know what a webhook is?
yes
it will send messages throw other apps to discord
see the webhook i gave is a fake
CODE NAME POSSIBLE SOLUTION
2020 Request Signing Failed Check user entitlement
2022 Disk Space Low Free up disk space
2023 Disk Permission Denied Choose a new location, or change write permissions on desired location
2024 Uninstall Failed Attempt to manually remove game files from disk
2025 Install Script Failed Restart Discord, attempt to uninstall/reinstall the game, ensure script is correct
2029 Build Not Found Completely close and re-open Discord
2051 Panic! Escalate in the dev server in #dispatch
2058 Too Many API Retries Escalate in the #dispatch channel of the Discord Developers server
2059 Failed to set Registry Key User most likely denied Windows administrator permissions prompt. Try again, and accept the prompt
2064 Failed to Patch File Attempted to patch the game while running: ensure the game process is entirely ended, try restarting Discord, try disabling antivirus
2065 No Manifests Ensure that your manifests are properly selected in the Developer Portal for your SKU
2069 API Error Intermittent API issues. Wait, escalate to #dispatch in the dev server if it persists
2070 Bad Reponse Intermittent API issues. Wait, escalate to #dispatch in the dev server if it persists
2073 Not Entitled Check that your manifests are properly configured in the Developer Portal. Have the user install the game from the Library, not the store page
2076 Two Clients Patching User has multiple Discords open trying to patch the same game; only use one
9001 Unknown Catch-all error code. Escalate to #dispatch in dev server with repro steps/as much info as possible
eeerrr codes
discord
whats the codeblock term for regex?
What do you mean
There is my index.js file, i get all intents but the statuts still offline for every user, excepted 2-3 users
const { Client, Intents } = require('discord.js')
const config = require('./config')
const client = new Client({ ws: { intents: Intents.ALL }, fetchAllMembers: true, disableMentions: 'all' })
client.on('message', async message => {
if(message.author.id !== '242233306488373249') return;
message.channel.send(message.author.presence.status)
})
client.login(config.token)
did u enable the intents things in the developers portal ?
mdr
hi
does anybody know how to create custom scollbar only for desktop version?
i mean not with max-width
that s the problem
it can also be seen on phone
So I got this error when running my jar
java.lang.UnsupportedClassVersionError: me/scorpion37/scorp37/Main has been compiled by a more recent version of the Java Runtime (class file version 58.0), this version of the Java Runtime only recognizes class file versions up to 55.0
Anyone knows how can I fix it? (Java)
I didn't really change anything besides add a json-simple-1.1 library
the java runtime you're trying to run the file with is an older version
the file has been compiled with a java version that's newer
so it can't run
but im still using the same versions
you aren't
reinstall it
it shows here
it's been compiled by v58
but you are running it on v55
the file is compiled with jdk 14, you're trying to run it with jdk 11
I mean people want their freaking website to be reactive, i.e., mobile compatible I don't understand why you just want it for desktop? Are you making a desktop app with electron?
is there any open source database like the one mudae bot has?
https://www.fandom.com/
Any api or way to access data from it?
https://pypi.org/project/wikia/
i found this lib but i doubt it's working anymore and there isn't any docs on it
hey
i am trying to set adsense for my website, however it isn't really working out.
for some reason it doesn't allow my domain as it is too long?
When I run my bot on the raspi it always says that the file I copied the path to doesn't exist, why?
the path: /home/pi/DiscordBots/Scorp37
what i entered: File data = new File("/home/pi/DiscordBots/Scorp37/data.json");
(java)
Raspberry pi 4?
Raspberry pi 3b+
don
type cd DiscordBots/Scorp37
did
Should bring you to your file path
oh right
did File data = new File("java DiscordBots/Scorp37/data.json"); that
did it work?
trying rn
hopefully it works
been tryna fix it for an hour now
welp
didnt work
Mind hopping into the bot dev channel
also
java DiscordBots/Scorp37/data.json (No such file or directory)
wait
if the data.json file is a json file
dont i do
File data = new File("json DiscordBots/Scorp37/data.json");
weird thing it works on eclipse
nope
still nothin
this is weird
i tried everything lol
dunno what it wants from me
wha
im tryna boot up a json file
tables
like
warning counts
hes in vc with me
no vc chat here
i tried looking it up
uhm
I know that
oke then
lol ok
anyways i ran out of ideas to try
the main problem that i cant search it up is because im exporting it into a jar file and then running it on my pi
hmm
wait now if i do cd /DiscordBots/Scorp37 it says no such file or directory
but why did it work before
my computer has C:\ while the pi is just /home
/home pi?
/homepi
bash: cd: /homepi/DiscordBots/Scorp37: No such file or directory
nope
2 only
i mean shouldnt effect much
they are seperate
What is clustering?
is there any other way i cud do it 🤔
sudo nano /home/pi/DiscordBots/Scorp37/data.json
worked
in the terminal
wha
oh my friend did it and said i shud use it
now my entire project is java
yeh ik
the thing i do it shud work
but it doesnt
oi
found something
i might find how to search it
creating a cluster of data
You mean a set of shards?
When in doupt stackoverflow it out
i gtg ill find out myself later
welp, basically creating a cluster would mean creating a collection of data. And yeah you can say that its stores a set of shards.
Yeah Ty :)
pls snipe
who tf ghostpinged me
@mint thicket
someone ghost pinged me
do u mind checking audit log?
Calm ... nobody cares about a ghost ping
Stupid
is this inbuilt?
yes
k thx
I'm once again asking for your development support
did you... try?
the Fandom wiki api is somewhat deprecated, atleast it where the last time ive used it. they migrated to the Mediawiki software, but the API endpoints are a bit fucked.
You can use iframes, use #development if you have any further questions
but i mean it is put my website into the top.gg bot page
I am using BDFD and $addTimestamp doesnt working
What should i do
👀 ok im noob to html

Did u saw the msg?
I found the python API but it's kinda depreciated or not working and I checked rapidapi but no results so.. I asked here
Yeah! And after that there's no update from them
what you found was a python library, but the API itself can be used in any language
Sorry my bad it was lib
I did mentioned in above msg
I'm looking for a good VPS host, reliable, around 15 €
the API is completely fucked, had a command for one of my bots using it and ive had to disable it
Digitalocean is decent
I know I gotta do it by myself, but what's wrong in asking once before starting
for 10€/Month you get quite far
Nothing, there's nothing wrong with asking.
is for a little bot
will be more than enough, the 5€ droplet will work just fine (if you dont do CPU heavy stuff like machine learning)
droplets are quite expensive for long-running tasks
A question for you smart developers. So, I'm planning to add a dashboard to my bot in nodejs. Since golang web servers are effective I'm planning on using that. But I'm a bit confused, how I could use server-side rendering with the golang web server. Like, A user authenticates and I need to get data about the guilds he shares with the bot, but how would I accomplish this with a go, although it ain't my client side language.
not smart developers, you're looking for Go developers
connect everything with a express server, rest api....there are many options
uh, I said go web server.
still
Basically, all I want is to share data between the server and the client.
Well, you're using Go, as a language, so you're looking for a developer that knows Go, specifically.
But the basics of sharing data between BE and FE is making an API using HTTP. Or using websockets.
Can oauth2's in discord know what guilds a user that logs in shares with the bot/client?
It can see what guilds the user is on yes, with the guilds scope
And then you have to compare that to your own bot guilds to see which they share
I want to use :emojiexample: on my bot but i can see this emoji only if that server have it
I couldnt write
<:emojiname:emojiID>
Yea ik
Stargirl be like: 20 unique tips to create gifs in seconds!
But i cant see on my bot in other servers because they dont have this emoji
they dont need the emoji
So what I mean is that if the emoji I use in the bot is available on that server, it only appears
your bot must have permission to send emoji's from other servers.
How can it get
the server staff gives it to you
does your bot have this permission?
Is it on discord dev portal ?@zenith terrace
that's server config
server role permissions
How can i go this settings @zenith terrace
server settings
it should work just fine
so it shows in the one server from the bot, but not the other?
it appears on the servers where the emoji is located
are you sure you are doing the <:emojiName:emojiID>
show that part of the code
is the emote's name exactly evet1?
It is working
Yes
and does the bot role have this permission enabled?
It s mean yes in english
also, is that emote from a server your bot's in?
It has all
Yes
Idk what is the problam
😒
if you fetch that emote by ID does it return something?
What does it mean i dont understand
well, there are really 3 reasons for an emote not to work:
A - the name-ID combination is invalid
B - the emote is from a server your bot's not member of
C - missing Use External Emoji permission
none of
unfortunately not anyone
I've tried this at least 5 times
Maybe B
But
My friend using same programe with me
And he can see
same code <> same bot
still
And i am using BDFD
bdfd is a tool, not the bot itself
He writing only :hg:
if your friend's bot is in a server it doesn't mean yours is
you obviously cant use emotes from a server your bot's not in
that's so hawt
why is my bot still displaying that it is serving 33k users only?
are you using guild.memberCount?
then thats why
so i have to set it to guild.memberCount?
guild.memberCount contains the total number of members in a guild
you have to get the number for each guild and add them all together
but my bot is not only in 1 guild
in 93 to be exact.
wouldn't that give issues?
you have to get the number for each guild and add them all together
is there like a doc online for this?
do you know how to loop over all guilds?
tim tim tim
google google google
I'm working on a way to make chains like array.filter.map.join faster while keeping the same syntax
so far so good, already faster than the default implementations
by reusing the same array instead of creating copies?
Nope, way clunkier. The syntax isn't exactly the same, you have to do something like this:
const Iter = new FIter().filter(num => num % 2 === 0).map(num => num * 2).join("-").compile();
Iter([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
but basically every call to filter, map, etc. gets put in an array along with the provided functions, and the compile method turns them into a string, which is then given to the Function constructor
resulting in O(n) chains
ah so its a compiler for array operations
yeah
it even allows me to do optimizations, for example the snippet above would compile to:
const l = arr.length;
r = ""
for (let i=0; i < l; i++) {
if (!(num => num % 2 === 0)(arr[i], i)) continue;
r += (num => num * 2)(arr[i], i) + i === l - 1 ? "":"-";
}
return r;
But minified
Also supports reduce, forEach and count
I can make it even faster by parsing the provided functions to eliminate calling them, but I cba right now
Hey, could need some help with this: https://stackoverflow.com/questions/67403996/electron-writestream-is-extremly-slow-on-first-startup
nice
ive done similar stuff in another project, for json
its pretty much what fast-json-stringify does
oo what does it do
you know the fast-json-stringify module on npm?
they create a schema-based compiled json stringify
I didn't until now, just googled it
the downside is that you have to know exactly how the json you're packing looks like
which website is best for host
so its not very useful for highly varied json
but its very useful for consistently structured json messages, such as in websockets
I see, that's really cool
the project im working on is similar, but to a binary format like messagepack
you want to host a website or a bot?
then any vps will do
there is no best, just check how much it costs and what it offers
i want host my visual studio codes i try fist time so i ask
good choices are digital ocean, ovh, vultr, galaxygate, contabo, scaleway and more
👀
a vps is a server that you connect to over the internet, the most popular method is SSH which is like a cmd terminal that sends commands to the server
because my replit codes crash every time
SFTP is used to send files over SSH, there are extensions for visual studio code that do it for you
website full name
the S is literally SSH

SFTP (SSH File Transfer Protocol) is a secure file protocol that is used to access, manage, and transfer files over an encrypted SSH transport
Safe 
i go for heroku
😩
bye
Free hosts are bad
ovh
hmm
Hey guys so I've made a lyrics command that basically sends the lyrics of a song entered by the user, but some songs are of 2000 words and above, I wanna know how do I bypass the limit?
This is my code atm, any help would be appreciated, Thanks!
@commands.command()
async def lyrics(self, ctx, artist,*, title):
url = f"https://api.lyrics.ovh/v1/{artist}/{title}"
response = requests.get(url)
json_data = json.loads(response.content)
lyrics = json_data['lyrics']
emb = discord.Embed(title = f"{title}" , description = f"{lyrics}",color = 0xa3a3ff)
await ctx.send(embed=emb)```
you don't, simple
hey
BUT you can send a text file instead
since discord has a .txt parser now
won't solve the issue
oh
it's total chars per embed that's 6k
waittt what abt paginated embed?
then nvm
since discord has a .txt parser now
sure
Discord has a .txt files?
yayyy
.txt files are converted to a colapsible (kinda) embed
I didn't knew that
let isAdmin = function(num){
console.log(num)
if(num === ((17179869183 || 8 ) || ('17179869183' || '8')))
return true
else return false
}
//console.log(isAdmin(interaction.permissions))
console.log(isAdmin('17179869183'))```
are you two on pc?
tho idk the code for it lul
how come the last console.log returns undefined
I am
anyone know using socketio with react?
O how did u do dat?
stupid thing is creating multiple connections on page refresh, cant figure out why, its like sometimes it create 2 connections on page refresh other times it doesnt. been mindfkin me for hours now
just like images get parsed into...well...images
idont see y this wont work

and yes, the number matches
can't do that, returns this error : An error occurred: Command raised an exception: HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In embed.description: Must be 2048 or fewer in length.
2nd console.log returns false for some reason
because you're still sending the text
you need to send a text file
you're setting the embed.description to be the content of the text
oop
yeah
oof
ohh kk brotha got it
You're using the logical OR operator (||) and see if they're falsy or not, 17179869183 || 8 will always be 17179869183
The correct solution to your problem is placing them in an array and see if array includes that number
Do HTTP request cookies have to be of type Dict[str, str], meaning both keys and values are strings?
[number, number, ...].includes(num)```
afaik, everything is a string
so yes, a dict of str str
Time to do fucking conversions!
for cookie in list(driver.get_cookies()):
for key in cookie:
if not isinstance(cookie[key], str):
cookie[key] = str(cookie[key])
session.cookies.update(cookie)
Looks dumb but works
Woohoo it doesn't like the cookies I send!
anyone?
hey @quartz kindle i used what you told me
however, now it is even showing 28k users while 1 guild already has 100k users
so it is not possible
let z = client.guilds.cache.reduce((a, g) => a + g.memberCount, 0) client.user.setActivity(`!help || Serving on ${client.guilds.cache.size} servers, for a total of ${z} users`); this is what i have
not everyone is cached
this code should work
i am still just getting 30k members while 1 guild of the bot has 100k members.
and there are still 92 guilds left to be checked
so it isn't working
if you go to server settings, discord shows you how much members you have in the server.
is it your server?
ty
not my server, i am just a moderator there.
this alone is only one guild, so the total should be around like 200k
but my bot is only showing 30k
should it still like load up or something
@tasks.loop(minutes=30)
async def update_stats():
try:
await self.bot.dblpy.post_guild_count()
print(f'Posted server count ({self.bot.dblpy.guild_count})')
except Exception as e:
print('Failed to post server count\n{}: {}'.format(type(e).__name__, e))
update_stats.start()
```
it is saying self is not defined for some reason
it is below def init
and all the other events and commands in the cog work
NameError: name 'self' is not defined
Failed to post server count
NameError: name 'self' is not defined
Failed to post server count
NameError: name 'self' is not defined```
you need to pass self
to the function
Is this in a cog
yes
Why is the update_stats.start() at the bottom of it then
Refer to that function as self.update_stats in the cog's init and start it there
async def update_stats(self):

that's...not how it works
does anyone know why my bot is only showing 30k members while it should atleast be around 100k?
Is it because the bot needs some time?
hi
I have an simple database module
I write a code for subtract
with fs
but when I try it, it do data null
Not all members are cached
is it, by any chance, a json?
yep a json
but this isn't getting it from the cache?
that's what tim said
no I wanna say that I have an database module but it's not useful a lot
as i first used client.users.casche
don't use json for data storage
if you want to get 100% members in guilds, you'll need to fetch it
which is, unless your bot's life depends on it, a reeeeeeally bad idea
any one say some bot hosting website
ovh? gcp? azure? aws?
none
any vps provider
like
how long should i wait to approve my bot
??
2+ weeks
😦
2week+
galaxygate is who i use. but digital ocean works too.
Ok so the lyrics command works now, I just wanna know how do I make it so that ppl can enter the artist name without including the "-" that'll be used in the url, any help would be appreciated, Thanks!py @commands.command() async def lyrics(self, ctx, artist,*, title): url = f"https://api.lyrics.ovh/v1/{artist}/{title}" response = requests.get(url) json_data = json.loads(response.content) lyrics = json_data['lyrics'] file = open("lyrics.txt", "w") file.write(lyrics) file.close() await ctx.send(file=discord.File("lyrics.txt"))
paid
@lyric mountain do uk how to do it brotha?
galaxy gate
hosting costs money, yes.
replace
github is not hosting
im sry, what?
nah nah we can get hosting services for free with github students
or the student developer pack
like their static sites?
I got a free domain and hosting service from it xD
nahh the student developer pack
they give u a bunch of things for free
https://some-random-api.ml/lyrics?title=
its easy and better
or yeah, urlencode it
yes
100$ digital ocean credits
or mircrosoft azure, they even offer free 1gb vms, you just have to pay some cents for the public static ip
seems a lot of it is pretty restricted, or only for a year max.
not really "free hosting" just temporary stuff, which i dont think counts.
just keep in mind that you can only go so far while free
bottleneck is really low
yea
the domain has tricks doe
u can move the domain to a new registrar and get 1 year extension
even two years for some services
yea ik
and Im talking abt bot sites lul
there are free domains like .tk, .ga, .wtf
yas
"free"
and wtf aint free afaik
that's purchase price
renewal price is a lot lower
so as long as veld keep top.gg, it'll stay cheap
imagine he forgets to renew it 
imagine if there was a site called pot.gg but instead of listing bots it listed drug dealers

someone owns it, nothings on it though
👀
ayyy tysm my guy, its much better now xD
veld should buy this xD

function whatTheFuck(arg)
{
if(!arg || arg.length != 32) return null;
return new Promise((resolve) =>
{
resolve("test");
});
}
async function getBanStatus(arg)
{
let status = await whatTheFuck(arg);
console.log(status);
}
getBanStatus(process.argv[2].trim());
why the fuck doesn't it log the promise?
you want it to return the promise?
can delete await and remove the async from the getBanStatus function.
it should log the promise then.
or keep the async if you really wanted.
nope, that will return Promise { <pending> }
thats what you wanted?
Looks fine to me
why the fuck doesn't it log the promise?
👀
why the fuck does my console log it's still pending
whut
yeah I know I got a different result
Something else is causing it then, it's not from the snippet you posted
function topSecretName(be_guid)
{
if(!be_guid || be_guid.length != 32) return null;
const socket = dgram.createSocket("udp4");
const buffer = Buffer.from("..6.." + be_guid, "ascii");
console.log(be_guid);
return new Promise((resolve) =>
{
socket.on("message", (message) =>
{
const result = message.toString().slice(4);
if(result) resolve(result.replace(/global ban /gi, "")); else resolve(false);
});
socket.send(buffer, 2324, "x.x.x.x", (response) =>
{
if(response) socket.close();
});
});
}
The promise should be resolve(result.replace(/global ban /gi, ""))
that's a ban status string
you might want to resolve the promise in the socket.send callback as well?
is it logging null?
If I'm already using prepared statements for MySQL is there any additional sanitization I should be doing for user input? mysql2 lib for js.
nope, be_guid has a valid length of 32 and is correct
I'm still getting Promise { <pending> } calling the topSecretName() function
show the code where you console log it
that's the same as the example above
prepstatements are pretty safe already
but...mysql?
you're asking for data corruption
yeah i'll probably switch later on
are you sure
this is for setting bot prefixes, would whitelisting "safe" characters be overkill or do you think prepstatements would be fine as-is
ps are already escaped and guaranteed to be the same type as the field
so like, if the field is a string then ps will always be a string
obv it'll error if conversion is impossible
if a user tries to enter a char that isn't supported in utf-8 it would just refuse the query right
but with strings there's no prob
function topSecretName(be_guid)
{
if(!be_guid || be_guid.length != 32) return null;
const socket = dgram.createSocket("udp4");
const buffer = Buffer.from("..6.." + be_guid, "ascii");
return new Promise((resolve) =>
{
socket.on("message", (message) =>
{
const result = message.toString().slice(4);
if(result) resolve(result.replace(/global ban /gi, "")); else resolve(false);
});
socket.send(buffer, 2324, "x.x.x.x", (response) =>
{
if(response) socket.close();
});
});
}
if(!process.argv[2]) process.exit(1);
async function getBanStatus(be_guid)
{
let status = "test";
status = await topSecretName(be_guid);
console.log(status);
}
getBanStatus(process.argv[2].trim());
utf-8 specifically is one of the most common troublemakers in mysql
for example
if you plan having utf-8 chars in any given field, you MUST set the length to be 191 or less
oh hmm
yeah i'll probably be moving to postgresql soon without utf8 so hopefully i wont have to deal with that
yeah that figures
Place resolve("...") in the socket.send callback for me
Promise is never going to resolve if you close the connection, you'll never receive any messages
yeah makes sense but the connections, the same code is working fine in my bot but not in that file wtf
doesn't resolve ...
means the connection works
return new Promise((resolve) =>
{
resolve("...");
funny... even if so there's no console log @cinder patio
if send receives the response before on, it'll fail
ignore the socket, that works
oh... I found the issue lol
got a process.exit(); after getBanStatus(process.argv[2].trim());
bruh
yeah I should have scrolled down 
It's exactly behind the status bar of notepad
nvm
Sometimes it's needed to do a short break and then get back to your code... 
agreed
Hey guys, so I made a news command using the news api, it works but the only problem is that it spams the news in embeds ;-; Here's a screenshot for reference and here's the code : py @commands.command() async def news(self, ctx): open_bbc_page = requests.get(main_url).json() article = open_bbc_page["articles"] results = [] for ar in article: results.append(ar["title"]) for i in range(len(results)): em = discord.Embed(title="Here's the trending news", description = f"{(i + 1, results[i])}",color = 0xa3a3ff) await ctx.send(embed=em)
smells like spam
Well it's doing what you're asking
could use webhooks or shorten that all into a single message
"for each result, send a new embed"
yea I tried to join it but didnt work
which is dumb not to have somthing like that for normal bot accs
hmm
like, why webhooks can do it and bots cant?
Doesn't discord.py have a way to just add additional fields to existing embed objects?
something like embed.addField() ?
it does
I meant multiple embeds
cant you just
str = 'These are the news \n';
for news in results:
str+=news
?
So use that in your loop, then send it outside of the loop
is that even valid syntax? 1 sec
news = (news arr)
str = "\n".join(news)
Hmmm... so like I said earlier on I'm working on this compiler for array operations in js... these two pieces of code do the same thing, but the second version is 3 times faster!!!
l = arr.length;
gp8 = "";
for (i = 0;; i < l; i++) {
_ = arr[i];
if (!(_ % 2 === 0)) continue;
gp8 += ((_ = _ * 2) + (i == l - 1 ? "" : "\n"));
}
return gp8;
let res = "";
const len = data.length;
for (let i=0; i < len; i++) {
const item = data[i];
if (item % 2 !== 0) continue;
res += item + (i === len - 1 ? '':`\n`);
}
Any ideas why the second would be faster?
I tried dat
didnt work for me
Yes
str = 'These are the news \n';
for news in results:
str+=news
em = discord.Embed(description = str);
await ctx.send(embed=em)
you need to chunk the news
wouldnt this work?
like, send a new embed every X accumulated news
Don't call it str
well idk lemme try it
Have you considered using an array.reduce?
i call it whatever i want big boi
well, isnt it a string anyway?

>>> str = 2
>>> str
2
confused py hater noises
That's not the point, I'm working on a compiler which compiles chains like arr.filter().map().join() to O(n) functions but a manual for loop is faster, even though the compiled code is almost the same as the manually written one
are you sure reduce() wouldn't be faster? did you try?
>>> str
2
>>> int
6
>>> bool
5
You can easily overwrite the datatype classes
Which is what you want to avoid unless you know what you're doing
Because to be clear, you'd only need a single reduce() loop to do all 3 of these thigns
which we clearly know i do
and on top of that, you would not need any "External" variables like res and len

Where languages are like "here's the formal name (String); use another name instead (str)" Python does a 180
if a python does a 180 it's called ouroboros
that's a 360
global variables are slow
only if it deepthroathes the tail
out of scope variables are also slower than block level local vars
oh damn its 1:37 am here, didnt even realize ;-;
am or pm
I clearly stated am
oh didn't see
lul
can i get the next iteration of a setInterval?
trying to look at proto but dunno if this si what im looking for
like, in how many ms it'll fire
get the next iteration?
ah, remaining time
yeah
store the time it executed at in the callback function
then just calculate Date.now() - the time
node has special props in its timers
in its proto at least i see some stuff
pure js doesnt
well, it is node, any way to get it?
data.reduce((acc, item, i, original) => {
if (item % 2 === 0) {
return acc.concat(item + (i === original.length - 1 ? '' : '\n'));
}
return acc;
}, '');
Try this for size?
Or this horrible monster of a compact version 
data.reduce((acc, item, i, original) => item % 2 === 0 ?
acc.concat(item + (i === original.length - 1 ? '' : '\n')) :
acc, '');
interesting
reduce is real magic, tbh
you have to calculate it
timer._idleStart against process.uptime() * 1000
I'll see if the compiled function can have a reduce instead of a loop
something like timeleft = (process.uptime() - interval._idleStart) % interval._repeat
here timeleft = a._repeat - (process.uptime() * 1000 - a._idleStart) % a._repeat
I'll try, ty
This is really weird because in the following benchmark:
const filterReduceNums = new FIter<number>().filter(num => num % 2 !== 0).reduce((acc, num) => acc + num, 0).compile(); // compiled function
filterReduce.add("FIters#filter#reduce", () => {
filterReduceNums(data);
});
filterReduce.add("Array#filter#reduce", () => {
data.filter(num => num % 2 !== 0).reduce((acc, num) => acc + num, 0);
});
The normal filter + reduce is like 12 times slower!
but only reduce is faster than filter + reduce?
invert the order now
reduce can be faster than a loop in some specific conditions because it uses the Fold algorithm https://en.wikipedia.org/wiki/Fold_(higher-order_function)
but in practice, 90% of the time a regular for loop will be faster









