🐛 Fix wrong chat_id

This commit is contained in:
Sam 2022-01-26 22:36:44 +08:00
parent d5d33dc047
commit 339b032ef5
Signed by: sam01101
GPG Key ID: 42D7B6D13FF5E611
4 changed files with 12 additions and 12 deletions

View File

@ -85,7 +85,7 @@ async def lang_change(context):
f.write(file)
result = await context.edit(f"{lang('lang_change_to')} {to_lang}, {lang('lang_reboot')}")
if redis_status():
redis.set("restart_edit", f"{result.id}|{result.peer_id.channel_id}")
redis.set("restart_edit", f"{result.id}|{result.chat_id}")
await context.client.disconnect()
else:
await context.edit(
@ -120,7 +120,7 @@ async def alias_commands(context):
json_dump(alias_dict, f)
result = await context.edit(lang('alias_success'))
if redis_status():
redis.set("restart_edit", f"{result.id}|{result.peer_id.channel_id}")
redis.set("restart_edit", f"{result.id}|{result.chat_id}")
await context.client.disconnect()
except KeyError:
await context.edit(lang('alias_no_exist'))
@ -136,5 +136,5 @@ async def alias_commands(context):
json_dump(alias_dict, f)
result = await context.edit(lang('alias_success'))
if redis_status():
redis.set("restart_edit", f"{result.id}|{result.peer_id.channel_id}")
redis.set("restart_edit", f"{result.id}|{result.chat_id}")
await context.client.disconnect()

View File

@ -86,7 +86,7 @@ async def plugin(context):
result = await context.edit(
f"{lang('apt_plugin')} {path.basename(file_path)[:-3]} {lang('apt_installed')},{lang('apt_reboot')}")
if redis_status():
redis.set("restart_edit", f"{result.id}|{result.peer_id.channel_id}")
redis.set("restart_edit", f"{result.id}|{result.chat_id}")
await log(f"{lang('apt_install_success')} {path.basename(file_path)[:-3]}.")
await context.client.disconnect()
elif len(context.parameter) >= 2:
@ -141,7 +141,7 @@ async def plugin(context):
result = await context.edit(message)
if restart:
if redis_status():
redis.set("restart_edit", f"{result.id}|{result.peer_id.channel_id}")
redis.set("restart_edit", f"{result.id}|{result.chat_id}")
await context.client.disconnect()
else:
await context.edit(lang('arg_error'))
@ -157,7 +157,7 @@ async def plugin(context):
result = await context.edit(
f"{lang('apt_remove_success')} {context.parameter[1]}, {lang('apt_reboot')} ")
if redis_status():
redis.set("restart_edit", f"{result.id}|{result.peer_id.channel_id}")
redis.set("restart_edit", f"{result.id}|{result.chat_id}")
await log(f"{lang('apt_remove')} {context.parameter[1]}.")
await context.client.disconnect()
elif exists(f"{plugin_directory}{context.parameter[1]}.py.disabled"):
@ -219,7 +219,7 @@ async def plugin(context):
result = await context.edit(
f"{lang('apt_plugin')} {context.parameter[1]} {lang('apt_enable')},{lang('apt_reboot')}")
if redis_status():
redis.set("restart_edit", f"{result.id}|{result.peer_id.channel_id}")
redis.set("restart_edit", f"{result.id}|{result.chat_id}")
await log(f"{lang('apt_enable')} {context.parameter[1]}.")
await context.client.disconnect()
else:
@ -234,7 +234,7 @@ async def plugin(context):
result = await context.edit(
f"{lang('apt_plugin')} {context.parameter[1]} {lang('apt_disable')},{lang('apt_reboot')}")
if redis_status():
redis.set("restart_edit", f"{result.id}|{result.peer_id.channel_id}")
redis.set("restart_edit", f"{result.id}|{result.chat_id}")
await log(f"{lang('apt_disable')} {context.parameter[1]}.")
await context.client.disconnect()
else:
@ -309,7 +309,7 @@ async def plugin(context):
json.dump(version_json, f)
result = await context.edit(lang('apt_reading_list') + need_update)
if redis_status():
redis.set("restart_edit", f"{result.id}|{result.peer_id.channel_id}")
redis.set("restart_edit", f"{result.id}|{result.chat_id}")
await context.client.disconnect()
elif context.parameter[0] == "search":
if len(context.parameter) == 1:

View File

@ -135,7 +135,7 @@ async def restart(context):
try:
result = await context.edit(lang('restart_processing'))
if redis_status():
redis.set("restart_edit", f"{result.id}|{result.peer_id.channel_id}")
redis.set("restart_edit", f"{result.id}|{result.chat_id}")
except: # noqa
pass

View File

@ -203,14 +203,14 @@ async def update(context):
await log(f"PagerMaid-Modify {lang('update_is_updated')}")
result = await context.edit(lang('update_success') + lang('apt_reboot'))
if redis_status():
redis.set("restart_edit", f"{result.id}|{result.peer_id.channel_id}")
redis.set("restart_edit", f"{result.id}|{result.chat_id}")
await context.client.disconnect()
except GitCommandError:
upstream_remote.git.reset('--hard')
await log(lang('update_failed'))
result = await context.edit(lang('update_failed') + lang('apt_reboot'))
if redis_status():
redis.set("restart_edit", f"{result.id}|{result.peer_id.channel_id}")
redis.set("restart_edit", f"{result.id}|{result.chat_id}")
await context.client.disconnect()