#development
1 messages · Page 131 of 1
also consider reformatting your code, isn't too readable
no, but u can compose a gif with the individual frames
aight
ty
the annotation above @venady?
i removed it and still same err
Oh ok, so basically what i am trying to do is get an image and over it insert a gif i already have and then process it as a gif without losing the gf properties yk
they meant @venady itself
remove the spaces before @
ok it worked like a charm
there isn't any problem like this on js i think never thought of it
ty
you are saying u moved from js to py
using both
no problem, indentation is important in python
but only slightly important 
any clues on why this doesnt work?
when i put the variable in a f-string it returns this
what do you mean with putting it in an f string
more code with context would help more
a string with a "f" before
that should let me use variables inside it
(according to stackoverflow)
lines
this looks quite normal to me
that object simply doesn't implement toString() method
so it prints the class + address
in js it'd print [object Object]
ah
it's just some logs to keep up on how many redeem codes were generated total
each redeem code for the bot generated adds a new line in the .txt file (\n 1)
for just some lines i don't need it
well, over time it'll accumulate
why leave it for later, simply plug a sqlite db there while it's easy to do
but generated is just a number though?
still cant really do much myself with screenshots are barely show any code flow
not sure how it logged this when they only printed a number
if (blabla) {
...
// the screenshots
}
...
// where the actual error is and has nothing to do with the screenshot
it's just this code with amount renamed to generated right?
I have absolutely no idea
I have no clue what that code does either
the image of the output only shows a very slim line
so idk if it's a message or an embed body
and the code makes no sense as to output that
the output shows InvokableSlashCommand, so they're printing the command itself
then they didn't say what they actually did
do you guys know any gif extractor npm
for the frames
that can handle large files
How large are we talking?
gif and large dont exactly go well together 💀
because they are inefficent
maybe because thats their whole purpose
this one handles 200MB gifs
takes a while, but it will
i swear gifs are a dying format now since the prehistoric days of the web
now youd loop an mp4
webp animated ❤️
svg animated 
you got a point there
automatically responsive images are just nut
also being able to change colours to whatever
being able to give specific elements of the svg their own id so you can colour them specifically too

svg's in web are just so much more convienient
it was supposed to be long dead already
apng exists ffs, yet some browsers dont support it yet
and discord refuses to allow using it for anything except stickers
still remember the random shitty websites back in 2000s that had flashing gifs everywhere and was seen as looking modern
plot twist: the song "Blinding Lights" was written when the author tried to access a site in early internet
false
there aren't any claims about blinding lights
being an origin of accessing a sight in the early internet
the song is based on the streetlights blinding him while walking down the street while intoxicated
thought the "plot twist" part made it obvious it was a /s lmao
i'm not that great at getting that stuff through text
2 against 1 youre the problem child
i wasn't mad
Yes i think this one was limiting me
I am gonna have to recheck tomorrow
Its like 40mb
Nah i am on his side
2 vs 2
Beat that
die (not a death threat)

