@@ -21,9 +21,14 @@ def __init__(self, bot: GitBot):
21
21
}
22
22
23
23
@staticmethod
24
- def construct_release_feed_list (ctx : GitBotContext , rf : ReleaseFeed ) -> str :
24
+ async def construct_release_feed_list (ctx : GitBotContext , rf : ReleaseFeed ) -> str :
25
25
item : str = '' if rf else ctx .l .generic .nonexistent .release_feed
26
26
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
27
32
m : str = '' if not rfi .get ('mention' ) else ' - ' + ctx .bot .mgr .release_feed_mention_to_actual (rfi ['mention' ])
28
33
item += ctx .bot .mgr .e .square + ' ' + f'<#{ rfi ["cid" ]} >{ m } \n ' + \
29
34
('\n ' .join ([f'⠀⠀- [`{ rfr ["name" ]} `](https://github.com/{ rfr ["name" ]} )'
@@ -118,7 +123,7 @@ async def config_show_feed_command(self, ctx: GitBotContext):
118
123
embed : GitBotEmbed = GitBotEmbed (
119
124
color = self .bot .mgr .c .discord .blurple ,
120
125
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' ]),
122
127
footer = ctx .fmt ('footer' , f'git config feed channel {{{ ctx .l .help .argument_explainers .channel .name } }}' ))
123
128
await embed .send (ctx )
124
129
else :
0 commit comments