❄️ 报错统一群组

This commit is contained in:
xtaodada 2020-08-09 17:14:16 +08:00
parent eecb8cbf38
commit 4af2c10147
No known key found for this signature in database
GPG Key ID: EE4DC37B55E24736
2 changed files with 3 additions and 15 deletions

View File

@ -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:

View File

@ -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/) 用户群。')