<link rel="stylesheet" href="https://cdn.datatables.net/1.10.21/css/jquery.dataTables.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.datatables.net/1.10.21/js/jquery.dataTables.min.js">
</script>
<table id="example" class="display" style="width:100%">
<thead>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Email Address</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr role="row" class="even">
<td class="sorting_1">Someone</td>
<td>Foryou</td>
<td>someadd@gmail.com</td>
<td><button type="button" class="btn btn-info smallPadding edit">Edit</button> <button type="button" class="btn btn-success smallPadding">Export</button> <button type="button" class="btn btn-danger smallPadding">Delete</button>
</td>
</tr>
<tr role="row" class="even">
<td class="sorting_1">Someone</td>
<td>Foryou</td>
<td>someadd@gmail.com</td>
<td><button type="button" class="btn btn-info smallPadding edit">Edit</button> <button type="button" class="btn btn-success smallPadding">Export</button> <button type="button" class="btn btn-danger smallPadding">Delete</button>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Email Address</th>
<th>Actions</th>
</tr>
</tfoot>
</table>
这是我当前用于更改昵称的命令的代码。我的代码一定做错了,因为每次尝试使用它时,它都会在控制台中返回此错误
@client.command()
async def nickmod(ctx, arg,member=discord.Member):
await member.edit(nick=arg)
await ctx.send(f"""{member.mention}'s nicknamed has been modified""")
我希望有人能帮助我,我以前从未遇到过这种错误。
答案 0 :(得分:0)
discord.py converters使用类型提示语法argument: converter
。我会这样写你的命令:
@client.command()
async def nickmod(ctx, member: discord.Member, *, new_name):
await member.edit(nick=new_name)
await ctx.send(f"""{member.mention}'s nicknamed has been modified""")
在这里,我还使用Keyword-Only Arguments语法允许昵称带有空格。