@@ -32,6 +32,7 @@ class InviteDataInviteEntry:
3232 hits : int
3333 link : str
3434 tags : Set [str ]
35+ description : str
3536
3637 @staticmethod
3738 def deserialize (data : JsonObject , key : str ) -> "InviteDataInviteEntry" :
@@ -42,6 +43,7 @@ def deserialize(data: JsonObject, key: str) -> "InviteDataInviteEntry":
4243 hits = data ["hits" ],
4344 link = data ["link" ],
4445 tags = set (data ["tags" ]),
46+ description = data ["description" ]
4547 )
4648
4749 def serialize (self ) -> JsonObject :
@@ -51,6 +53,7 @@ def serialize(self) -> JsonObject:
5153 "hits" : self .hits ,
5254 "link" : self .link ,
5355 "tags" : list (self .tags ),
56+ "description" : self .description
5457 }
5558
5659 # @implements InviteEntry
@@ -142,6 +145,7 @@ def add_invite(self, invite_key: str, link: str) -> InviteDataInviteEntry:
142145 hits = 0 ,
143146 link = link ,
144147 tags = set (),
148+ description = ""
145149 )
146150 self .invite_entries [invite_key ] = invite_entry
147151 # Return the newly-created invite entry.
@@ -159,29 +163,33 @@ def remove_invite(self, invite_key: str) -> InviteDataInviteEntry:
159163 raise NoSuchInvite (invite_key )
160164
161165 def modify_invite_link (self , invite_key : str , link : str ) -> InviteDataInviteEntry :
162- if invite_entry := self .require_invite_entry (invite_key ):
163- invite_entry .update_modified_on ()
164- invite_entry .link = link
165- return invite_entry
166- raise NoSuchInvite (invite_key )
167-
166+ invite_entry = self .require_invite_entry (invite_key ):
167+ invite_entry .update_modified_on ()
168+ invite_entry .link = link
169+ return invite_entry
170+
168171 def modify_invite_tags (
169172 self , invite_key : str , tags : Tuple [str , ...]
170173 ) -> InviteDataInviteEntry :
171- if invite_entry := self .require_invite_entry (invite_key ):
172- invite_entry .tags = set (tags )
173- return invite_entry
174- raise NoSuchInvite (invite_key )
175-
174+ invite_entry = self .require_invite_entry (invite_key ):
175+ invite_entry .tags = set (tags )
176+ return invite_entry
177+
178+ def modify_invite_description (
179+ self , invite_key : str , description : str
180+ ) -> InviteDataInviteEntry :
181+ invite_entry = self .require_invite_entry (invite_key ):
182+ invite_entry .description = description
183+ return invite_entry
184+
176185 def configure_guild_key (self , invite_key : Optional [str ]) -> Optional [InviteEntry ]:
177186 if not invite_key :
178187 self .guild_key = None
179188 return
180- if invite_entry := self .require_invite_entry (invite_key ):
181- self .guild_key = invite_key
182- return invite_entry
183- raise NoSuchInvite (invite_key )
184-
189+ invite_entry = self .require_invite_entry (invite_key ):
190+ self .guild_key = invite_key
191+ return invite_entry
192+
185193
186194def _guilds_defaultdict_factory () -> DefaultDict [GuildID , InviteDataGuild ]:
187195 return defaultdict (lambda : InviteDataGuild ())
@@ -266,6 +274,12 @@ async def modify_invite_tags(
266274 ) -> InviteEntry :
267275 return self .guilds [guild .id ].modify_invite_tags (invite_key , tags )
268276
277+ # @implements InviteStore
278+ async def modify_invite_description (
279+ self , guild : Guild , invite_key : str , description : str
280+ ) -> InviteEntry :
281+ return self .guilds [guild .id ].modify_invite_description (invite_key , description )
282+
269283 # @implements InviteStore
270284 async def configure_guild_key (
271285 self , guild : Guild , invite_key : Optional [str ]
0 commit comments