From 4af2c1014752b2a10577bd74e75c8b6b0519263e Mon Sep 17 00:00:00 2001 From: xtaodada Date: Sun, 9 Aug 2020 17:14:16 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9D=84=EF=B8=8F=20=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E7=BB=9F=E4=B8=80=E7=BE=A4=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pagermaid/listener.py | 7 +------ pagermaid/modules/system.py | 11 ++--------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/pagermaid/listener.py b/pagermaid/listener.py index 0383b5e..51a841e 100644 --- a/pagermaid/listener.py +++ b/pagermaid/listener.py @@ -1,6 +1,5 @@ """ PagerMaid event listener. """ -from os.path import exists from telethon import events from telethon.errors import MessageTooLongError from distutils2.util import strtobool @@ -73,11 +72,7 @@ def listener(**args): f"# Traceback: \n-----BEGIN TRACEBACK-----\n" \ f"{str(format_exc())}\n-----END TRACEBACK-----\n" \ f"# Error: \"{str(exc_info()[1])}\". \n" - if exists('/var/lib/pagermaid/public.lock'): - invite_chatid = -1001213866307 - else: - invite_chatid = -1001441461877 - await attach_log(report, invite_chatid, f"exception.{time()}.pagermaid", None, + await attach_log(report, -1001441461877, f"exception.{time()}.pagermaid", None, "Error report generated.") if not ignore_edited: diff --git a/pagermaid/modules/system.py b/pagermaid/modules/system.py index 3016af1..2dc09c0 100644 --- a/pagermaid/modules/system.py +++ b/pagermaid/modules/system.py @@ -3,7 +3,6 @@ from platform import node from getpass import getuser from os import geteuid -from os.path import exists from requests import head from asyncio import sleep from requests.exceptions import MissingSchema, InvalidURL, ConnectionError @@ -139,14 +138,8 @@ async def contact(context): async def contact_chat(context): """ join a chatroom. """ message = "大家好,我是新人。" - if exists('/var/lib/pagermaid/public.lock'): - invite_link = 'KFUDIkhaIUMeouVaKEfLdA' - invite_chatid = -1001213866307 - else: - invite_link = 'KFUDIlXq9nWYVwPW4QugXw' - invite_chatid = -1001441461877 try: - await bot(ImportChatInviteRequest(invite_link)) + await bot(ImportChatInviteRequest('KFUDIlXq9nWYVwPW4QugXw')) except UserAlreadyParticipantError: await context.edit('您早已成功加入 [Pagermaid-Modify](https://github.com/xtaodada/PagerMaid-Modify/) 用户群。') return @@ -155,7 +148,7 @@ async def contact_chat(context): return True await sleep(3) await context.client.send_message( - invite_chatid, + -1001441461877, message ) notification = await context.edit('您已成功加入 [Pagermaid-Modify](https://github.com/xtaodada/PagerMaid-Modify/) 用户群。')