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
Uh oh!
There was an error while loading. Please reload this page.
-
twilight-modelhas the following top level modules (with the modeled Discord doc categories):InteractionsStage instance,StickerandWebhookGateway+ our own custom gateway eventsAudit Log,EmojiandGuildtwilight_httprequestsInviteandGuild(invite::WelcomeScreen)ApplicationandTeamGuild Scheduled EventGuild TemplateUseridthis 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
templateandscheduled_eventunderguild.There's even collision with our
applicationbeing totally different from Discord'sApplicationcategory.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::invitescheduled_event->guild::scheduled_eventtemplate->guild::templateI also think
applicationshould be renamed to avoid confusion withoauth::Applicationand what Discord categorizes asApplication,httpto be expanded,channel::message::allowed_mentions::AllowedMentionsBuilderto be moved to util,id::markerto be flattened andid::Idto be exported, andguild::memberto 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