diff --git a/litecord/blueprints/channels.py b/litecord/blueprints/channels.py index 5cfff5d..2690440 100644 --- a/litecord/blueprints/channels.py +++ b/litecord/blueprints/channels.py @@ -18,7 +18,7 @@ along with this program. If not, see . """ import time -from typing import List +from typing import List, Optional from quart import Blueprint, request, current_app as app, jsonify from logbook import Logger @@ -263,8 +263,11 @@ async def _update_pos(channel_id, pos: int): """, pos, channel_id) -async def _mass_chan_update(guild_id, channel_ids: List[int]): +async def _mass_chan_update(guild_id, channel_ids: List[Optional[int]]): for channel_id in channel_ids: + if channel_id is None: + continue + chan = await app.storage.get_channel(channel_id) await app.dispatcher.dispatch( 'guild', guild_id, 'CHANNEL_UPDATE', chan) diff --git a/litecord/blueprints/guild/roles.py b/litecord/blueprints/guild/roles.py index 2a06c73..5dfcbe7 100644 --- a/litecord/blueprints/guild/roles.py +++ b/litecord/blueprints/guild/roles.py @@ -257,13 +257,16 @@ def gen_pairs(list_of_changes: List[Dict[str, int]], # position we want to change to element_2 = current_state.get(new_pos_1) + if element_2 is None: + continue + # if there is, is that existing channel being # swapped to another position? new_pos_2 = preferred_state.get(element_2) # if its being swapped to leave space, add it # to the pairs list - if element_2 and new_pos_2: + if new_pos_2 is not None: pairs.append( ((element_1, new_pos_1), (element_2, new_pos_2)) ) diff --git a/litecord/blueprints/user/billing.py b/litecord/blueprints/user/billing.py index eb4de46..f37744e 100644 --- a/litecord/blueprints/user/billing.py +++ b/litecord/blueprints/user/billing.py @@ -148,8 +148,6 @@ async def get_payment_source(user_id: int, source_id: int, db=None) -> dict: if not db: db = app.db - source = {} - source_type = await db.fetchval(""" SELECT source_type FROM user_payment_sources