-
-
Save raku-cat/ba2d271cee2a64012d145f71d184d56f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async def ad_roll(): | |
async def ad_roll_loop(adnum): | |
async with aiofiles.open('keys.json', 'r') as k: | |
interval = json.loads(await k.read())['interval'] | |
async with aiofiles.open('ads.json', 'r') as a: | |
ad = json.loads(await a.read())['ads'] | |
if adnum > len(ad): | |
await ad_roll_loop(0) | |
await bot.sendMessage(-1001132937659, ad[adnum]) | |
dt = datetime.now() + timedelta(minutes=int(interval)) | |
await ad_roll_loop(adnum + 1) | |
while datetime.now() < dt: | |
await asyncio.sleep(1) | |
#await ad_roll_loop(adnum + 1) | |
await ad_roll_loop(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment