Model module cleanup and standardization #1791
vilgotf
started this conversation in
Development & RFCs
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
twilight-model
has the following top level modules (with the modeled Discord doc categories):Interactions
Stage instance
,Sticker
andWebhook
Gateway
+ our own custom gateway eventsAudit Log
,Emoji
andGuild
twilight_http
requestsInvite
andGuild
(invite::WelcomeScreen
)Application
andTeam
Guild Scheduled Event
Guild Template
User
id
this contains other model optimizationsThere's clearly a lot of inconsistency here, we're not following Discord's categorization and we're not nesting relevant things like
template
andscheduled_event
underguild
.There's even collision with our
application
being totally different from Discord'sApplication
category.Since Discord has 15+ categories (depends on how you count them) I think it's unfeasible to model categories like Discord does. We should instead nest relevant modules as follows:
invite
->guild::invite
scheduled_event
->guild::scheduled_event
template
->guild::template
I also think
application
should be renamed to avoid confusion withoauth::Application
and what Discord categorizes asApplication
,http
to be expanded,channel::message::allowed_mentions::AllowedMentionsBuilder
to be moved to util,id::marker
to be flattened andid::Id
to be exported, andguild::member
to be hidden as the types there are internal.To summarize: the model is large and scary for new users to the Discord API and to Twilight. By exposing only a few top level modules users are not immediately exposed to too much information, and information is easily searched for by logically exploring submodules' items (like messages belonging to channels and invites belonging to guilds). Long term we also need to document items; linking to Discord's docs and improving on them where necessary, including overarching guides for how Twilight fits together.
Beta Was this translation helpful? Give feedback.
All reactions