Skip to content
This repository has been archived by the owner on Oct 6, 2023. It is now read-only.

Commit

Permalink
News at the same time
Browse files Browse the repository at this point in the history
  • Loading branch information
Nygon committed Jun 2, 2021
1 parent 61b8afc commit 7fb6370
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,18 @@ async def on_ready():
feed_multi_news_rss.start()
print('bot in active')

@tasks.loop(seconds=20)
@tasks.loop(seconds=5)
async def feed_multi_news_rss():
with open("param.csv") as csvfile:
reader = csv.DictReader(csvfile)

for row in reader:
await feed_news_rss(row)
tasks = []

for row in reader:
task = asyncio.create_task(feed_news_rss(row))
tasks.append(task)

responses = await asyncio.gather(*tasks)


async def feed_news_rss(row):
Expand All @@ -47,6 +52,6 @@ async def feed_news_rss(row):
e.set_author(name=row["name"])
e.set_footer(text=entry.published)
e.set_image(url=picnews)
#await channel.send(embed=e)
await channel.send(embed=e)

bot.run(token)
2 changes: 1 addition & 1 deletion src/param.csv
Original file line number Diff line number Diff line change
@@ -1 +1 @@
fluxrss,name,channel,datelastpublishhttps://www.gameblog.fr/rss.php,Gameblog,849664021429747732,https://www.gameblog.fr/rss.php,Gameblog,849664039781138472,
fluxrss,name,channel,datelastpublishhttps://www.gameblog.fr/rss.php,Gameblog,849664021429747732,https://www.gamekyo.com/news.xml,GameKyo,849664039781138472,
Expand Down

0 comments on commit 7fb6370

Please sign in to comment.