33 lines
684 B
Python
33 lines
684 B
Python
import asyncio
|
|
|
|
import random
|
|
|
|
from payphone.bot import Payphone
|
|
from payphone.core import constants, messages, logging
|
|
|
|
|
|
async def main():
|
|
logging.setup("Connect")
|
|
|
|
bot = Payphone()
|
|
|
|
await bot.login(constants.TOKEN)
|
|
|
|
while True:
|
|
pairs = await bot.call_handler.connect()
|
|
|
|
message = random.choice(messages.ANSWERED)
|
|
|
|
await asyncio.gather(
|
|
*[
|
|
bot.get_partial_messageable(channel).send(f"☎️ {message}")
|
|
for pair in pairs
|
|
for channel in pair
|
|
]
|
|
)
|
|
|
|
if pairs:
|
|
logging.logger.info("Connected %s calls.", len(pairs))
|
|
|
|
await asyncio.sleep(1)
|