From 339b032ef586bb29c2ac63f89fa6ac18e6698609 Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 26 Jan 2022 22:36:44 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20wrong=20chat=5Fid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pagermaid/modules/help.py | 6 +++--- pagermaid/modules/plugin.py | 12 ++++++------ pagermaid/modules/system.py | 2 +- pagermaid/modules/update.py | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pagermaid/modules/help.py b/pagermaid/modules/help.py index acd4fb7..9d6f68f 100644 --- a/pagermaid/modules/help.py +++ b/pagermaid/modules/help.py @@ -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() diff --git a/pagermaid/modules/plugin.py b/pagermaid/modules/plugin.py index 0b181e5..05fe8f7 100644 --- a/pagermaid/modules/plugin.py +++ b/pagermaid/modules/plugin.py @@ -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: diff --git a/pagermaid/modules/system.py b/pagermaid/modules/system.py index 7ce6344..8849e67 100644 --- a/pagermaid/modules/system.py +++ b/pagermaid/modules/system.py @@ -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 diff --git a/pagermaid/modules/update.py b/pagermaid/modules/update.py index 88f5977..2f029fd 100644 --- a/pagermaid/modules/update.py +++ b/pagermaid/modules/update.py @@ -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()