python - IRC Bot anti swear -
i'm working on irc bot , i'm trying create anti-swear plugin easier.
it's working this:
if text.find('swearword') != -1: message('please not utilize word')
but want create instead of having create new if each swear word, figured easier if this: if text.find(isinarray)
. if it's in array (where set swear words) display message.
here simple code might help you
badwords = ["love", "peace", "hello"] message = "hi love you" badword in badwords: if (badword in message.lower()): print "oh thats bad /ban"
but recommmend create function that
this detection scheme simple , improved of course
python bots
No comments:
Post a Comment