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>')
|
# @bp.route('/app-icons/<int:application_id>/<icon_hash>.<ext>')
|
||||||
async def get_app_icon(application_id, icon_hash, ext):
|
async def get_app_icon(application_id, icon_hash, ext):
|
||||||
pass
|
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:
|
def _gen_update_sql(scope: str) -> str:
|
||||||
field = {
|
field = {
|
||||||
'user': 'avatar',
|
'user': 'avatar',
|
||||||
'guild': 'icon'
|
'guild': 'icon',
|
||||||
|
'channel-icons': 'icon',
|
||||||
}[scope]
|
}[scope]
|
||||||
|
|
||||||
table = {
|
table = {
|
||||||
'user': 'users',
|
'user': 'users',
|
||||||
'guild': 'guilds'
|
'guild': 'guilds',
|
||||||
}[scope]
|
'channel-icons': 'group_dm_channels'
|
||||||
|
|
||||||
col = {
|
|
||||||
'user': 'id',
|
|
||||||
'guild': 'id'
|
|
||||||
}[scope]
|
}[scope]
|
||||||
|
|
||||||
return f"""
|
return f"""
|
||||||
SELECT {field} FROM {table} WHERE {col} = $1
|
SELECT {field} FROM {table} WHERE id = $1
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue