show error if environment variables are not defined
parent
ad0d6a3b3b
commit
000fc22f32
|
@ -15,13 +15,17 @@ global USERS
|
|||
USERS={}
|
||||
global COUNT_MSG
|
||||
COUNT_MSG=0
|
||||
|
||||
|
||||
PRIVATE_GROUP_BOT_API_ID = int(os.environ.get("PRIVATE_GROUP_BOT_API_ID"))
|
||||
global PRIVATE_GROUP_BOT_API_ID
|
||||
PRIVATE_GROUP_BOT_API_ID = os.environ.get("PRIVATE_GROUP_BOT_API_ID")
|
||||
|
||||
|
||||
@borg.on(events.NewMessage(incoming=True))
|
||||
async def _(event):
|
||||
global PRIVATE_GROUP_BOT_API_ID
|
||||
if not PRIVATE_GROUP_BOT_API_ID:
|
||||
await event.edit("This functionality will not work")
|
||||
return false
|
||||
PRIVATE_GROUP_BOT_API_ID = int(PRIVATE_GROUP_BOT_API_ID)
|
||||
global COUNT_MSG
|
||||
global USERS
|
||||
global ISAFK
|
||||
|
@ -55,6 +59,11 @@ async def _(event):
|
|||
|
||||
@borg.on(events.NewMessage(outgoing=True, pattern=r'.iamafk (.*)'))
|
||||
async def _(event):
|
||||
global PRIVATE_GROUP_BOT_API_ID
|
||||
if not PRIVATE_GROUP_BOT_API_ID:
|
||||
await event.edit("This functionality will not work")
|
||||
return false
|
||||
PRIVATE_GROUP_BOT_API_ID = int(PRIVATE_GROUP_BOT_API_ID)
|
||||
if event.fwd_from:
|
||||
return
|
||||
string = event.pattern_match.group(1)
|
||||
|
@ -68,6 +77,11 @@ async def _(event):
|
|||
|
||||
@borg.on(events.NewMessage(outgoing=True, pattern='.notafk'))
|
||||
async def _(event):
|
||||
global PRIVATE_GROUP_BOT_API_ID
|
||||
if not PRIVATE_GROUP_BOT_API_ID:
|
||||
await event.edit("This functionality will not work")
|
||||
return false
|
||||
PRIVATE_GROUP_BOT_API_ID = int(PRIVATE_GROUP_BOT_API_ID)
|
||||
global ISAFK
|
||||
global COUNT_MSG
|
||||
global USERS
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
# https://t.me/SnowballFight/257378
|
||||
from telethon import events
|
||||
from telethon.events import StopPropagation
|
||||
@borg.on(events.NewMessage(chats=['@PublicTestGroup', '@SnowballFight', '@BotTalk']))
|
||||
async def _(event):
|
||||
raise StopPropagation
|
|
@ -82,7 +82,6 @@ async def _(event):
|
|||
force_document=False,
|
||||
allow_cache=False,
|
||||
reply_to=event.message.reply_to_msg_id,
|
||||
supports_streaming=True,
|
||||
attributes=[
|
||||
DocumentAttributeVideo(
|
||||
duration=metadata.get("duration").seconds,
|
||||
|
|
Reference in New Issue