我想添加一种方法,以便您无法使用 echo 命令 ping 角色。我能想到的唯一方法是检查“内容”是否以 @ 开头,然后它只会回复一条消息说不,我该怎么做?
@client.command()
async def echo(ctx, *, content:str):
await ctx.send(content)
print("Echo command works")
答案 0 :(得分:1)
我们可以通过 allowed_mentions 控制发送的消息中的 ping,
allowed_mentions = discord.AllowedMentions(everyone=False)
await ctx.send(content, allowed_mentions=allowed_mentions)
这样会成功发送回声,即使有一个everyone ping,但不会ping到everyone。如果您想回复说 No
的用户,我们必须检查提及并回复。
mentions = ctx.message.role_mentions
if any([mention.is_default() for mention in mentions]): # there is an everyone mention
return await ctx.send('No')
else:
# do stuff
答案 1 :(得分:0)
您可以像这样使用 my_time_series <- data.frame(
year = c("2010", "2011", "2012", "2013", "2014", "2015", "2016", "2017", "2018"),
country1 = c(255, NA, NA, NA, 300, NA, 325, NA, NA),
country2 = c(3667, NA, NA, NA, NA, NA, NA, 4562, NA),
country3 = c(NA, NA, 791, NA, NA, NA, NA, NA, NA),
rate1 = c(0.0173, 0.1040, 0.1540, 0.1320, 0.1410, 0.1360, 0.1500, 0.0910, 0.7555),
rate2 = c(0.0163, 0.0981, 0.1452, 0.1245, 0.1273, 0.1330, 0.1282, 0.1415, 0.0858),
rate3 = c(0.0180, 0.1082, 0.1602, 0.1373, 0.1404, 0.1466, 0.1414, 0.1560, 0.0946)
)
:
character in string