Also what i am trying to do with canvas is get the user input image and insert my large gif over it then cut the gif off based on the user image afterwards send the user the gif
The watermark is a gif
how many entries could there possibly be?
25
why are the docs lying
🗿
oh then it's perfect if you have an embed field for every entry
of course it could get very long, but it's ephemeral so it wouldn't spam the channel for everyone else
hm
just do
Key: Value
for every entry inside an embed field
yea, add a newline after every one of them, unlike what you have currently
well
since that looks hard to read
i did tried newlines before but it kinda looked really long
yea but if it looks better you should keep it
well lets see
hm ok
or just use the ID as the field name and the details as value
that could also work and doesn't look janky
looks good
this makes me angry
it basically ruins my bot
the bulk endpoint does not give me memberCount even though the docs say it should
maybe you need to provide an additional query parameter?
if not then not much you could do I suppose
maybe i'll complain on their forums
😁
my current bot does a request per group but i wanna do them in bulk
it'll be much less requests
you should, assuming that this is an unintended behavior
i can make 1 request instead of 48 requests
does it say anywhere that the bulk endpoint doesn't return member count?
no
yea then make a forum post
make sure to ask nicely
yes i am very nice
oh i can't even use the forum category for bugs
i'm not high enough level 😐
well update seems they intentionally removed it https://devforum.roblox.com/t/groups-api-v2-no-longer-returns-membercount/1261359
As the title states, the Roblox Group’s API V2 endpoint /v2/groups no longer returns the field memberCount. This issue was first detected yesterday, 5/28/2021, and has seen a consistent result. To reproduce, Go here: https://groups.roblox.com/docs#!/Groups/get_v2_groups Put a group ID in the parameters field Press “Try it out” and observe t...
this sucks 🗿
might just remove it from my bot tbh
I’ve been getting a lot of 429 errors
Would caching api responses work?
no the bot is suppose to update a voice channel with updated data on your groups member count
that would defeat the purpose
How often does that number change? And is it by a lot?
Then it probably doesn't need to be updated extremely often.
A few times a day maybe?
no every 5 minutes
Is it really that important that those stats are 5 minutes accurate? You'll want to increase the time as you are already getting ratelimited and it'll only get worse with more servers
yes
I already have logic setup to do it every 5 minutes
it ain’t changing
But you are getting ratelimited 💀
^
yeah ik
Imma just remove it from my bot
Guess that's one way to solve the problem 
because whoever made the API is stupid
why would u remove the membercount from the endpoint then not even update the docs
what’s the point of the endpoint if I can’t get the member counts
fuckkkk
The reason they removed it is probably the very same why you want it
?
wym
The reason they removed it might be that they don't want people to periodically check member counts for purposes such as renaming a voice channel
Only speculating ofc. I don't work at Roblox
but they have other bulk endpoints that provide statistics on games
why wouldn’t they do the same for them too
No clue
stupid question:
I have commands which are admin only (require Manage_Guild) permission to run..
My question is:
Is it more "practical" to:
A: respond to the user with a notification if he does not have the permissions to run that command
B: lock the commands behind discords "default_member_permissions", so that the command does not even get shown to the user
b
well, "good" news for you lmao https://www.xda-developers.com/squarespace-buys-google-domains/
that's some amazing coincidence right there
You know it's bad when you very often see "this video was sponsored by Squarespace"
That does not support discord webhooks
Hey there...
Working on a project in Next.js and I am trying to use FontAwesomeIcons however I am running into some issues...
Anytime that I have an icon component within the code, I get a hydration error.
I followed the documentation to a tee and looked on the internet.
I would just use ReactIcons however I need dynamic icons, so it's just easier to use the FA package instead once I can get some help figuring out this hydration error.
I made sure that I don't have a <div> tag in a <p> tag or anything like that
Here is my code and I have a screenshot of the error attached as well
Thanks in advance!!!
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
export default function SocialMedia({ details }) {
return (
<div className='text-center md:text-right'>
<h3 className='text-xl md:text-2xl font-bold'>{details.title}</h3>
<div className='text-md md:text-lg mt-1 flex justify-center items-center gap-2'>
<FontAwesomeIcon icon='fa-solid fa-envelope' />
<p>{details.emailAddress}</p>
</div>
<div className='text-md md:text-lg flex justify-center md:justify-end items-center gap-2'>
<FontAwesomeIcon icon='fa-solid fa-phone' />
<p>{details.phoneNumber}</p>
</div>
{details.socialMediaPlatforms.map((platform, index) => (
<div key={index}>
<a href={platform.link} className='text-xl'>
{/* i will put code here i promise :) */}
</a>
</div>
))}
</div>
);
}
And in the _app.js I have the following:
import "@/styles/globals.css";
import { library } from "@fortawesome/fontawesome-svg-core";
import { fab } from "@fortawesome/free-brands-svg-icons";
import { fas } from "@fortawesome/free-solid-svg-icons";
library.add(fab, fas);
export default function App({ Component, pageProps }) {
return <Component {...pageProps} />;
}
@plucky quail https://stackoverflow.com/questions/66459211/discord-py-leaving-a-server#:~:text=If you want to leave,%2C guild_name)%3A%20guild%20%3D%20discord.
then you need a dev

hi guys i have issue my code is no error but no resul
wow
what's the code for the image generation
what pastebin do you suggest
Pastebin.pl is a website where you can store code/text online for a set period of time and share to anybody on earth
so let me explain what i am doing
I get the image that the user sends and put over it my gif then chop off the remaining parts then i send it back to the user keeping the state of the gif
but for some reason it just sends me the image that i sent back but as a gif
YOOO I GOT IT WORKINGGG
W
ive always had issues with getting fontawesome to work on ssr
its just fucked
maybe you can try loading the library only on client side? perhaps its not ssr compatible
something like this
Gotta love SSR!!!!!!!!!!!!!!
I'll give this a shot rn and see what I can't get myself into
Yup, got it solved! Thank you so much for the help @frosty gale!!
🥰😃😀😁😆🥹😅🥵
you are sue

sorry just got very excited for a second
Buy Me A Coffee and Ko-Fi are similar as they allow creators to accept one-off donations, memberships, and create a shop. The difference is that Ko-Fi offers more features and takes a 0-5% cut, and Buy Me A Coffee offers less and takes a 5% cut but allows supporters to easily donate without creating an account.
why does it have to be coffee
I like buymeacoffee branding more but ko fi seems better
that’s the name of the website
THIS
thanks for the business idea im on it now
i found a gap in the market finally
lmk when you get this up and going
kofi looks more art like
i need this. now.
I would use coffee
Especially if you have a broad demographic.. Older people tend to not like to make accounts
Ko-fi also automatically deposits the money into your account
with buy me a coffee u can only withdraw once a week
u don’t need to make an account for ko fi
Did I read it wrong?
yes
that’s wrong
BUT, if you have a demo that is younger, then accounts don't matter, so ko-fi would be better
u can donate on kofi without an account
ko-fi seems to have a lot more benefits tbh
meanwhile here i am with patreon eating a piece of my pie
real
and they don't check name
idk where your getting that from
I use it and I'm a minor 
to signup u need to give them id
not in the UK 
buymeacoffee is being a pain in the ass to withdraw with
i'm in the us and i'm all gucci 
prolly cause you're under 18
so how would they know that

and if they did I would simply lie
above my paygrade
PayPal is different cus u need to actually prove ur 18+ lol
but if they find out you lie
that's fraud
found that out the hard way when I had lawyers in my email 
So now anytime I need to be over 18, I just create the account under my moms name and DOB
they won’t
how they suppose to find out
unless u tattle rn
by asking when your account is under review
then u gucci
i wanna doordash me some McDonald’s with this
but they taking too long
after I withdraw this I’m deleting my account and moving to ko fi
can't lie to your bank account
and the bank account wont lie to them
business idea: make a website thats in the middle of kofi and buymeacoffee and offer fast withdraws, low transaction fees and no account needed
It’s through stripe
stripe knows your identity
chloe finna be the new berkshire hathaway
i hate stripe idk why every single business feels like using it
their transaction fees arent even competitive
imagine using supporter donations to eat mcdonalds
u can use Stripe with parental permission
so I just need my parent to give me their id
only the first one is from a supporter
they still know who are you tho
I will use that towards hosting my bot
the second one I fixed someone’s code for
(i will use that for McDonald’s)
i remember being able to disable the option of automatic transfer to bank
seems like it's not an option anymore
nice refill
whats a refill
: to fill again : replenish. intransitive verb. : to become filled again.
yeah but
from what
either from his own money or from the outside, aka he got paid
i prefer thinking he got paid, so im congratulating him
is that enough info for you or should i make you a drawing and a powerpoint presentation?
that’s ok
rich kid
lmfao
wait
this is development
i was supposed to come here and ask something
so big question is i am working with gif's
i insert a transparent gif and insert it over a png with canvas
and it comes out as not transparent
my favorite chat
@frosty gale got any clue how i can keep the transparence of an gif when i put it over a image using canvas
I'd wonder how to use canvas with gifs at all
import { createCanvas, loadImage } from 'canvas';
import GIFEncoder from 'gifencoder';
import extractFrames from 'gif-frames';
import streamToBuffer from 'stream-to-buffer';
really? I need 3 stupid packages just for that
kind of
i might not be doing it in the best way possible
what do I do when I have imported those packages? (yes spoon feed me)
I wanted to add gif support to my image server a while ago but didn't manage to do it
let frames;
try {
frames = await extractFrames({ url: watermarkGifUrl, frames: 'all', timeout: 120000 });
} catch (err) {
console.error(`Error extracting frames from GIF: ${err.message}`);
}
console.log(`Extracted ${frames.length} frames from GIF`);
i extract the frames off of my gif
why doesnt discord embed that image 
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
now I know why I didn't continue on image generation
I had a troll on there taht people get a verified twitter badge
lemme deploy that again
you can do encoder.setTransparent(color) where color is the color you want to make it turn transparent
so if it's a gif with a green screen you can make the color green and that'll become transparent
oh right
shit
@slender wagon 
my bot is so fucking smart
💀
can u measure text in canvas without
no
i want my canvas width to be based on text width 😳
so the thing is, the gif i input is transparent and when i set it over the other images the transparent part becomes black. the setTransparent(color) will probably get rid of other stuff in the pic
without context
u cant measure something without context
why
i wanna make my canvas width based on text measurement
...just think about it for a split second
how tf would u measure something without context? (so no units or scales or anything)
well, how can i do the above
you still need to spawn one context then measure it
but thats inefficient
you are inefficient
see, the thing is, browsers have different scaling (be pixel density or zoom etc.), leading to the graphics being rendered with different physical size
the only way to determine its size is by actually rendering it
which is, you need to create a context
for fast and efficiency you can use a single canvas context instance for quick calculation, assuming they have the same scaling
you want faster stuffs? consider not bothering with javascript and learn rust / c++ or sth
compared to other canvas operations, measuring text is really insignificant in terms of performance
as if the application is time-sensitive /s
nanosecond counts yk

