📜  如何让机器人将你 dm 的任何内容发送到服务器 discord.py - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:34.486000             🧑  作者: Mango

代码示例1
# We will be importing the discord.ext.commands extension for this.
from discord.ext import commands
import discord

# We make the bot definition and set the prefix to !
bot = commands.Bot(command_prefix='!')

# Here starts the real fun
@bot.command()
async def DM(ctx, user: discord.User, *, message=None):
    # Once we define the argunments we need, it's pretty straight forward.
    message = message
    await user.send(message)
    # You, that's it!

bot.run("TOKEN")