你如何用他们的不和谐 id [DISCORD.PY] DM 一个人

时间:2021-03-24 00:47:37

标签: python discord discord.py

我有以下代码:

import discord
from discord.ext import commands
import time
import random

client = commands.Bot(command_prefix='n!')
token = 'token'
peopleid = [id1, id2]

@client.event
async def on_ready():
    print('Bot online!')
    await client.change_presence(activity=discord.Game(name="presence"))

@client.command()
async def botsend(ctx, args, ):
messagep = f'message'
    if args == 'on':
        #random.choice(peopleid)
        print('ON')
        await ctx.send('dm messaging has been turned on')
        while True:
            await ctx.send(f'{messagep}')
            print('messaged')
            time.sleep(2)
    if args == 'off':
        await ctx.send('dm messaging has been turned off')
        print('OFF')
        

client.run(token)

我想使用 peopleidrandom.choice 中选择一个随机 ID,然后向相应的用户发送 DM。我该怎么做?

0 个答案:

没有答案