From 9bffbf7cd59254b72610e3195a34b9673bc10fd1 Mon Sep 17 00:00:00 2001 From: Ching Date: Fri, 15 Sep 2023 19:51:07 +0800 Subject: [PATCH] =?UTF-8?q?feat(discord=5Fbot.py):=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E4=BA=86=20discord=5Fbot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加了 discord_bot Signed-off-by: Ching --- discord_bot.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 discord_bot.py diff --git a/discord_bot.py b/discord_bot.py new file mode 100644 index 0000000..16ffd99 --- /dev/null +++ b/discord_bot.py @@ -0,0 +1,16 @@ +import discord +from discord.ext import tasks + +bot = discord.Bot() + +@bot.event +async def on_ready(): + print(f"We have logged in as {bot.user}") + +@tasks.loop(seconds=10) +async def send_message(): + channel = bot.get_channel(1152167937852055552) + await channel.send('Hello World!') + print('send message') + +bot.run('MTE1MjE2NTc3NDMwNDIyMzI2Mg.GEi-17.VvuIkRy_cFD9XF6wtTagY95LKEbTxKaxy-FxGw') # 这里替换成你自己的 token