template message
This commit is contained in:
parent
c13eb0e6df
commit
6c0f9e34c1
11
main.py
11
main.py
@ -4,6 +4,9 @@ import yaml
|
||||
import requests
|
||||
from datetime import date
|
||||
|
||||
# To send discord messages (fucking async functions…)
|
||||
import asyncio
|
||||
|
||||
from apscheduler.schedulers.background import BackgroundScheduler
|
||||
scheduler = BackgroundScheduler()
|
||||
scheduler.start()
|
||||
@ -67,12 +70,13 @@ def cleaner ():
|
||||
# TODO erase calc revenus ?
|
||||
|
||||
@scheduler.scheduled_job('cron', day=5)
|
||||
async def reminder ():
|
||||
def reminder ():
|
||||
for i in guilds:
|
||||
print(f"reminding {i} : {guilds[i]['mailing']}")
|
||||
message = generate_reminder_message(guilds[i])
|
||||
send_mail(guilds[i], 'La mutunion c’est bientôt !', message)
|
||||
channel = client.get_channel(guilds[i]['reminder_channel'])
|
||||
await channel.send(message)
|
||||
asyncio.run_coroutine_threadsafe(channel.send(message), client.loop)
|
||||
|
||||
|
||||
def generate_reminder_message (guild):
|
||||
@ -87,7 +91,7 @@ Coucou !
|
||||
Il est l’heure de déclarer ses revenus :
|
||||
<{guild['link_declaration']}>
|
||||
|
||||
Et d’annoncer à quelle heure vous souhaitez faire la mututu :
|
||||
Et d’annoncer à quelle heure vous souhaitez faire la mutunion :
|
||||
<{sondage}>
|
||||
|
||||
Bon début de mois :D
|
||||
@ -107,7 +111,6 @@ async def on_ready():
|
||||
print(f'{client.user} is connected to the following guild:\n')
|
||||
for guild in client.guilds:
|
||||
print(f'{guild.name} (id: {guild.id})')
|
||||
await reminder()
|
||||
|
||||
@client.event
|
||||
async def on_message(message):
|
||||
|
Loading…
Reference in New Issue
Block a user