try to send accepted information via discord

This commit is contained in:
2024-12-08 22:57:56 +01:00
parent f40f6c2d02
commit 1722bd6f35
3 changed files with 56 additions and 10 deletions
+38
View File
@@ -0,0 +1,38 @@
# This example requires the 'message_content' intent.
import asyncio
import discord
intents = discord.Intents.default()
intents.messages = True
discord_client = discord.Client(intents=intents)
@discord_client.event
async def on_ready():
print(f'We have logged in as {discord_client.user}')
# await send_message("我是机器人")
@discord_client.event
async def on_message(message):
pass
async def send_message(message):
print("will call send")
channel = discord_client.get_channel(1149373754053496866)
await channel.send(message)
def run_discord():
_token = 'MTMxNTI5OTkxODk4MTg5MDExOQ.GKA6lA.wHM4fTFT1luVrptK4YxEtFn_WhUnavtIrla_TE'
discord_client.run(_token)
if __name__ == '__main__':
# loop = asyncio.get_event_loop()
# loop.run_until_complete(client.start())
# client.start()
asyncio.run(run_discord())