-
-
Save raku-cat/c0c89e078a15ca47e2b9b75a326c0281 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(): | |
adnum = 0 | |
while 1: | |
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): | |
adnum = 0 | |
else: | |
pass | |
await bot.sendMessage(-1001132937659, ad[adnum]) | |
dt = datetime.now() + timedelta(minutes=int(interval)) | |
adnum += 1 | |
while datetime.now() < dt: | |
await asyncio.sleep(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment