Skip to content

Commit

Permalink
Merge pull request #7 from Valorant-Shop-CN/develop
Browse files Browse the repository at this point in the history
chome(1.0.9): release v1.0.9
  • Loading branch information
musnows authored Feb 25, 2023
2 parents eecfe6d + 139fb3c commit f30571a
Show file tree
Hide file tree
Showing 21 changed files with 1,298 additions and 284 deletions.
6 changes: 3 additions & 3 deletions code/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ async def get_dailshop_img(request):


# 获取图片url
@routes.post('/shop-url')
@routes.post('/shop')
async def get_dailshop_img(request):
print(f"[{GetTime()}] [request] /shop-url")
print(f"[{GetTime()}] [request] /shop")
try:
ret = await login_img_request(request,"POST")
return web.Response(body=json.dumps(ret, indent=2, sort_keys=True, ensure_ascii=False),
Expand Down Expand Up @@ -155,6 +155,6 @@ async def aifadian_webhook(request):
if __name__ == '__main__':
try: # host需要设置成0.0.0.0,否则只有本地才能访问
print(f"[API Start] starting at {GetTime()}")
web.run_app(app, host='0.0.0.0', port=14725)
web.run_app(app, host='0.0.0.0', port=14726)
except:
print(traceback.format_exc())
22 changes: 22 additions & 0 deletions code/config/config.exp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"token":{
"bot": "机器人websocket token",
"api_bot_token": "api用来上传图片的机器人websocket token",
"img_upload_token": "用来进行vip商店图片测试的机器人websocket token(发图片让kook的内容识别来判断有么有问题)"
},
"master_id": "机器人开发者userid",
"caiyun": "彩云小译的token",
"channel":{
"debug_ch": "发送错误日志的频道",
"img_upload_ch": "用来测试vip商店图片的频道"
},
"lsky":{
"url":"lsky图床的url(该功能未启用)",
"token":"lsky图床的token(该功能未启用)"
},
"leancloud":{
"appid":"leancloud数据库的appid(可联系作者,共用皮肤评价数据库)",
"master_key":"leancloud数据库的masterkey"
},
"no":1000
}
206 changes: 92 additions & 114 deletions code/main.py

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions code/utils/BotVip.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ async def replace_illegal_img(user_id: str, num: int):
except Exception as result:
err_str = f"ERR! [{GetTime()}] replace_illegal_img\n```\n{traceback.format_exc()}\n```"
print(err_str)
debug_ch = await bot.fetch_public_channel(config['debug_ch'])
debug_ch = await bot.fetch_public_channel(config['channel']['debug_ch'])
await bot.client.send(debug_ch, err_str) #发送消息到debug频道

#计算用户背景图的list大小,避免出现空list的情况
Expand Down Expand Up @@ -301,7 +301,7 @@ async def get_vip_shop_bg_cm(msg: Message):
#把被ban的图片替换成默认的图片,打印url便于日后排错
err_str += f"[UnidentifiedImageError] url={VipShopBgDict['bg'][msg.author_id]['background'][i]}\n```"
await replace_illegal_img(msg.author_id, i) #替换图片
debug_ch = await bot.fetch_public_channel(config['debug_ch'])
debug_ch = await bot.fetch_public_channel(config['channel']['debug_ch'])
await bot.client.send(debug_ch, err_str) # 发送消息到debug频道
print(err_str)
return f"您上传的图片违规!请慎重选择图片。多次上传违规图片会导致阿狸被封!下方有违规图片的url\n{err_str}"
Expand Down
4 changes: 2 additions & 2 deletions code/utils/KookApi.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

from utils.FileManage import config
# 下方更新卡片消息需要bot
bot = Bot(token=config['token'])
bot = Bot(token=config['token']['bot'])
# kook的base_url和headers
kook_base_url = "https://www.kookapp.cn"
kook_headers = {f'Authorization': f"Bot {config['token']}"}
kook_headers = {f'Authorization': f"Bot {config['token']['bot']}"}


#################################机器人在玩状态####################################
Expand Down
2 changes: 1 addition & 1 deletion code/utils/ShopImg.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ def skin_uuid_to_comp(skinuuid, ran, is_169=False):


# 获取16比9的每日商店的图片
async def get_shop_img_169(list_shop: dict, vp: str, rp: str, bg_img_src="err"):
async def get_shop_img_169(list_shop: dict, vp: int, rp: int, bg_img_src="err"):
""" args:
- list_shop: user daily shop skin dict
- bg_img_src: background img url
Expand Down
Loading

0 comments on commit f30571a

Please sign in to comment.