#development
1 messages · Page 264 of 1
Though prefix commands are old school and slash commands honestly are more powerful
Tech debt piles up, you should eliminate it when possible
https://trycatchdebug.net/news/1438629/discord-py-bot-cog-slash-commands
That website was the most I seen on how to use slash commands in cog files stuff but the stuff listed there is wrong since it shows errors for me. I copied everything on there exactly since I need example code that works as the main thing. This how it looks.
This article provides a guide on how to create slash commands for Discord.py bot cogs, building upon the knowledge of normal text commands.
intents = discord.Intents.default()
intents.typing = False
intents.presences = False
bot = commands.Bot(command_prefix="!", intents=intents)
bot.add_cog(SlashCommandCog(bot))
bot.run("BOT TOKEN")
import discord
from discord.ext import commands
class SlashCommandCog(commands.Cog):
__name__ = "slash_command"
def __init__(self, bot):
super().__init__(bot)
@commands.slash(name="hello", description="Say hello to someone")
async def hello(interaction: discord.Interaction):
await interaction.response.send_message(f"Hello, {interaction.user.mention}!")
Because indents matter
For folks that implement cooldowns for their slash commands, what is your preferred method? I've been using a redis cache with a TTL expiry (which works fine), but just curious if other folks do anything different. I thought about using the database as the source of truth, but felt that it would be wasteful.
hashmap where you store the time the command was used with the key being the user and every time a person runs the command you check the hashmap and if x time has elapsed since last use if user already exists
the only annoying part is automatically clearing out old keys so they dont just sit around and collect
theres libraries that implement hashmaps with key expiry though so id use those
but they probably all just iterate over the entire map in an interval and check for expiry which can scale badly
Thanks for responding! In this case, my solution may be more convenient. I check for the existence of a particular key. If it exists, it means they're on cooldown. If it doesn't, it means they can proceed. After the operation is complete, I create a new hashmap entry with a TTL that expires when the cooldown is complete.
if your app is serverless and/or horizontally scaled, then yeah, redis is a good option
but with slash commands it doesnt matter much because discord has their own cooldown for them
unless its something that is part of your bot, like game/currency stuff that the user can only do it once every X time
Correct - this is domain specific to the application I've built. That's a great point.
how do i make the embed colorless or invisible? Like apollo
Do you have an example?
Pretty sure you just don’t assign a colour?
If you don't specify any color, it will automatically be black afaik
They probably specified the background color of the embed as the color, which makes it look as if the color bar was not there
well still the same with no color assigned to the embed
I'm still trying to find example code of how slash command with cog files work. I got the regular cog file for regular prefix command.
ohh thats easy to setup
Just use a colour picker on the default embed colour
I just found example code for it and to my surprise it worked. But it uses "bot" instead of "client" and get to translate that.
The default Discord dark mode background color is #36393F, but This removes the rounded corner. I opt for the default Discord dark mode embed color which is #2F3136
It appears as though the default Discord dark mode background color has changed since I last checked. I use a nitro theme typically
I will have to get the hex codes again :(
If the command cooldown is longer than a few minutes it'd be better to store last usage timestamp and compare when ran
This way you don't need a second database and guarantee unexpected shutdowns don't affect it
redis is ephemeral data anyways
Anybody knows how to make a slash requirement optional for a str based answer?
For example.
"Enter your question."
But have it be where they don't have to ask a question.
Good news I figured it out.
It's not in this case – my cooldowns are 3 - 5 seconds
It takes one hour for slash commands to appear on other servers, right?
I used a direct thing to make them appear in my server right away for testing and just want to be sure.
Not anymore, pretty much instant
Really? Cause it only appeared in my test server.
If you're posting to a guilded commands endpoint then that will be the case.
Global commands will appear within 10 seconds or less typically
Guild commands are also instant
It was only during the initial release of slash commands that they took an hour to appear in all servers
self.tree.copy_global_to(guild=MY_GUILD)
await self.tree.sync(guild=MY_GUILD)
I think that might be reason.
I'm new to slash commands so don't curse me out.
Just gonna copy/paste here and keep looking online and hope I get lucky.
Here is the current code that works perfectly, but it ONLY works in my test server with the test server "MY_GUILD" id number I use. Does not work in the other servers the bot is in. How do I make it work for all servers? I am new to slash commands. I have it set up where both prefix and slash commands can be used in both main file and cog files and want to keep it that way.
import discord
from discord.ext import commands
MY_GUILD = discord.Object(id=123123123123123123) # replace with your guild id
class DiscordBot(commands.Bot):
def __init__(self):
super().__init__(
command_prefix = '?',
intents = discord.Intents.all()
)
async def setup_hook(self):
await self.load_extension('cogs.Weather2')
await self.load_extension('cogs.Fraction')
self.tree.copy_global_to(guild=MY_GUILD)
await self.tree.sync(guild=MY_GUILD)
client = DiscordBot()
client.run('Token')
I got it figured out.
is this discord.py?
Cause with dpy it is rather easy to use slash commands with cogs from what I recall
Late reply, but yes that is discord.py. Apparently all that was needed is to remove one line of code.
I got headache from discord buttons. That stuff is hard to my surprise. Sure making a simple button is easy enough, but you can't use it in a while loop since it ends in a def function with no escape. I checked and the code ends when it gets stuck in the REQUIRED def function for the callback of the button.
you're just using the wrong approach for the problem
there aren't any limitations of what you can do with buttons, it's just that you need to develop your own solution if you want to go fancy
Hey anyone want to help test or try out Dev Space 👀 DM me for instructions.
Dev Space is a going to be a tool for other developers with server/project/website/logging/status management tools, dev tools like image gen/edit and bunch of other tools inspired from stuff like Sentry/Portainer/Pterodactyl/HetrixTools
You will need to already have nginx setup, 2GB ram minimum server and optionally MongoDB (Automatic install may work)
Demo version: https://devspace-demo.fluxpoint.dev
Changelogs: https://docs.fluxpoint.dev/devspace/changelogs
Source: https://github.com/FluxpointDev/DevSpace
server.js
app.post('/api/institution/studentRoster', (req, res) => {
const { institution } = req.query;
console.log("Request body:", req.query);
if (!institution) {
return res.status(400).json({ error: "Institution name is required." });
}
const institutionData = institutionlist.find(inst => inst.name === institution);
if (!institutionData) {
return res.status(404).json({ error: "Institution not found." });
}
const students = studentList.filter(student => student.institution === institution);
res.json(students);
});
api calls.js
export const fetchInstitutionStudents = async (institutionName) => {
try {
const response = await fetch(`http://localhost:3080/api/institution/studentRoster?institution=${institutionName}`);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error("Error fetching institution students:", error);
return [];
}
};
let s = await fetchInstitutionStudents("red");
console.log(s);
I dont understand why req.query is empty
Warning: Module type of file:///C:/Users/x/Desktop/ReactProject/ReactProject/src/apiCalls.js is not specified and it doesn't parse as CommonJS.
Reparsing as ES module because module syntax was detected. This incurs a performance overhead.
To eliminate this warning, add "type": "module" to
the request body: {}
Are you sure that your API framework’s object name is req.query
no i am not sure what i am doing
Also, do you have it backwards? Isn’t it (res, req) not (req, res)
The order matters, if I am not mistaken the first argument is the response and the second is the request object
But I’m not sure, never used that framework
Ohhhh I see the issue
i am sure its req res
Your endpoint is set up as a POST endpoint but your fetch call is by default a GET request
Your endpoint should be a GET endpoint
const response = await fetch("http://localhost:3080/api/institution/studentRoster", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ institution: institutionName }),
});
this isnt working either
Because that’s not right
Make your endpoint a GET on your API
You are requesting information, you should not be using POST
oh