so i need to create 2 canvases
no
lol
measure it on the same canvas you want to draw on
but i need the canvas to be the same width as the text
he wants to create a new canvas with the text width, so he doesn't have any context
can u resize canvas?
check what I sent
so in conclusion i need to
I'll keep this image stored, so many contexts I can use it for
yes yoi can resize
create a canvas
draw the text
measure the text
create a new canvas with dimensions
put the text
append it
how
yeah ^
but if you could resize might as well resize
canvas.height = y
canvas.width = x
ah so you can do that
ok
so i will make width of canvas 0
measure text
then make it measurement of text
sure

can canvases have 0-length sides?
yes
same way there are 0 length strings, arrays, buffers, vectors, etc
maybe :^)
well i never tested
idk if there's a technical reason for that
like, at minimum I can make a 1x1 context, but never 0 area
did u set any size?
there shouldnt be any technical reason
huh
pt is valid
exdee
js has too many font units
css
but normally you would do the
ctx.fontFamily = 'Menlo';
ctx.fontSize = '50pt';
ctx.fontStyle = 'bold';
oh I've always done the former
same lel
or ctx.fontFamily = 'Menlo Bold'
but this way is nicer
The canvas rendering context uses a CSS-style format for the font property, pt is for points
how many teemos is a point?
Sayuri gone

