From 70e79a465feeff825e89d9156c60957ffdba0bff Mon Sep 17 00:00:00 2001 From: pixeldeee Date: Thu, 31 Aug 2023 20:58:10 +0300 Subject: [PATCH] new examples! --- examples/events/message.py | 10 +++++++++- examples/timers.py | 13 +++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 examples/timers.py diff --git a/examples/events/message.py b/examples/events/message.py index be860c6..d6ed6ee 100644 --- a/examples/events/message.py +++ b/examples/events/message.py @@ -1,4 +1,4 @@ -from pytecord import Client, Message +from pytecord import Client, Message, MessageDeleteEvent client = Client('YOUR_TOKEN') @@ -6,4 +6,12 @@ async def message_create(message: Message): # also you can use async def message(): await message.reply(f'Hello, {message.author}!') # str(message.author) == message.author.mention +@client.listen() +async def message_update(message: Message): + await message.reply('This message has been updated!') + +@client.listen() +async def message_delete(event: MessageDeleteEvent): + await event.channel.send('Message has been deleted in this channel!') + client.run() diff --git a/examples/timers.py b/examples/timers.py new file mode 100644 index 0000000..950ac6c --- /dev/null +++ b/examples/timers.py @@ -0,0 +1,13 @@ +from pytecord import Client + +client = Client('YOUR_TOKEN') + +@client.timer(seconds=1) +async def message_every_second(): + print("I'll send this message to your console every 1 second!") + +@client.timer(days=1) +async def good_morning(): + print('Good morning!') + +client.run()