channels: don't ignore unknown channel types

This commit is contained in:
Luna 2021-09-05 23:29:07 -03:00
parent 9d81bef527
commit 0a0d0603dd
1 changed files with 4 additions and 6 deletions

View File

@ -256,8 +256,7 @@ async def close_channel(channel_id):
await app.dispatcher.guild.dispatch(guild_id, ("CHANNEL_DELETE", chan)) await app.dispatcher.guild.dispatch(guild_id, ("CHANNEL_DELETE", chan))
await app.dispatcher.channel.drop(channel_id) await app.dispatcher.channel.drop(channel_id)
return jsonify(chan) return jsonify(chan)
elif ctype == ChannelType.DM:
if ctype == ChannelType.DM:
chan = await app.storage.get_channel(channel_id) chan = await app.storage.get_channel(channel_id)
# we don't ever actually delete DM channels off the database. # we don't ever actually delete DM channels off the database.
@ -278,8 +277,7 @@ async def close_channel(channel_id):
await dispatch_user(user_id, ("CHANNEL_DELETE", chan)) await dispatch_user(user_id, ("CHANNEL_DELETE", chan))
return jsonify(chan) return jsonify(chan)
elif ctype == ChannelType.GROUP_DM:
if ctype == ChannelType.GROUP_DM:
await gdm_remove_recipient(channel_id, user_id) await gdm_remove_recipient(channel_id, user_id)
gdm_count = await app.db.fetchval( gdm_count = await app.db.fetchval(
@ -294,8 +292,8 @@ async def close_channel(channel_id):
if gdm_count == 0: if gdm_count == 0:
# destroy dm # destroy dm
await gdm_destroy(channel_id) await gdm_destroy(channel_id)
else:
raise ChannelNotFound() raise RuntimeError(f"Data inconsistency: Unknown channel type {ctype}")
async def _update_pos(channel_id, pos: int): async def _update_pos(channel_id, pos: int):