This is starting to look like shit
@radiant kraken @civic scroll
🙏
Out here looking like Steam's default page for profiles
😭

calm down
why not design the main page first
just put all the information on there first
this is too early to make a verdict
you should plan out though figma first
what's the main page about
why?
but it's better to plan things out ahead first
Not through figma tho
designing on the way is the best 
so pro
wdym
everyone starts somewhere :pat:
i will see if i can do something about it
but as far as things go it's already pretty well for a quest board
whoa thankss!!!!
tbf i'm now questioning whether my design is implementable 😭
anything other than a rect is not my thing
@pearl trail oh yeah
you can also reference other quest screens in other UIs for inspiration
wth
looks so 🔥 🔥 🔥
wish i got designing skill 😔
so like from google?
wdym you two are gods
look at ur website
does changing the white background from paypal's smart button make a trouble for me?
like legal stuff that i dont understand
ummm
I don't think it would. You're not touching the logo, just a white background
okii thanks
L my website is international
celebrating my yummy isp ipv4 subnet in new year
this is exactly how i feel right now
didn't know AI can change their mind in the middle of generation 💀
If this is gpt o then not surprising as it has so much more time to think and fact checking steps
true but this happens before writing to the user, changing their mind mid writing is rare but i have had it happen too.
I think its pretty cool, shows how well we can simulate human thought process.
anyway to get my bot's status on topgg?
Using a grid system, how do I center it on the page? I tried wrapping the grid in a flex box and aligning it on the center but that messes with the headline
I dislike the gap differences between the right and left
Messes with the headline how so?
It puts it next to it
Despite me using a different flex direction
I managed to get a desirable outcome
Except the title is not lined up
How do you want the title lined up?
i came up with this
but it yields the same
<div>
<h1 class="text-6xl underline pb-4 ">Products</h1>
<div class="flex flex-col w-full items-center">
<div class="grid grid-cols-4 gap-4">
<RadzenCard Variant="Variant.Filled" class="w-96 h-96">
<RadzenText>Hello</RadzenText>
</RadzenCard>
<RadzenCard Variant="Variant.Filled" class="w-96 h-96">
<RadzenText>Hello</RadzenText>
</RadzenCard>
<RadzenCard Variant="Variant.Filled" class="w-96 h-96">
<RadzenText>Hello</RadzenText>
</RadzenCard>
<RadzenCard Variant="Variant.Filled" class="w-96 h-96">
<RadzenText>Hello</RadzenText>
</RadzenCard>
<RadzenCard Variant="Variant.Filled" class="w-96 h-96">
<RadzenText>Hello</RadzenText>
</RadzenCard>
<RadzenCard Variant="Variant.Filled" class="w-96 h-96">
<RadzenText>Hello</RadzenText>
</RadzenCard>
<RadzenCard Variant="Variant.Filled" class="w-96 h-96">
<RadzenText>Hello</RadzenText>
</RadzenCard>
<RadzenCard Variant="Variant.Filled" class="w-96 h-96">
<RadzenText>Hello</RadzenText>
</RadzenCard>
<RadzenCard Variant="Variant.Filled" class="w-96 h-96">
<RadzenText>Hello</RadzenText>
</RadzenCard>
<RadzenCard Variant="Variant.Filled" class="w-96 h-96">
<RadzenText>Hello</RadzenText>
</RadzenCard>
<RadzenCard Variant="Variant.Filled" class="w-96 h-96">
<RadzenText>Hello</RadzenText>
</RadzenCard>
<RadzenCard Variant="Variant.Filled" class="w-96 h-96">
<RadzenText>Hello</RadzenText>
</RadzenCard>
</div>
</div>
</div>
This is my html & css
I want the title lined up with the card on the left
As in you want the title moved too? or like the left side of the card is in line with the end of the underline of the title
Right
Idk how to explain it more clearly
See how in this first image I posted, it is lined up with the first card?
yes
I want the title to stay aligned JUST like that when the cards are centered
Although I think after playing around more I got my desired result anyway
I just modified the size of the cards as they did seem rather small, and then increased the gap between them
Still looks a little off, but tbf I dont think ima get it to look appropriately without sacraficing something
like that?
Similar to what I did yea
stays aligned as it changes too
Neat
The only thing not responsive on my page is the very top card
cause that one is annoying asf
💀
do you need help making it responsive
Sure
Im moving some things around right now to clean the code up
and I ended up fucking the layout up 
Alright fixed the layout
making it responsive is too annoying tho so thats for a future project

