mirror of https://gitlab.com/litecord/litecord.git
add channel-icons icon scope handling
This commit is contained in:
parent
0b99149053
commit
ed27bb605a
|
|
@ -76,3 +76,9 @@ async def _get_user_avatar(user_id, avatar_file):
|
|||
# @bp.route('/app-icons/<int:application_id>/<icon_hash>.<ext>')
|
||||
async def get_app_icon(application_id, icon_hash, ext):
|
||||
pass
|
||||
|
||||
|
||||
@bp.route('/channel-icons/<int:channel_id>/<icon_file>', methods=['GET'])
|
||||
async def _get_gdm_icon(guild_id: int, icon_file: str):
|
||||
icon_hash, ext = splitext_(icon_file)
|
||||
return await send_icon('channel-icons', guild_id, icon_hash, ext=ext)
|
||||
|
|
|
|||
|
|
@ -161,21 +161,18 @@ def parse_data_uri(string) -> tuple:
|
|||
def _gen_update_sql(scope: str) -> str:
|
||||
field = {
|
||||
'user': 'avatar',
|
||||
'guild': 'icon'
|
||||
'guild': 'icon',
|
||||
'channel-icons': 'icon',
|
||||
}[scope]
|
||||
|
||||
table = {
|
||||
'user': 'users',
|
||||
'guild': 'guilds'
|
||||
}[scope]
|
||||
|
||||
col = {
|
||||
'user': 'id',
|
||||
'guild': 'id'
|
||||
'guild': 'guilds',
|
||||
'channel-icons': 'group_dm_channels'
|
||||
}[scope]
|
||||
|
||||
return f"""
|
||||
SELECT {field} FROM {table} WHERE {col} = $1
|
||||
SELECT {field} FROM {table} WHERE id = $1
|
||||
"""
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue