birthday
This commit is contained in:
parent
b9703ce354
commit
860659fd8e
@ -48,6 +48,7 @@ class BirthdayClient(Client):
|
|||||||
await self.channel.send(f'Heute hat {name} ({member.mention}) Geburtstag! Seid nett :birthday: :tada:')
|
await self.channel.send(f'Heute hat {name} ({member.mention}) Geburtstag! Seid nett :birthday: :tada:')
|
||||||
|
|
||||||
def parse_birthdays(self) -> TextChannel:
|
def parse_birthdays(self) -> TextChannel:
|
||||||
|
logging.info('Reading file from %s', self.config_file)
|
||||||
with open(self.config_file) as fh:
|
with open(self.config_file) as fh:
|
||||||
config = BirthdayConfig.model_validate_json(fh.read())
|
config = BirthdayConfig.model_validate_json(fh.read())
|
||||||
guild = self.get_guild(config.channel.server_id)
|
guild = self.get_guild(config.channel.server_id)
|
||||||
@ -65,6 +66,7 @@ def main() -> None:
|
|||||||
intents.message_content = intents.members = intents.messages = True
|
intents.message_content = intents.members = intents.messages = True
|
||||||
|
|
||||||
log_handler = logging.FileHandler(filename='fregbot-birthday.log', encoding='utf-8', mode='w')
|
log_handler = logging.FileHandler(filename='fregbot-birthday.log', encoding='utf-8', mode='w')
|
||||||
|
log_handler.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
client = BirthdayClient(intents=intents)
|
client = BirthdayClient(intents=intents)
|
||||||
client.config_file = Path(os.getenv('FREG_BIRTHDAY_CONFIG') or '')
|
client.config_file = Path(os.getenv('FREG_BIRTHDAY_CONFIG') or '')
|
||||||
@ -76,7 +78,7 @@ def main() -> None:
|
|||||||
if not token:
|
if not token:
|
||||||
logging.error('Kein Token gefunden. Kann nicht starten. Umgebungsvariable FREG_TOKEN muss gesetzt sein')
|
logging.error('Kein Token gefunden. Kann nicht starten. Umgebungsvariable FREG_TOKEN muss gesetzt sein')
|
||||||
exit(1)
|
exit(1)
|
||||||
client.run(token, log_handler=log_handler)
|
client.run(token, log_handler=log_handler, root_logger=True)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user