
[英]How would I code my Discord.py bot to see if someone replies to a user(me)?
[英]Can someone tell me, why this code works on my PC but dont on my Raspberry Pi? (discord.py 2.0)
所以我的脚本中有这段代码,它用于显示服务器上当前正在玩该游戏的用户数量。 我已经检查了版本等。我的 PC 和我的 Raspberry PI 有 python 3.10.5 和 discord.py 2.0.1
编码:
if before.activity:
bfactivity_str = str(before.activity.name)
bfactivity_lw = bfactivity_str.lower()
if bfactivity_lw == "rainbow six siege":
# Stats for Rainbow
gamers = []
game = "rainbow six siege"
guild = bot.get_guild(771495836701425725)
for member in guild.members:
for act in member.activities:
if act.type is discord.ActivityType.playing and act.name.lower() == game:
gamers.append(f"{member.id}")
stats_channel = await bot.fetch_channel(971830717292101722)
new_count = len(gamers)
# Setting new stats
await stats_channel.edit(name=f"\U0001F4CA Currently Playing: {new_count}")
if after.activity:
afactivity_str = str(after.activity.name)
afactivity_lw = afactivity_str.lower()
if afactivity_lw == "rainbow six siege":
# Stats for Rainbow
gamers = []
game = "rainbow six siege"
guild = bot.get_guild(771495836701425725)
for member in guild.members:
for act in member.activities:
if act.type is discord.ActivityType.playing and act.name.lower() == game:
gamers.append(f"{member.id}")
stats_channel = await bot.fetch_channel(971830717292101722)
new_count = len(gamers)
# Setting new stats
await stats_channel.edit(name=f"\U0001F4CA Currently Playing: {new_count}")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.