@@ -21,9 +21,14 @@ def __init__(self, bot: GitBot):
2121 }
2222
2323 @staticmethod
24- def construct_release_feed_list (ctx : GitBotContext , rf : ReleaseFeed ) -> str :
24+ async def construct_release_feed_list (ctx : GitBotContext , rf : ReleaseFeed ) -> str :
2525 item : str = '' if rf else ctx .l .generic .nonexistent .release_feed
2626 for rfi in rf :
27+ if rfi ['cid' ] not in map (lambda c : c .id , ctx .guild .channels ):
28+ await ctx .bot .db .guilds .update_one ({'_id' : ctx .guild .id },
29+ {'$pull' : {'feed' : {'cid' : rfi ['cid' ]}}})
30+ ctx .bot .logger .debug ('Removed channel %d from feed in GID %d' , rfi ['cid' ], ctx .guild .id )
31+ continue
2732 m : str = '' if not rfi .get ('mention' ) else ' - ' + ctx .bot .mgr .release_feed_mention_to_actual (rfi ['mention' ])
2833 item += ctx .bot .mgr .e .square + ' ' + f'<#{ rfi ["cid" ]} >{ m } \n ' + \
2934 ('\n ' .join ([f'⠀⠀- [`{ rfr ["name" ]} `](https://github.com/{ rfr ["name" ]} )'
@@ -118,7 +123,7 @@ async def config_show_feed_command(self, ctx: GitBotContext):
118123 embed : GitBotEmbed = GitBotEmbed (
119124 color = self .bot .mgr .c .discord .blurple ,
120125 title = f"{ self .bot .mgr .e .github } { ctx .l .config .show .feed .title } " ,
121- description = self .construct_release_feed_list (ctx , guild ['feed' ]),
126+ description = await self .construct_release_feed_list (ctx , guild ['feed' ]),
122127 footer = ctx .fmt ('footer' , f'git config feed channel {{{ ctx .l .help .argument_explainers .channel .name } }}' ))
123128 await embed .send (ctx )
124129 else :
0 commit comments