ScurryPy Mindset¶
This section will guide you through the flow, setup, and role of each folder in the project.
What is a model?¶
Models model Discord's payload structure. Models focus on the what, not the how.
Q. What is a Message?
A: The MessageModel
Models do not possess any capabilities like fetching, creating, modifying, or deleting. If you wish to make any of these actions, make a resource from the model!
What is a resource?¶
Resources model Discord's resource objects. Resources focus on the how, not necessarily the what.
Q. How do I send a message?
A: Use the Channel.send endpoint
Endpoints return models, not resources!
Resources and models are split so you can cache, serialize, and inspect model data without the weight of methods.
What is a Part?¶
Parts model the user's contract with creation endpoints. Use these classes when you want to make something.
Q. How do I make a message?
A: With the MessagePart
What is an Event?¶
Events model Discord's gateway events. Like models, events focus on the what, not the how.
Events do not possess any capabilities like fetching, creating, modifying, or deleting. If you wish to make any of these actions, make a resource from the event!
Q. How do I respond to an event?
A: Event -> Resource -> Request. ScurryPy will never do this for you (unless you use scurrypy.ext).
What is a Parameter?¶
Parameters model the user's contract with modifying endpoints. Use these classes when you want to modify something.
Parameters are TypedDicts that are meant to be Unpacked by endpoint functions.
They are constructed via keyword arguments rather than manual instantiation.
What is a context?¶
Contexts are part of the scurrypy.ext module. They group properties associated with the events the addon dispatches.
For example, ApplicationCommandContext contains commonly needed properties from the INTERACTION_CREATE event including bot, event, event data, and various helper properties.