thanos'ed
what if
if you set yourself with negative size
you become inside out instead
did you solve it? do you want to put a single frame of the gif onto the canvas or what
vertex swap
iruysa
some shitty video service tried charging me extra without my consent for trial by giving my card details to some random service
luckily i was using a virtual card tho
Lol
what i did in revenge was wrote a script which downloads all the parts of the videos and then combine them later in ffmpeg
(because you need to pay extra to download videos)
i feel better now
exdee
there's a slight detail about transparency in gif
it obtains a session based url somehow for the video and its literally just like "https://website.com/video/3825/part_number.ts"
you see, gifs don't support transparency, just like jpeg
cuz gifs are technically animated jpegs
learn something new every day
what it does is, instead, use the index-0 color as a mask color
so if that color is, for example, black, every single black pixel in the image will be transparent
but for the gif, it'll still be black
this is why transparent gifs are so choppy and aliased
it can also only hold 255 colors
im still not 100% sure what you want to do
so, anyone know why it looks like this? if I remove canvas.width = variable it looks fine
do you want it so a gif plays on top of the image or a single frame of the gif is shown on top of the image
making animated profile cards does have its toll (supposing that's what u want it for)
you'll also make it incredibly dithered depending on the number of colors (and really big, usually 4-5x as big as the sum of the original file sizes)
is this what its supposed to be
yeah
nope it's just for a watermark
going over an image
ah, well
do u really need to use gif?
if u just want an animated image use webp or apng instead
yes, both support transparency and the whole int32 range of colors
basically the same as png
i think i know why my image looks low quality
is it because i'm sizing up my canvases width from 0
while being tiny compared to gif
I am gonna have to contact the artist who made the watermarks since this project isn't mine
and ask them to convert it most likely
got any clue about their size cuz the current gif is like 40mb
A couple hundred kb usually
Depending on length and dimensions
Damn
It's not that animated images are big, it's just that gif is terribly inefficient
why do people use it then
If u ask someone "do you know what is a gif" they'll definitely know it
Not so much for webp and apng
true
Any other format
gif is a really popular name
is it because gifs technology is outdated
It was born outdated
But it was good enough
Plus it was innovative, people went bananas over it
They can't really switch until every browser and device supports it
U can for sure use apngs in ur site, but some devices might not be able to show it
Support is big already, but not 100%
That's not what passive aggressive means
yes sure
so I'm trying to convert my emoji reaction to button and I was able to make them work but I'm not sure how to make the button style change color base on what button was clicked on. also I'm using discord.py. is there maybe a better way to do this?
ops forgot to fix the graybutton class
can a bot create/join a GroupDMChannel?
you should make a proper handler
to change the color u need to set the style to either SUCCESS, PRIMARY, SECONDARY or DANGER
being blue, gray, green and red respectively
ok, also green does work.
do you have a example of a proper handler?
Not in js
I don't know any good example project
Only one I can speak about is in java
Python whatever
Doesn't matter, my point still stands
Pagination utils on google
or whatever Java handler u were referring to
what
oh ok
The way I do this in JavaScript is just edit the reply and send a new component with the correct buttons and color for your buttons
How do I read this?
'x-ratelimit-limit': [ '2' ],
'x-ratelimit-remaining': [ '0' ],
'x-ratelimit-reset': [ '1686992861.526' ],
'x-ratelimit-reset-after': [ '3.895' ],
My bot has been rate limited for about 12 hours now

thats not a global rate limit
its a regular rate limit, its telling you that you can do 2 requests and you have 0 left, and it will reset in 3.8 seconds
so you probably are allowed for 2 requests every 5 seconds, but you are consistently doing more than that
I have no idea what's going on then, it's been happening for 12 hours lmao
And I've just began a recode and it only consists of the sharding manager
You want to see the code?
It's just one file and I can't see any loops / reason why it would try to login multiple times
if you're working with sharding, make sure you are properly queueing shards, as discord only allows one shard to connect every 5 seconds
unless you have a large bot (150k+)
ohhh
no
28k
const settings = require(`../settings/client.json`);
const { ClusterManager, HeartbeatManager } = require(`discord-hybrid-sharding`);
const manager = new ClusterManager(`./index.js`, {
totalShards: `auto`,
shardsPerClusters: 4,
token: settings.tokens.production,
mode: `process`,
restarts: {
max: 10,
interval: 1000 * 60 * 60 // 1 hour
}
});
manager.extend(
new HeartbeatManager({
interval: 2000,
maxMissedHeartbeats: 3
})
);
manager.on(`clusterCreate`, cluster => {
console.log(`[clusters ${cluster.id}] Cluster has been launched.`);
cluster.on(`spawn`, () => {
console.log(`[Cluster ${cluster.id}] Cluster has been spawned.`);
});
});
manager.on(`debug`, message => {
console.log(`[Manager][Debug]${message}`);
});
try {
manager.spawn({ timeout: -1 });
}
catch (error) {
console.error(error);
}
module.exports = manager;
process.on('unhandledRejection', function(reason) { console.log(reason.headers) });
We are utilising discord-hybrid-sharding though so we can get clusters
i dont know the internals of discord-hybrid-sharding, but its not a good idea to override some of their internal stuff, like the heartbeatManager and the timeout
better leave those as defaults
yea
I'm not sure why they were added tbh
oh actually
it was used so that if a cluster was offline for longer than the interval & missed heartbeats, it would get them back online
yea thats how that works
The discord gateway needs certain information to perform a reconnect, ovveriding internal stuff like that will not end well
So I shouldn't have this?
hmm okay
any idea on the rate limit tho? lmao
I still can't fathom it out
Not sure if this helps but: 'x-ratelimit-scope': [ 'user' ]
I looked on discords api site but I can't really understand it properly
I haven't touched the discord api or websockets in ages, so I don't know if I will be of any help in this regard.
it seems like it's trying to launch the same shard at a time.
const settings = require("../settings/client.json");
const { ShardingManager } = require('discord.js');
// Create a new instance of the ShardingManager
const manager = new ShardingManager('./index.js', {
token: settings.tokens.production,
totalShards: 'auto', // Set 'auto' for Discord.js to automatically determine the number of shards
});
// Spawn the shards
manager.spawn();
// Listen for the 'shardCreate' event to know when each shard is ready
manager.on('shardCreate', (shard) => {
console.log(`Launched shard ${shard.id}`);
});
I'm trying it using the Discord.js package instead and it does the same thing.
Launched shard 0
Launched shard 0
node:internal/process/promises:288
triggerUncaughtException(err, true /* fromPromise */);
^
[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "#<Response>".] {
code: 'ERR_UNHANDLED_REJECTION'
}
Node.js v18.16.0
assuming this would be the rate limit error
yup
thats just an uncaught promise
nothing about the actual limit
can you manually make a request to the discod api using a rest client?
if so, try fetching the gateway endpoint, and maybe then you can see the actual rate limit information
but usually when you get limited on the gateway itself, it usually lasts for 24 hours
I've got it working on my testing one
It's a problem with the production environment or something
Back to this one (using discord-hybrid-sharding):
const settings = require(`../settings/client.json`);
const { ClusterManager } = require(`discord-hybrid-sharding`);
const manager = new ClusterManager(`./manager.js`, {
totalShards: `auto`,
shardsPerClusters: 4,
token: settings.tokens.production,
mode: `process`,
restarts: {
max: 10,
interval: 1000 * 60 * 60 // 1 hour
}
});
manager.on(`clusterCreate`, cluster => {
console.log(`[clusters ${cluster.id}] Cluster has been launched.`);
cluster.on(`spawn`, () => {
console.log(`[Cluster ${cluster.id}] Cluster has been spawned.`);
});
});
manager.on(`debug`, message => {
console.log(`[Manager][Debug]${message}`);
});
try { manager.spawn({ timeout: -1 }); }
catch (error) { console.error(error); }
module.exports = manager;
This is the manager file:
const { GClient } = require(`gcommands`);
const { GatewayIntentBits } = require(`discord.js`);
const { ClusterClient, getInfo } = require(`discord-hybrid-sharding`);
const { join } = require(`path`);
const settings = require(`../settings/client.json`);
const client = new GClient({
dirs: [
join(__dirname, `commands`),
join(__dirname, `events`)
],
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.DirectMessages
],
partials: [`CHANNEL`, `MESSAGE`, `REACTION`, `USER`],
shards: getInfo().SHARD_LIST,
shardCount: getInfo().TOTAL_SHARDS
});
client.cluster = new ClusterClient(client);
let environment = process.env.NODE_ENV;
if(!environment) environment = 'staging';
try { client.login(settings.tokens[environment]) }
catch (error) { console.error(error) }
module.exports.client = client;
if the code is the same in test and in prod but the problem only happens in prod, then it could be a cloudflare ip ban
although those should only last for 1 hour
yeah i have no idea
you're only running it once right? you're not using anything like pm2 cluster mode or similar
Does somebody know what I'm doing wrong here in this counting game
const arg = message.content.trim().split(/ +/g);
if(!isNaN(Number(arg[0])) && !message.stickers.first() && !message.attachments.first()) {
let channel = await db.get(`countingchannel-${message.guild.id}`)
channel = message.guild.channels.resolve(channel)
if(channel && message.channel.id === channel.id) {
let count = await db.get(`counting-${message.guild.id}`)
if(count) {
console.log("4")
if(message.author.id === count.user) {
await db.delete(`counting-${message.guild.id}`)
console.log("5")
let embed = new Discord.EmbedBuilder()
.setColor("#C73D43")
.setDescription(`${message.author} ruined it at ${count || 0}!`)
message.reply({ embeds: [embed] })
} else { console.log("6")
if (Number(arg[0]) === count + 1) {
console.log("7")
count++
await db.set(`counting-${message.guild.id}`, { count:count, user:`${message.author.id}` })
await message.react("✅").catch((err) => {});
} else { console.log("8")
if(!arg[1] && message.author.id !== user) {
console.log("9")
await message.react("❌").catch((err) => {});
await db.delete(`counting-${message.guild.id}`)
let embed = new Discord.EmbedBuilder()
.setColor("#C73D43")
.setDescription(`${message.author} ruined it at ${count || 0}!`)
message.channel.send({ embeds: [embed] })
}
}
}
} else {
console.log(arg[0])
if(arg[0] === [1]) {
console.log('hi')
await db.set(`counting-${message.guild.id}`, { count:1, user:`${message.author.id}` })
await message.react("✅").catch()
}
}
}
}
Whats the error
there isnt a error
So what's the problem?
How do I receive the name of those who voted for my bot, given that the hosting where I host my bot does not have a fixed ip?

