我想在文本文件中创建一个禁止的单词列表。 然后,当键入命令时,检查命令中是否有禁止的单词,然后将其用户名添加到阻止的用户名列表中
到目前为止,我已经创建了一个被禁止的用户列表,它运行得非常好。 然而,当我制作一个阻止词列表并让它检查单词是否被说出时,我遇到了很多问题
到目前为止,我有:
bannedwords = open('bannedwords.txt')
bannedwords = str(bannedwords)
if "a" in chat:
with open('bannedwords.txt') as f:
if bannedwords in chat:
send("abcde","snappingbot")
twitch irc聊天中的单词示例:
@badge info=;徽章=主持人/1,glitchcon2020/1;颜色=008000;显示名称=Turtoise;埃莫特斯=;旗帜=;id=94575409-70ea-4b53-9481-3146fc0bc4e7;mod=1;房间id=191739645;订户=0;tmi发送ts=1608229323648;turbo=0;用户id=805824;用户类型=mod:turtoise!turtoise@turtoise.tmi.twitch.tvPRIVMSG#snappingbot:abc
有效的被阻止用户命令的示例:
if ":+turtfact" in chat:
with open('banlist.txt') as f:
if username in f.read():
send("/w " + username + " you are on the banned list of users for this bot.", "turtoise")
else:
try:
test = (choice(list(open('turtfact.txt'))))
sendcommand("/me " + test, channel)
except:send("error","turtlelurk")
目前没有回答
相关问题 更多 >
编程相关推荐