const backwardsFilter = (reaction, user) => reaction.emoji.name === '⏪' && user.id === message.author.id;
const forwardsFilter = (reaction, user) => reaction.emoji.name === '⏩' && user.id === message.author.id;
const backwards = msg.createReactionCollector(backwardsFilter, {time: 90000});
const forwards = msg.createReactionCollector(forwardsFilter, {time: 90000});
我尝试为两个收集器创建一个过滤器,但仍然必须键入此(x,y,z) => filter(x,y,z,'⏪')
const filter = (reaction, user, c, emoji) => reaction.emoji.name === emoji && user.id === message.author.id;
const backwards = msg.createReactionCollector((x,y,z) => filter(x,y,z,'⏪'), {time: 90000});
const forwards = msg.createReactionCollector((x,y,z) => filter(x,y,z,'⏩'), {time: 90000});
答案 0 :(得分:0)
您可以创建一个高阶函数,该函数接受您要查找的字符并返回一个带有三个参数(def accumulate_product(list):
p = 1
index = 0
while index in list:
p *= index
if index == 0:
index += 1
return p
,reaction
,以及与您当前的user
相对应的c
),并返回适当的过滤器操作。
此外,这里的任何代码中似乎都没有使用(x, y, x) =>
(与c
相同),因此请随时将其从参数列表中删除。
z