$(function() {
$("#btnSave").click(function() {
html2canvas($("#widget"), {
onrendered: function(canvas) {
theCanvas = canvas;
document.body.appendChild(canvas);
// Convert and download as image
Canvas2Image.saveAsPNG(canvas);
$("#img-out").append(canvas);
// Clean up
//document.body.removeChild(canvas);
}
});
});
});
这是我的代码。我尝试将提到的用户添加为角色“ MMDev”。 这是错误:
import discord
from discord import Embed, Color
def ex(args, message, client, invoke):
if (message.mentions.__len__() > 0):
for member in message.mentions:
server = message.server.name
role = discord.utils.get(server.roles, name="MMDev")
yield from client.add_roles(member, role)
它是Python 3.5
答案 0 :(得分:0)
message.server.name
是服务器的名称,而您需要Server
对象本身。
def ex(args, message, client, invoke):
if (message.mentions.__len__() > 0):
for member in message.mentions:
role = discord.utils.get(message.server.roles, name="MMDev")
if role:
yield from client.add_roles(member, role)