if you send it to me i can try and make it responsive and then just give it back
well as long as they accept classnames it would still be possible
it is great for what is this?
not all of them do
Which is the annoying part
I have to hope the children will inherit from the parent element and wrap it in a div
Not really, its deeply rooted already
pardon?
shadcn/ui if you ever change
Yea I dont know why I didnt think to use shadcn
what are you using?
I use blazor so I just used whatever was easiest
and radzen is rather easy to setup
I know shadcn is node tho
so I dont know if it will work actually
Im using MudBlazor which seems good so far 
Hi guys
greetings!
Made the switch, its much nicer
Added a daily command for my bot that I'm rather proud of the effect. Had an artist draw the background
Pog

Hello C# / Asp.net users / blazor users.
Since I am still fairly new to C# I am trying my best to make my code work. I have run into the issue where I have 2 sources of user information. One from my auth server that stores all the important information, and then my own database that stores other information like settings, what organization they belong to, and other important information. I am wondering how I can merge these two pieces of data into one class. Right now I parse it in an extension method on ClaimsPrincipal, which parses the claims from the OIDC request into a class
public static class ClaimsPrincipalExtensions
{
public static AuthedUser ToAuthedUser(this ClaimsPrincipal principal)
{
var roleString = principal.Claims
.FirstOrDefault(c => c.Type == "urn:zitadel:iam:org:project:297838639419752450:roles")?.Value ?? "{}";
var jsonObject = JObject.Parse(roleString);
var roles = jsonObject.Properties().Select(property => property.Name).ToList();
return new AuthedUser
{
Id = principal.FindFirst("sub")?.Value,
Email = principal.FindFirst("email")?.Value,
EmailVerified = bool.TryParse(principal.FindFirst("email_verified")?.Value, out var emailVerified) && emailVerified,
Expires = int.TryParse(principal.FindFirst("exp")?.Value, out var exp) ? exp : 0,
FamilyName = principal.FindFirst("family_name")?.Value,
GivenName = principal.FindFirst("given_name")?.Value,
Name = principal.FindFirst("name")?.Value,
Locale = principal.FindFirst("locale")?.Value,
Roles = roles,
Avatar = principal.FindFirst("picture")?.Value,
};
}
}
public struct AuthedUser
{
public string? Id { get; set; }
public string? Email { get; set; }
public bool? EmailVerified { get; set; }
public int? Expires { get; set; }
public string? FamilyName { get; set; }
public string? GivenName { get; set; }
public string? Name { get; set; }
public string? Locale { get; set; }
public List<string> Roles { get; set; }
public string? Avatar { get; set; }
}
Now i need to somehow add the data from my database. What do you guys recommend?
I thought about passing in the database context to this method, but then i'd be injecting the DB context in tons of pages
@sharp geyser you can use a static db cache tied to the users id or you can create a scoped service that will fetch and keep that info cached until the blazor session ends
Well you already have a user id you can tie to or at least the email
Right, but what I was trying to ask was a way to merge these two sets of data into one.
Parse the data from the claims gotten from OIDC, and then grab data about that user from the db as well
You don't need to merge them entirely.
Also claims stuff is stored in the cookie which has limits and can be cleared so only good for temp data.
The scoped service itself is per-session aka each browser tab which can cache info for that session.
You can also just create a static db cache that can dictonary the id to user data and keep track of that.
Some databases can also join data based on the id from 2 tables instead of merging them completely.
Depends what you really want to do tbh there's a few choices to do either and C#/blazor can be flexible.
The OIDC handler can also be used to create user data or create claims on login too.
Cookie stuff can't be modified in blazor but you can trigger api controller routes that can modify or add cookies and claims.
In my project im using JWT tokens for auth and implemented a custom AuthenticationStateProvider to determine if a user is authenticated, because i was running in the same issue of ending up with two different sources of information. (and because that was the only way i could make authentication work with interactiveserver rendermode since the identity stuff requires static ssr for their pages .-.)
You could do that too yea but i bit more complex
@pearl trail can i ask u something about css grids
ask em and i'll try my best
so i have dis (ignore the fact that everything is ugly, im doing this for an assignment so aesthetics doesnt really matter)
the html:
<html lang="en">
<head>
<meta charset="utf-8">
</head>
<body>
<main>
<div id="content">
<article>
<h1>Test</h1>
<p>This is an article text.</p>
<img alt="The photo" src="https://picsum.photos/250/170">
</article>
<article>
<h1>Test</h1>
<p>This is an article text.</p>
<img alt="The photo" src="https://picsum.photos/250/170">
</article>
...
the css:
main {
padding: 2em 3em;
}
main #content {
display: grid;
grid-template-columns: repeat(4, calc(250px + 2em)); // ?????
gap: 0.75em;
}
main #content article {
background-color: green;
display: inline-block;
padding: 1em;
}
``` how do i properly make a grid out of this? where every column adapts to browser's width
like if i shrink the browser's width, the column goes from 4, to 3, to 2, etc
i'm very new to grids so don't roast me
resources online suggest to use a media query but that's just stupid
that's almost right
just change the repeat, with repeat(auto-fill, minmax(min width, max width))
oh really?
yep
repeat is like how much cols you want and assign it's size
OH MY GOD grid-template-columns: repeat(auto-fill, calc(250px + 2em)); WORKS
okay lemme see if i can try to center this
nice, but that'll have fixed size, so the contents wont be stretched based on the viewport's width
but it's up to you
oh
idrc because its for an assignment lol but how would a minmax work?
like the min width would be the width of each element right
and what about the max width?
100%?
nope, the max width each content will have. like minmax(200px, 300px), the grid will try to fill the whole width with the content able to stretch between 200px and 300px
so there's no gap on the left and right
wait how would i center this entire grid haha

adding align-items: center; justify-items: center; to main #content didn't really work
you need display: flex for that to work
oh a stackoverflow thread showed that it worked for grids too
oh, it basically a way how to center anything inside the parent
oh really?
i thought since you're the css pro you would know about grids

@pearl trail okay so i ran into another problem after switching to display: flex;
what is that
the entire thing would become like after the images loaded
trying width: calc(250px + 2em); on each element didn't work
put that to main, not the #content, all the flex, justify, align
huh
but wouldn't that make not much of a difference? since ```html
<main>
<div id="content">
<article></article>
</div>
</main>
where did you put the flex?
main #content
after main #content there was supposed to be an aside but fuck it