just started learning about building stuff so here ya go, still pretty new abt it 🦖
whenever my server has been ratelimited it shows that for all bots give it a few hours
i've waited over 12 hours
nope
rip
.endsWith 🔥
Btw you can use the slash command builder (SlashCommandBuilder) class which is more intuitive to use, it validates input types and also provides good typings to help you catch bugs easily
i do for every other command
but v13 does not have the .addAttachment thing
Oh, why are you using v13? 👀
its a bot i wrote last year and i cba to port it over
i'd have to move over a lot of stuff and i tried in October and gave up
partly because the method i used for disabling buttons no longer works 
I can help you migrate to v14 if you want
Yeah but you can take the component, and construct new components from them and adjust the data
Basically: new <ComponentClass>(<Component>.toJSON())
ah
so your deleting the old button list and adding a new one?
Yes
ok will look into how to do that in discord.py
is there any reason why they use it.remove()?
i mean, we are returning the result, so why wouldn't result.add() be enough?
Is that Java?
yer
I don't see why they're removing the current element from the collection through the iterator, especially considering that Java is always pass-by-value, you can't pass-by-reference
If passing-by-reference was possible in Java and it actually was passed by reference, there would be a reason to remove the elements as it would affect the argument passed to the method, but since this isn't the case I don't see a reason for them to do that
I feel like they want to reduce memory usage while the values are being added to the other collection, instead of waiting for the programming language to free it up after the function ends
Oh wait, nvm, I mistook the context
They do that so the number of elements stay constant
And what is the expected function you want to get ? But it doesn't do it?
I already fixed it lmao
does anyone know how to ban a user without using a command?
I'm trying to make a global ban list using trello and I'd like to ban the user in all servers the bot is in when they get banned from one.
right click -> ban member
if u want to ban without using the mouse simply do the same way u do with a command
same way as making a command
that said, this is a heavily opt-in feature
as it can lead to account ban if done wrong or without consent
Yeah that gives a lot of power to server moderators
Well the ban system if for a bunch of sub servers in a main server
so the mods of the main server can ban someone from the main and all the sub communites
then yeah, do it as if u were making a command
you might need to setup express tho
to be able to receive requests from an external service
My current solution is just storing all the servers the bot is in then banning them for each server
not sure how effient that is
that's how u do it
alr cool
u cant ban in any other way
only members with BAN_MEMBERS perm can ban, so using the bot is the only way to achieve it
my favourite bot permission is the join servers for you permission
that's an application perm, not bot
same thing :(
to be more specific, a scope
not all applications are bots
they go hand in hand
nope
yes
for example, sites and games are applications
bots are just a type of application
but some applications can be different :)
its ok we dont discriminate
some have bots some dont
but theyre all equal
...idk if ur being sarcastic
youre too serious
from discord import app_commands, option
ImportError: cannot import name 'option' from 'discord'
uhh am I importing option wrong?
show code
its saying option is unused
thats cuz i commented out the part that was using it
is option supposed to be the slash command option?
yes
ah, then yeah u dont need to import, it comes with the command itself
This is a true programmer speakkng. Only fix it once it becomes an issue and if you work for riot games don’t fix it at all
alr back again. Something is wrong with how im pulling data from my trello
Anyone know whats the issue?
def ping(f_stop):
now = datetime.now()
print(now)
id = os.environ['blacklistID']
url = f"https://api.trello.com/1/lists/{id}/cards"
query = {'key': APIKey, 'token': APIToken}
response = requests.request("GET", url, headers=headers, params=query)
res = json.loads(response.text)
url2 = f"https://api.trello.com/1/lists/{store}/cards"
query2 = {'key': APIKey, 'token': APIToken}
guilds = requests.request("GET", url2, headers=headers, params=query2)
for v in res:
print(v["name"],v["desc"])
for guild in guilds:
print(guild)
a = json.loads(guild) # Error is here
print(a["desc"])
member = guild.get_member(v["desc"])
if (member):
member.ban()
if not f_stop.is_set():
# call f() again in 60 seconds
threading.Timer(60, ping, [f_stop]).start()
error
Have anyone did math command? I need a command to calculate expression. Eval() isn't safe. I tried sympy, but it lags when user inputs very big number like "9^9^9^9^9", and same with similar modules.
You could use an api like wolframalpha, I think that’s free to use
can I just make aware of this shid path name
It has only 2k/month
And it's too much for just math expressions
replit 🗣️
https://github.com/engineer-man/piston#Public-API you could look into just doing eval() on this, would probably work fine
Could also maybe use docker + child process
Or just build your own expression parser 🧌
its replit i have no control over that lol
replit skill issue
fun fact, mathjs has their own API so you don't have to use it in your machine and have it potentially crash your bot (not like you could anyway, since you use python)
https://github.com/flazepe/aeon-rs/blob/master/src/commands/utility/calculate.rs#L22
https://api.mathjs.org/v4/?expr=1%2B2
(1+2 encoded for expr for example)
I believe the API still crashes for big numbers (last time I tried it did) so you might need to handle that
9^9^9^9 returns Infinity, so I think it should work
Lol, copilot knows something
@thorn tulip #commands message
oh sorry, ignore (it didn't copy the link properly somehow)
^^
One problem that it is calculates this for few seconds
result = 5 + 6 ❌
result = await fetch("/api/solve?expression=" + "5+6", { method: "GET" }).then(r => r.json()).answer ✅
I believe the query parameter is called expr
but yeah, it returns plain text
this was a joke to say you should offload addition to some api instead of your cpu
its doing enough work as it is give it a break
So it only returns either answer, Infinity or Error?
maybe 
Dividing by 0 returns []
goofy api
will try it
postman is so shit is there a better open source alternative
postman become bloated proprietary business monetary shit
i'll just use curl
approaching postman territory but fine
136mb http client yes please
could fit an entire game in that
thanks electron
cant do simple algebra trash api
Why 5:5 is [5], and 5+5 is 10
maybe : can return multiple numbers depending on input idk
And why 10:2 returns []
because it doesn't go backwards ig
goofy api
Hah, so 1:10 will return list
thats pretty cool it can do variables
I didn't see it
So now I got it
It tries to create a list from 1 to 999...
yup
I'm replacing : with /, as I don't need it
what is someone did 1 to 9999999999999999999999999999999999999
ah it does it in a special timed worker that has a timeout
smart
ah yes the ole 1:9999999999999999999999999999999999999999 trick
it do be like that sometimes
Yesterday I was trying to calculate daily compund interest using formula for years
Hah
Like this
bros gonna make his own bank now
business idea: make a bank in a discord bot that supports mastercard and visa
!loan 500000
And crypto
I have economical bot
So u can make customizable virtual economy on server
day 500 of asyncio pissing me the fuck off
mimimimi loop already running
fuck you asyncio
i use Thunder Client personally
it's a vscode extension
python users having to import asyncio while js users simply use await
cant use an await outside an async function
you gotta promise it too
but its more easier to do in js
on python you need a fucking degree in that shit
python has weird af classes too
nah these are fine
why tf do you need to use __init__ for a constructor like youre accessing some super secret method that youre not supposed to use
just name it constructor or the class name bro 😭
yeah but the underscores
constructor sounds like you're making some sort of blueprint for a class rather than initializing it
actually kinda makes sense
i think they wanted to go with the flow of adding funcitonality to classes
so you can make a class stringify in a special way with __str__
and you can go from there
not a fan of passing the self parameter everywhere though instead of the class doing it automatically
you wouldn't like rust then
classes do this low level under the hood but out of all languages i wouldnt expect python to expose this kind of logic
c++ doesnt even do it
fuck python
literally on the edge on just giving myself pain and doing this discord bot and fucking webserver in plain c
literally so easy to setup an express server and discordjs and have them run in parallel
my manager wants me to do that lol but as a learning experience
how bad can it be
its just tcp and some special letters
what’s a good way to measure the rate limit on an endpoint?
reading the docs
by spamming the hell out of the API (don't actually do this)
they don’t document the rate limits
Then Ratelimit headers
there aren’t any
ask them
try first
and if they do it’ll take a long time
still, it's not that hard to ask
no
exactly
there’s no point in asking
maybe there is
it takes 10s max to write an email
I’ve searched
or whatever form of contact they use
maybe because nobody asked
lol that sounded rude
I was told this by a guy who is very experienced with the API
bc I am having rate limiting issues
Why don't they just tell you the Ratelimit
idk
Moment
because they don't know
but how can I test it to see what it is
every time you make a request, log the timestamp and response from the API
ok
also it’s kinda weird
he told me non residential IPs have a more strict rate limit
maybe that'll give you a glimpse of how much requests you could make under a specific time window
so that means I need to run it on my server to see
which is going to be annoying
😵💫
motherfucker knows about that but doesn't know the actual rate limits
honestly I'm just going to remove that feature from the bot
the rate limiting is way too strict and it have no scalability
🙃
just did some testing and it seems I can make 100 reqursts before getting ratelimited
now lets see how long it takes for me to stop getting 429s
100 requests under what? a minute?
well
instantly
not instantly but
like a few seconds
i'm going to test with an interval to see if it does the same thing
yeah do every 1 second
ok
i did 2 seconds
and it lasted the same amount of requests
and this is on my home ip too if it's stricter on server IPs 😵
How do I fix this? As you can see on the right, the scroll bar is not all the way up. Whenever the website launches, it automatically scrolls down to there instead of the very top of the page. I don't know why.
You're not getting any x-ratelimit headers from the server? For most apis the http headers themselves contain all relevant ratelimit information that you need
no
Roblox's API is primitive
no documented rate-limits nor headers
✨
The <br> tag is causing it to scroll down, but I need those extra lines there. How do I get it so that the site doesn't immediately scroll down?
I'm using the Top.gg Autoposter but, all of a sudden, it stopped sending regular updates. It only will send an update upon startup of the bot. No errors are logged either. Has anyone else run into this issue? I'm using the shard version
Owo vote is 404
You expecting the roblox web api to be of any use is hilarious
They couldn't give any fucks
How hard do you guys think it would be to setup a file hosting service like meganz or any other ripoffs?
not hard
if the ignore the security aspects ofc
just a simple upload page, send file to backend, store in a folder, store a key for that, send when requested, done
also ignoring the aspect of what can and cannot be uploaded
or have a pogu project and make your own one 
or I can do it myself
Something like that would definitely be a must
Especially making sure nothing illegal is uploaded
Last I want is a repeat of mega

That won't do shit
Discord itself had an influx of illegal content
one thing you can directly enforce natively by cloudflare is csam scanning
csam?
Ah
cloudflare has that as a scanning tool
movies etc can probably just be removed manually
so would need a reporting system
if thats in js, might wanna help since I'm kinda thinking about going into js
The thing with a file "safe" is you don't want people to know what you are storing unless you're openly sharing it
So a report system is really out of the question here.
At least
In terms of private files
Publicly displayed files can still be reported, but something else will have to be figured out for anything private
While also not giving off the sense of an invasion of privacy
I do plan on using js/ts for this
if your file is publicly shared, people will report it and you can then act on it
yeah
im up for trying something like that at some point ngl
I'll appreciate the help if you do wanna help
One thing I can say is if they get too many reports, their account can be under review meaning all files public or private is exposed to the moderator. Yet, they could also just never have public files to be reported so idk.



