whats this at the top?
i was doing some tutorial code on the discord.NET introduction section of the docs and i found they have this:
20 Replies
is this the C# equivalent of a python wrapper?
and what would be the use cases for such a thing?
It's an attribute, not a decorator.
$structure
It's basically custom metadata you can add onto types, methods, properties, fields.
They can be looked up with reflection.
Or source generators
yeah, in this case those attributes give discord.NET more information about what to do with your code
Tutorial: Define and read custom attributes. - C#
Learn how attributes work in C#. You define custom attributes to add metadata to your code. You read those attributes to learn about the code at runtime
in this case, treat your method as a command called "say" with a summary, and to use the remainder of the message as the argument to the method
:SCshocked:
btw the tutorial youre watching is outdated
[Command] has long been replaced with [SlashCommand]
i know the difference between prefix and slash commands
ah ok i think i understand now
its more than that
oh?
it introduces the Interaction framework which also opens the way to [ComponentInteraction], [ModalInteraction], proper params and some other stuff
the probably easiest way to make a proper discord bot
ah ok so just do slash commands cuz they have more features?
You do slash commands because they are more user friendly and have been accepted as the new default
At the time bot verification still meant something discord also stopped verifying bots that used text commands
:prettythumbsup:
slash command
does it still face the syncing problem in dpy where you have to refresh your discord client for new things to appear?
only on rare occasions
but thats more of a discord issue
a thing i like to do is make a help command that lists all commands as clickable then i dont need to wait for discord to update my cache
but its overkill so
btw you dont need to force close discord you can just do
CTRL + R
yeah i know that 👌