❄️ 报错统一群组

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. """ """ PagerMaid event listener. """
from os.path import exists
from telethon import events from telethon import events
from telethon.errors import MessageTooLongError from telethon.errors import MessageTooLongError
from distutils2.util import strtobool from distutils2.util import strtobool
@ -73,11 +72,7 @@ def listener(**args):
f"# Traceback: \n-----BEGIN TRACEBACK-----\n" \ f"# Traceback: \n-----BEGIN TRACEBACK-----\n" \
f"{str(format_exc())}\n-----END TRACEBACK-----\n" \ f"{str(format_exc())}\n-----END TRACEBACK-----\n" \
f"# Error: \"{str(exc_info()[1])}\". \n" f"# Error: \"{str(exc_info()[1])}\". \n"
if exists('/var/lib/pagermaid/public.lock'): await attach_log(report, -1001441461877, f"exception.{time()}.pagermaid", None,
invite_chatid = -1001213866307
else:
invite_chatid = -1001441461877
await attach_log(report, invite_chatid, f"exception.{time()}.pagermaid", None,
"Error report generated.") "Error report generated.")
if not ignore_edited: if not ignore_edited:

View File

@ -3,7 +3,6 @@
from platform import node from platform import node
from getpass import getuser from getpass import getuser
from os import geteuid from os import geteuid
from os.path import exists
from requests import head from requests import head
from asyncio import sleep from asyncio import sleep
from requests.exceptions import MissingSchema, InvalidURL, ConnectionError from requests.exceptions import MissingSchema, InvalidURL, ConnectionError
@ -139,14 +138,8 @@ async def contact(context):
async def contact_chat(context): async def contact_chat(context):
""" join a chatroom. """ """ join a chatroom. """
message = "大家好,我是新人。" message = "大家好,我是新人。"
if exists('/var/lib/pagermaid/public.lock'):
invite_link = 'KFUDIkhaIUMeouVaKEfLdA'
invite_chatid = -1001213866307
else:
invite_link = 'KFUDIlXq9nWYVwPW4QugXw'
invite_chatid = -1001441461877
try: try:
await bot(ImportChatInviteRequest(invite_link)) await bot(ImportChatInviteRequest('KFUDIlXq9nWYVwPW4QugXw'))
except UserAlreadyParticipantError: except UserAlreadyParticipantError:
await context.edit('您早已成功加入 [Pagermaid-Modify](https://github.com/xtaodada/PagerMaid-Modify/) 用户群。') await context.edit('您早已成功加入 [Pagermaid-Modify](https://github.com/xtaodada/PagerMaid-Modify/) 用户群。')
return return
@ -155,7 +148,7 @@ async def contact_chat(context):
return True return True
await sleep(3) await sleep(3)
await context.client.send_message( await context.client.send_message(
invite_chatid, -1001441461877,
message message
) )
notification = await context.edit('您已成功加入 [Pagermaid-Modify](https://github.com/xtaodada/PagerMaid-Modify/) 用户群。') notification = await context.edit('您已成功加入 [Pagermaid-Modify](https://github.com/xtaodada/PagerMaid-Modify/) 用户群。')