add automatic reply on infected not found, use inline button
This commit is contained in:
parent
ce964a5425
commit
dfec344952
2 changed files with 24 additions and 3 deletions
|
@ -12,7 +12,8 @@ before start, create config.json file with this content:
|
||||||
"timezone": "Europe/[Your_city]",
|
"timezone": "Europe/[Your_city]",
|
||||||
"db_pymysql": false,
|
"db_pymysql": false,
|
||||||
"db_sqlite3": true,
|
"db_sqlite3": true,
|
||||||
"a_h": true
|
"a_h": true,
|
||||||
|
"a_404_patient": true
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
___
|
___
|
||||||
|
|
24
ubot.py
24
ubot.py
|
@ -5,6 +5,7 @@ import asyncio
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
# from telethon.sync import TelegramClient
|
# from telethon.sync import TelegramClient
|
||||||
from telethon import TelegramClient, events, utils
|
from telethon import TelegramClient, events, utils
|
||||||
|
from telethon import functions, types
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
|
@ -38,6 +39,7 @@ timezone = config.timezone
|
||||||
db_pymysql = config.db_pymysql # set True or False
|
db_pymysql = config.db_pymysql # set True or False
|
||||||
db_sqlite3 = config.db_sqlite3 # set True or False
|
db_sqlite3 = config.db_sqlite3 # set True or False
|
||||||
a_h = config.a_h
|
a_h = config.a_h
|
||||||
|
a_404_patient = config.a_404_patient
|
||||||
|
|
||||||
|
|
||||||
class states:
|
class states:
|
||||||
|
@ -370,7 +372,6 @@ async def main():
|
||||||
|
|
||||||
count, e_info = get_some_patients()
|
count, e_info = get_some_patients()
|
||||||
random.shuffle(e_info) # more random for random and reduce risk get very immun target after restart
|
random.shuffle(e_info) # more random for random and reduce risk get very immun target after restart
|
||||||
logger.debug(e_info)
|
|
||||||
if count < 2:
|
if count < 2:
|
||||||
nema = '🤷 рандом хавай.'
|
nema = '🤷 рандом хавай.'
|
||||||
await event.edit(nema) # ред
|
await event.edit(nema) # ред
|
||||||
|
@ -386,7 +387,7 @@ async def main():
|
||||||
m = await event.reply(eb)
|
m = await event.reply(eb)
|
||||||
e_info.pop(0)
|
e_info.pop(0)
|
||||||
remaining_in_stack = len(e_info)
|
remaining_in_stack = len(e_info)
|
||||||
logger.info(f'remaining patience in current stack: {remaining_in_stack}')
|
logger.info(f'remaining patiences in current stack: {remaining_in_stack}')
|
||||||
random.shuffle(e_info)
|
random.shuffle(e_info)
|
||||||
states.last_sent_bioeb = time.time()
|
states.last_sent_bioeb = time.time()
|
||||||
if states.last_reply_bioeb_avocado == 0: # reduce negative ping -123456789 ms
|
if states.last_reply_bioeb_avocado == 0: # reduce negative ping -123456789 ms
|
||||||
|
@ -408,6 +409,7 @@ async def main():
|
||||||
logger.warning('you are eaten all')
|
logger.warning('you are eaten all')
|
||||||
break
|
break
|
||||||
random.shuffle(e_info)
|
random.shuffle(e_info)
|
||||||
|
logger.success(f'stack refresh: {count} patiences')
|
||||||
|
|
||||||
logger.warning('auto bioeb stopped')
|
logger.warning('auto bioeb stopped')
|
||||||
await event.reply('stopped')
|
await event.reply('stopped')
|
||||||
|
@ -419,6 +421,24 @@ async def main():
|
||||||
states.auto_bioeb_stop = True
|
states.auto_bioeb_stop = True
|
||||||
await event.edit('Trying stop...') # ред
|
await event.edit('Trying stop...') # ред
|
||||||
|
|
||||||
|
@client.on(events.NewMessage(pattern='🚫 Жертва не найдена'))
|
||||||
|
async def infection_not_found(event):
|
||||||
|
m = event.message
|
||||||
|
if m.sender_id != 6333102398:
|
||||||
|
pass
|
||||||
|
elif a_404_patient and m.mentioned:
|
||||||
|
await asyncio.sleep(random.uniform(1.0001, 2.22394))
|
||||||
|
result = await client(functions.messages.GetBotCallbackAnswerRequest( # src https://tl.telethon.dev/methods/messages/get_bot_callback_answer.html
|
||||||
|
peer=m.peer_id,
|
||||||
|
msg_id=m.id,
|
||||||
|
game=False, # idk why it works only when it false... 0_o
|
||||||
|
data=m.reply_markup.rows[0].buttons[0].data
|
||||||
|
))
|
||||||
|
logger.info('trying eat patient')
|
||||||
|
if result.message:
|
||||||
|
logger.info(f'avocado says: {result.message}')
|
||||||
|
|
||||||
|
|
||||||
@client.on(events.NewMessage(pattern='🌡 У вас горячка вызванная'))
|
@client.on(events.NewMessage(pattern='🌡 У вас горячка вызванная'))
|
||||||
async def need_h(event):
|
async def need_h(event):
|
||||||
m = event.message
|
m = event.message
|
||||||
|
|
Loading…
Reference in a new issue