what if i flex both main and main #content
nothing happens, but the #content wont be grid, it'll be like this
it looks like this now ```css
main #content {
display: flex;
flex-wrap: wrap;
gap: 0.75em;
align-items: center;
justify-content: center;
}

now let's see if i can get the aside to work
yes that's what i said with this #development message
flex-wrap can do basic grid works sometimes
your welcome <3
i like how in css you can do the same thing in 20 different ways
@pearl trail heya are you still awake
always
<3
lmafo fr
uh how do i wrap the text in each element here so that instead of looking like this
it looks like this?
i tried text-wrap: wrap; but to no avail
this is the intended result
this is what i got #development message
wait, then you already got the answer?
if using text-wrap: wrap; and it's not working, try set the width
set the width?
main #content article {
background-color: green;
padding: 1em;
min-width: 250px;
flex-grow: 1;
}
WAIT
ye, try set the width first
because the node doesn't know when to wrap the text, so you need to set the width to tell em
nah, you're learning
or max width
i tried max-width no wonder it looked ugly lol
but it works right, the text-wrap
if you use min and max, set the width to 100%
min-width: 200px;
max-width: 300px;
width: 100%;
that should work

alright i think i'm done :D it looks ugly but at least i got the layout to work!
good job!!
gaming
usable
has accelerated machine learning support
can you explain to me what repeat() and minmax() are
i've also read about 1 / 5 span

repeat(count, units) means f"{units} " * count
what about attributes like auto and auto-fill?
auto is size
auto-fill means to automatically fill the remaining space
minmax is to maintain grid cell size
just... size?

css is awful
now i get you waffle
so say you want a column to take 100px, and the other to take the remaining space
welcome to my personal hell
you'd say 100px auto
wym
my job is fullstack rn
css is fun until grids
and the css is a fucking mess
that's the same as saying "svg is hell"
no grids are the only thing usable about css
you'd be thankful that grid exists later
anyhow
One of the most powerful and convenient CSS Grid features is that, in addition to explicit column sizing, we have the option to repeat-to-fill columns in a
i switched to flexboxes and it worked for me
trying to do everything with flexbox will make you quit

use grid for layout, flex for alignment
how does minmax() work?
1 / span 5 means starts from 1 and takes the next 4 cells (it spans 5 cells)
min-*/max-* but for grid cells
you declare a size range for your grid cells (how small / large it can get)
what is the fr unit again
the french language pack
thanks waffle
OH
so minmax() just guarantees min <= x <= max

just realized the css rabbit hole is way deeper than i expected
Go to sleep
Tommorow my english exam cant accept that English and chemistry is thougt in it

is it just me or did npm stop outputting a verbose output to operations by default now?
now all i see is a spinning bar when you used to see some verbose output
and you have no idea if its actually stuck or doing something
They gotta keep you guessing
not too sure, but I think i had something similar earlier today and I was a bit confused
the output was different to normal
and it turns out my install was failing
that's usually what happens when stuff isnt working 😕
I meant different to a normal fail
It wasn't spitting errors out the wazoo
I've a feeling it was the terminal I was using
why is it so stressfull applying for privledged intents, i get its probably 90% a formality but i felt like i was at an FBI interview.
😆
wdym apply
Lmao
if you want to have proviledged intents and be in more than 100 servers you have to apply
ah right 100+ servers
just hit 75 servers and got the most passive aggressive
"congrats! but if you dont apply were gonna block your bot lololol"
What privileged intents do you need?
The way you've described your bot it doesn't sound like it needs any 👀
message contents and server members
server members for some custom role handling and welcome messages for the community server
message contents for all the commands, im not using slash lmao
Message perms are typically not given for not using slash commands.
hmmm, yes i see from this email i just got as well.
I don't remember if members is needed for welcome messages either.
why are they trying to force slash commands, theyre ugly and not used.
they are amazing
👀 I'm not even aware of bots not using slash commands.
^
sockets are too expensive and not easy to scale
Webhooks are indeed the way to go
well yeah all the big ones have ofc migrated
i just like prefix better
might be nostalgia
Tbh, I don't even allow bots in my server that have message content intents.
Unsafe
i mean i guess, but its not really a problem on public servers. bot is not meant for private use servers.
If youre posting sensetive information on a public server 😆
It doesn't have to be sensitive info, just private conversations
Which happens all the time on larger private servers
Or even public servers
yeah but still, without prefixes what if you have two of the same bot that use the same name for a command?
Anyway, slash commands are good.
We have that happen all the time on the VC and it's never an issue 👀
You can also click on the bots name and it only shows commands from that bot
They've done a good job improving it since release
what happens if a bunch of bots have the same prefix now(back then)?
#265156361791209475 it was the best ^-^
fair point, but still i think its rare for 2 popular bots to share a prefix. as everyone who makes a bot avoids the known ones haha.
We hid bot hell?!?
Noooo
Back when we invited all approved bots to this server
When prefixes were normal
g!help
Was fun to run, and you know crash the discord server
also your code needs to do a lot of extra work. it needs to parse every message to look for the prefix. then you need to parse the message to get the parameters you want. all of that is handled for you with webhooks now
You'd not be able to send a message in this server for a minute and just know someone ran a help command
no thats all handled for me by discord.py 
Don't forget the CPU/memory overhead of caching and handling every message
on your server. you are paying for that CPU
Yeah
One large server join and you suddenly have 10% extra CPU usage and gotta upgrade.
Now it's not nearly as much of an issue
hmmm
When intents were added it was such a good time.
wdym
Before intents you had to receive every event(no matter what), so your CPU and memory usage were awful.
Hahaha i see
Large bots got cheaper servers pretty much instantly 😄
I got lots of work ahead of me, switch to a vps, switch to and refactor for a database, refactor for slash commands 
go serverless
Wdym serverless
webhooks let you do it
Still using cloud flare workers ben?
aws lambdas
never tried workers
Has it gotten expensive yet?
That i can understand
Thats right, someone else was doing workers.
nope, my only cost is api gateway at $0.03 a month
How many events? 👀
???
I wish I knew how to explain serverless well
It's like putting your code globally, so there is no one server
Yeah, kinda what i guessed. Discord would have the code and execute?
Ooor
When it's done right it can't go down without some major outages.
It's really cool
Discord doesn't, you can use Amazon web services, cloud flare workers, whatever really.
My webhook site once to run on cf workers
So much API stuff, i dont know any of this 😂😂😂
Really cool workflow. But I wouldnt recommend it for you yet. You're on the right track right now
You'll learn serverless when you need it ^-^
Haha yeah, im also completely self taught only on my first semester of uni. So a bunch of these "professional terminologies" are flying right over my head 😂
Thank god for context clues
At least in software we don't name stuff like engineers do 😄
Haha yeah, but im getting the feeling that the more i learn and more “advanced” services and libraries i need. The more their names are from some brainstorm thinktank “how can we get the angel investor to dump their wallet on us”
i think it's 7k a month of api calls
MongoDB has DB, which at least half explains it. But before i got told it was mongo for humongous data loads or whatever, all i could think off was mongoloid 😭
cloud watch is annoying to use
I wish discord would focus more on webhooks for bots, would be cool to see.
the new discord webhook is nice, but they need to send an event when an app cancels a subscription or when an app renews a subscription
and they need to tell us what quests are
Yeah that would be nice.
Isnt it those “watch this trailer of batman game to get this bot pfp”
i've never seen it. do you know of a bot that does it?
Idk, but maybe discord wants to allow for some interaction with it? Maybe planning in advance
Since theyre pivoting from "bots" to "applications" maybe they want to let ur app make custom quests in the future?
Just theorizing
oh yea, that sounds right. like steam acheivements or something
Yeah, could allow for "user progression" beyond the scope of a bot message.
Seems like theyre more and more taking design tips from the chinese super apps
Discord gonna become the wests “everything” app
Not long before someone makes a ubereats ai agent so when youre gaming with ur friends you just say “bot order me a pizza” and it does so
Actually AI vc companion bot isnt a bad idea at all

Giving yall all my 300 iq brainstorms here
you can buy one of those amazon buttons and program it to order a diet coke
and then paint it red
😂
“Yeah this bot will order you a diet coke, just give us your adress, legal name and credit card information”
Dont even want to think about the data security needed for that
$5 convience fee added. plus tip
-# minimum tip of 20%
-# plus 15% service surcharge
Driver doesn't receive the tip either so you need some cash on you to tip them too.
Yeah and a monthly fee of $5 for “other”
inactive account fee of $30 per month
Account deletion fee of $100
I think weve got a good idea for a bot here, lets find an angel investor to scam
my website api gets a lot of requests. i didn't know it was that high.
There are docs for a quest related event for a webhook, but it's internal only
im a psychic
Thats cool, hope it comes to fruition
Uncertain. It might be horribly limited since either the bot would have to know everything the client is doing or Discord would have pre-defined actions which could limit creativity with quests
Stuff like message content is already behind privileged access so it's unlikely that the bot would be the authority for quest completion
bro npm takes forever to install
usually initiating a react app takes min 30mins on my pc even on 5G internet
Hi, I made a bot long time ago and I want to make it online again. So I followed the steps in Discloud but it says my requirement.txt is not correct. Then I reintalled my python application but it still doesnt work
ERROR: No matching distribution found for discord.py==24.3.1
This is error but i already reinstalled
The latest discord.py version is 2.4.0
how do i download it then
or i change it in the requirement.txt?
nvm i just uploaded it
it says there's a code error but idk where specifically
how do i check?
Python typically will tell you the file location and line the error occurred on.
No module named 'discord' Does this mean i dont have discord.py?
i have this error but i have already got the discloud config in my project
i think yes
but i have everything in my bot folder including the discloud config but it still doesn't online
or I think discloud doesn't accept python bots
It’s in the main.py tho
i watched a video and the guy coded in python is able to upload to discloud and can run it properly
can you share the screenshot of discloud.config
Im not with my pc atm. I will do so when Im available
no problem
لأي بوت؟
لأنه بقدر ما أعلم، لا يوجد لدى Discord أي نظام ائتماني أو نظام كسب رسمي
ولكن لأي بوت محدد؟
pro bot
هل لديك أي اسم بوت
اضن انه pro bot
ثم يجب عليك محاولة الاتصال بالمطورين
راح اصورها وارسلهالك فالخاص
نعم
رسلتلك خاص

The only thing I understand is pro bot
LMAO
what language is that lmao
I assume arabic
for react these are rookie numbers
they have so many dependencies it might as well be an operating system from the complexity
One message removed from a suspended account.
he is trying to say that he is using probot and in that how can he earn credits.(server currency)
@clear field my code for discloud.config
your config is correct then i think you should try reinitiate the discloud or try changing directy of bot
do i delete my bot and reupload?
yes but make a new folder
and what do i put there?
i mean move your bot files to a new folder
but that wont change anything?
i just moved to a new folder
but
why are good date pickers hard to come across for react 
this one from Adobe is good but its so hard to adapt
or you get an outdated looking one like this
and what is this
my favorite day of the week ⥤
lol
After conversations with “bertha” from discord i was told i could have both slash and prefix commands
But then after asking if i could get the intents since she confirmed i could have both, she just ghosted me.
Bertha from discord is a cold woman
Bertha has taken the weekend off
yes you can have both, but not if only message command iirc, in summary, your bot need at least to implement slash command
gotchu, ive decided to prioritize slash commands either way.
just gotta refactor into cogs first as it will make everything easier, pain awaits. Should have used cogs from the start just didnt know what they were 😭
For Discord text commands (aka prefix commands) are not a sufficient reason for you to receive this intent
You must have any feature that actually needs this intent to function
So what youre telling me is to make a command that needs it beyond the suffix so i can use the intents, smart
Not really, I personally wouldn't do it just to use text commands
The less unnecessary events you get the better
Hmmm, my users are very accustomed to prefix commands though. But maybe its better to rip the plaster of right now rather than later
bertha 😭 😭
they have to be joking with that name
bertha needs a rest
Why do you want to add text commands? I understand that some bots keep them because their users are used to it, but for a new bot... it's twice the code, and way less intuitive
Not twice the code or less intuitive if you know how to use it right 
I dont want to add text commands, i want to keep the 10k loc ive already written with them.
But ive been pretty good at modularising so its not gonna be that much of a hassle to refactor into cogs and slash commands than i initially thought
Yeah i dont believe its less intuitive by any stretch of the imagination, 90% discord users have used discord and bots since way before slash commands were popularised.
For a completely new discord user yes slash commands will probably be easier to pick up
Any anime utility app name ideas? 😭
Waifu
That taken 🥲
rip
that was actually the name of a thing i was working on many years ago
and i never finished
Damn
Any other?
degozaru-yo
Ew
lmfao
kakoii
Ayanna
Nope
Random anime name generator online
There you go 🙂
Name it after your favorite anime character
That’s so crawnz
crawnz 
Yes crawnz
Crawny
Omg your profile is so rainbow 🥹
Anyways imma try
Woof
So I know KYC is about knowing your customer and collecting personal information to "prevent" fraud, but how exactly do you stay KYC compliant? What does it entail if anyone knows.
The articles i've read are just about collecting basic user information.
Which is best to make it stay updating this webhook message every 5min or delete and send new boards?
I don't know if it makes sense to refresh them all every 5 minutes + this system makes it impossible to check last month's statistics if messages are deleted or replaced
Also why is there no second user in the month's statistics but there is one in the week's statistics
it is highly specific to jurisdictions which is why 90% of them offload it to a 3rd party to ensure compliance
it also depends on the type of service like cryptocurrency, finance, etc
Yea, I was looking at stripe and determining how I want to use them
I'd love to use my own UI but that means I have to keep up with my own KYC compliance
and as a small time dev I can't do that 💀
Because it reset Jan 1
I officially hate css
Why is the width and height so fucked
I am telling this div to take the full width and height of the parent div, but its just refusing to do so
static sizing being used somewhere in the dependency chain instead of responsive sizing type deficiency in skill (skill issue)

height percentages on work if there is a parent with a fixed height

The problem is
I have no idea what parent is influcing what
Since i use layouts the final resulting html is a div, inside a div, inside another div
💀
well if neither of them have a fixed height, a percent height will not work
I've tried changing the height and width of each but no dice
A fixed height?
a div with height: non-percentage-value
Well I have this
<MudMainContent Class="min-h-screen min-w-screen">
<div class="p-4">
@Body
</div>
</MudMainContent>
I then tried setting the inner div to have w-full and h-full so its as big as the parent
but that does nothing
min-height: 100vh and min-width: 100wh
try without the min
i think height percentage doesnt work on a parent with min-height
Wth
It works now weird
I tried it without min before and it caused overflow issues
Now it doesnt

exdee
:^^^^^^)
Im already building an entire marketplace
last thing I need is writing my own css all the time

xD
I might actually off myself (in game)
Anyway
Back to toiling away at this bullshit
huehuehue
HSV hue?
I cry every day at how messy my aspnet code base is
then I wonder, is anyones code base not messy when doing stuff with asp net
💀
Like it seems impossible to make it truly organized
skill issue
The thing about c# is that your code can be stored pretty much anywhere in your project folder, you don't need to set modules, init functions or worry about node packages breaking stuff.
My code is always messy anyway 🙂
So worrying about how messy your code base is can just be easily improved with folder structures and minor namespace changes, you're really worrying about nothing compared to other langs.
What the fuck does this mean

I am confusion
Not seen this error before
More context, right above it, it states the ws connection succeeded
Seems to be a dotnet watch thing
I see this error on almost every single page in the console in my project at work lmao
SignalR is a wonderful thing isn’t it
Also
I believe blazor server uses it by default
Please explain to me how the fuck a class is null
Wdym
I am instantiating a class and getting an Object reference not set to an instance of an object error
Constructor is expecting something that isn’t null?
Thats the thing im giving it everything it is asking for
and i made sure none of it is null
Show
var options = new AccountCreateOptions()
{
Type = "express",
Email = _zitadelUser.Email,
Capabilities = new AccountCapabilitiesOptions
{
Transfers =
{
Requested = true
},
TaxReportingUs1099K =
{
Requested = true
},
CardPayments =
{
Requested = true
},
},
BusinessType = "individual",
Controller =
{
Fees =
{
Payer = "application"
},
Losses =
{
Payments = "application"
},
StripeDashboard =
{
Type = "none"
},
RequirementCollection = "stripe"
},
Individual =
{
Email = _zitadelUser.Email,
FirstName = _zitadelUser.FamilyName,
LastName = _zitadelUser.GivenName,
},
};
_zitadeluser isn't null, neither is email, family name or given name
What’s the full error
MercatusWeb.Components.Pages.Users.Onboarding.CreateStripeAccount() in Onboarding.razor
+
var options = new AccountCreateOptions()
MercatusWeb.Components.Pages.Users.Onboarding.OnInitializedAsync() in Onboarding.razor
+
await CreateStripeAccount();
Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
Microsoft.AspNetCore.Components.Endpoints.EndpointHtmlRenderer.<WaitForNonStreamingPendingTasks>g__Execute|43_0()
Microsoft.AspNetCore.Components.Endpoints.EndpointHtmlRenderer.WaitForResultReady(bool waitForQuiescence, PrerenderedComponentHtmlContent result)
Microsoft.AspNetCore.Components.Endpoints.EndpointHtmlRenderer.RenderEndpointComponent(HttpContext httpContext, Type rootComponentType, ParameterView parameters, bool waitForQuiescence)
System.Runtime.CompilerServices.ValueTaskAwaiter<TResult>.GetResult()
Microsoft.AspNetCore.Components.Endpoints.RazorComponentEndpointInvoker.RenderComponentCore(HttpContext context)
Microsoft.AspNetCore.Components.Endpoints.RazorComponentEndpointInvoker.RenderComponentCore(HttpContext context)
Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext+<>c+<<InvokeAsync>b__10_0>d.MoveNext()
Microsoft.AspNetCore.Builder.ServerRazorComponentsEndpointConventionBuilderExtensions+<>c__DisplayClass1_1+<<AddInteractiveServerRenderMode>b__1>d.MoveNext()
Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
It is saying line 40 which is var options = new AccountCreateOptions()
checking the stripe docs i've provided every required property
Maybe I haven’t used enough of this, but why is Individual = {…} not Individual = new {…} or something?
You technically don't need to use new here
since it already knows what it is supposed to be you can just do {}
I can try it with new and see if thats the issue though
yknow what
you are right
that was the issue
I was gonna say
I didn’t think that was a valid way to initialize things
I’m surprised it wasn’t a syntax error tbh
Im shocked to
@sharp geyser how are you setting the options part?
If you're running OnInitializedAsync then it would be fine but OnAfterRender and OnParameterSet means that the page is being loaded first which will be null until it fully renders and then sets it.
hey guys, i currently have a sqlite table setup, and my column was actually setup to be a datetime.
However, am i able to transform it to text instead, without having to remove all the data in the .db file?
i don't think so tbf, but figured to ask..
Create a new table where the datetime is text instead, put everything from the old into the new table and drop the old one
also dont forget to rename the new table to the name of the old after the transfer and dropping the old one
why though
keeping it as datetime is extremely flexible
and you can convert it into a string at any time
One message removed from a suspended account.
Does anyone know what the syntax is for a command that creates a "private" thread? I only want the user that creates the thread (the user that sends the command) and the bot to be able to see / reply in the thread
Depends on the language and/or library if you are using any
Sorry, im using python and just the regular discord library
Unfortunately, I don't know much about python so I can't help you with this one 😔

👀 does discord.py support threads?
Hi, anyone that can help me with discord.py?
im converting to cogs, which worked fine for me when testing. but now when i try to introduce it to my main script its not working:
i believe the issue is that i sort my cogs inside the cogs file, and that im not handling that properly. But im pretty useless with cogs so if anyone can assist that would be great.
it says theres no package specified for AuraCog but i have the setup function in the script.
@civic scroll @pearl trail when you write a search box, do you guys make the search button inside the <input> element or outside?
if i do the latter it's so hard to write hover rules without using javascript 😭
outside
🫡
also the latter is friendlier for kb navigation
idk how it behaves if you put that inside
i just couldn't stop thinking about this x button
that every app has
😭
i really wanna add it but that would mean i need to write some js
erm
hun
make the input type search
it comes with it

You can then style it afaik
that x is to clear the input
Doesn't the default "search" input come with the x
it is also styleable as far as I know
I KNOW
it's just
when you type something you couldn't go past it
which means the <input>'s width decreases
on focus
have you considered
div .input
input .input-text
button .input-clear-btn
what's the parent .input for
@pearl trail teach me pro
sayuri more pro
or actually
but anyways, that parent div is used to make em flex and be "1 component"
you don't have to remove the x button
i make the button transparent?
use Lucide icons if using react they have very variety of icons
or yk, disable the button and make it 0 opacity
then what if i wanted to type something in the search box
enable it and show
pointer-events: none;
that would make the input underneath capture the mouse click instead
you are so learning
oh my god i hate this x so much
x
is it okay if i use em for everything
hm, i prefer rem
what's the difference
like is this ok
cc @civic scroll
rem is based on root, em is based on parent
just like tailwind, it use rem everywhere
Itll do that
use em if you want the size to be based off font size
otherwise no
em is affected by local font size
while rem uses the font size used by the :root element
i used em for everything because if i used px that would be bad

thats what i thought at least
by default it's a substitute for (em_size_int) * (root_font_size_px)
so 2.5rem by default is just calc(2.5 * 16px)
I think one of the benefits of rem is devices can change it.
For example someone who has their device configured to show larger text it will scale with it.
yeah
You can use em in places you dont want to allow scaling
you dont want to allow scaling?
like what?
Stuff like product cards
I assume anyway
Since typically you set the widths based off breakpoints
and scaling can fuck those widths
Though im not entirely sure 💀
frontend is not my mojo
I'm still awful at it 😄
hi
cant wait until dpp 10.1 is ready to release... running it on a test bot and im like 😮
this memory consumption isnt really going to increase on that bot
we removed the need for a crapton of threads, seems the threads were adding a fair bit to memory use (same bot was 65mb before)
anyone know how to "force" these selections to appear on top? i tried finding on internet and mostly they said make selection from scratch
hey i want to add russian roulette to my discord casino bot Dyse please give suggestions on what i can do i have never played it before just have a little knowledge of what happens
but i dont want anyone to be kicked or banned
just a harmless cute little bot😘🥰
What are you looking for? psudocode? or an explination of how its played?
😠 come on discord. ratelimits on oauth?
Makes sense
Probably ratelimited per account, right?
Probably the app itself requesting them
I spammed sign in button on my site. Trying to redirect banned users.
You're meant to store the tokens until they expire too so makes sense to ratelimit it
But it was only like 5 requests, so its oddly low
from the same IP?
That says requesting many tokens though
ye
and for the same account?
I think the limit is on tokens per min per account
yeah
I think you're doing something wrong maybe log the requests you're doing
you shouldn't need more than one as it should cache success
I mean, I was signing out and back in. Which the correct thing to do is get new tokens right?
each one was a fresh signin
Normally you would not be spaming logout and login though
yeah, its not an issue at scale. Just seems oddly low
if its per account* which it should be
explanation of possibilities and better if pseudocode is also provided
I store the refresh token, but the oauth spec I think wants you to request a new one on each fresh signin
Hmm lets try something
All I'd do is give all players an array, fill it with false in each spot, then put a true in a random spot.
Pop each array until one person is alive.
Thankfully its a really simple game to program and should only take a couple hours to do.
Hu that's strange the token endpoint dosen't have ratelimit response headers 
all of these have 1-4 user commands that i have to change into cogs and slash commands
30 commands, in addition to having to change everything from ctx to interaction
😆 🔫
this is to the point of writing a script to do it for me.
Uh oh i just broke Discords oauth
lol
@solemn latch yea not getting any ratelimit headers or ratelimits in general on /oauth2/token either that or you're hitting some kind of spam limit that shouldn't normally be hit.
Your oauth might be spamming or duplicating oauth token requests for a single user.
Its not oauth spam, my logs showed 10 requests in a couple minutes(due to me manually hitting sign in)
just was going a little too fast 😄
Hitting sign in multiple times shouldn't cause multiple requests either
👀 wdym, discord has to validate it.
I think the main issue Builderb is trying to get across is that the logs should only show one attempt being made at either signing in or signing out. Any other amount is a bug
Another server
Could I potentially get the id of that server so I can exclude it in my join guild leave clause?
I can share the code with you if that would be better too as to not breach any security, I just dont want it in any servers besides my os and the test server for you guys ^^
I want the votes still, and it is a user application, the entire bot relies on users adding it as a user application
Plus top.gg is good for getting bots out there, its trusted, known, and widely available
(And I would like to have my message intents remain on my bot since I use it as a moderation service in its OS too, and use prefix based commands there since that should remain the only server my bot is in)
-verification
@delicate wigeon
The only guilds we might invite your bot to regarding Top.gg-related things such as verification or polls are:
333949691962195969- Top.gg Verification Center264445053596991498- Top.gg- any guild owned by a user with the role <@&767389896133443625> in this server.
Any other guild claiming to be affiliated with Top.gg's verification is very likely false.
in terms of?
hi
Lol that's crazy Microsoft updated their store policy and my rpc app cant use "discord" in the description 
i mean this kinda
ndsuiysdngdx
I have this h1 on my page, and for some reason its auto focused and scrolled to. Anyway to prevent this behaviour?
is there tabindex=-1 on the h1?
no
but i'd rather not put tabindex on every element
because if it isn't that one its another one it focuses on
like once the page loaded, it immediately focus and scroll to that h1?
yes
@sharp geyser blazor has a component tag that does that check your App/Routes part, the box thing on focus shouldn't be doing that unless you have an accessibilty option or you tabbed to it or some css is doing that
💀
And enabled by default
is that vue?
oh
Accessibility ✨
Idk why tbh its in the template
h1 by default is not focusable tho, or it should be not focusable
Well thank you
You solved me a lot of headache
Any element can be focused it's why apps like Discord have keyboard tabbed navigation
Press tab a few times and you can see
Ion see nothing
hmm yeah i can see that
I had to write a tab navigation system in my work project
But in raw razor with jquery MVC
It was awful
Yea the blue thing is the selector
Do you use tailwind at all with MudBlazor?
Why is there two of them and why do neither of them go away when the test bot is offline?
One is registered globally and second one is probably registered on this specific guild
And the status of your bot has no influence on whether commands are displayed or not. Commands are registered and Discord stores them. Your bot does not have to be online for them to appear in the client
Oh. So what happens if one command is no longer needed?! Is it forever stuck there?
You can delete it using the API
could there be a reason why my site on NGINX randomly died last night for no reason everything is running
i made 0 changes it just stopped...
NGINX Proxy setup:
Look at your nginx logs.
How does one do that?
Should be in /var/log/nginx/
Access or error?
I'd look at error first. but both
oh
Leaked ip 😔
He tried to hide it but hiding it doesn't matter, can reverse domain search too usually
Just found the issue
weirdly last night it was working on port 8000 but NGINX was set to 8080 just changed the port on the server.js and it works now
idk how it was running
Curiosity kills me here bc I have nginx setup too, do you not serve https? Or is the ssl cert and stuff setup in another file
idk
||I think activities force you to use https for their connection, which is why I ask, and usually you reverse proxy for either load balancing or multiple domains across a single ip adress||
tbh i just followed an article on how to Reverse Proxy a domain with NGINX so idk
im very new to NGINX
using cloudflare?
yeah
Their https comes from cloudflare then
alright! Like I said, I was just curious. Ive done quite a bit with it now, so had to ask
I self sign certs with certbot with use my https
Ah
Okay
ah thx
learned something new today
Cloudflare my beloved
I avoid it bc Ive never used it 
I went through the process of setting up nginx and then went from there, and then figured out you can use nginx to server multiple domains/subdomains sooooooo
After I had already bought a second IP address for my server ofc
using cloudflare?
I dont use cloudflare, my server setup is purely nginx based, and using certbot to assign multiple domains to one ssl cert
Just make sure you have ddos protection using a setup like that.



