小编Rya*_*n S的帖子

如何检查用户是否提供了参数 discord.py

我刚刚开始尝试学习如何在 discord.py 中编码。但是,我不确定如何检查用户是否在命令后提供了争论。例如,如果用户输入!kick,但没有在其后标记用户,它应该给他们一条错误消息,说“请标记用户”

所以我的问题是,如何检查用户在使用命令时是否标记了另一个用户,如果没有,给他们一条错误消息

这是我的代码:

#PyBot by RYAN#2302

import discord
from discord.ext import commands
from discord.ext.commands import Bot
import asyncio
import chalk

bot = commands.Bot(command_prefix='!')

@bot.event
async def on_ready():
    print ("Ready when you are xd")
    print ("I am running on " + bot.user.name)
    print ("With the ID: " + bot.user.id)

@bot.command(pass_context=True)
async def ping(ctx):
    await bot.say(":ping_pong: Ping! :ping_pong:")
    print ("!ping")

@bot.command(pass_context=True)
async def info(ctx, user: discord.Member):
    await bot.say("The users name is: {}".format(user.name))
    await bot.say("The …
Run Code Online (Sandbox Code Playgroud)

python discord discord.py

5
推荐指数
0
解决办法
7680
查看次数

制表符 fitData 布局不调整表格宽度

我正在尝试将 Tabulator v4.6.3 与fitData布局一起使用。这是我的代码:

var table = new Tabulator("#cowTable", {
        data: cowTableData,
        layout: "fitData",
        history: true,
        columns: [
            { title: "Cow ID", field: "cowId", editor: "number", editorParams: { step: 1 } },
            { title: "Enter", field: "enter", editor: "number", editorParams: { step: 100 } },
            { title: "Exit", field: "exit", editor: "number", editorParams: { step: 100 } },
            { title: "Strip Status", field: "strip", editor: "select", editorParams: { "active": "Active", "inactive": "Inactive", "absent": "Absent" } },
            { title: …
Run Code Online (Sandbox Code Playgroud)

html javascript tabulator

5
推荐指数
1
解决办法
1652
查看次数

标签 统计

discord ×1

discord.py ×1

html ×1

javascript ×1

python ×1

tabulator ×1