Closed SteveChristian70 closed 7 years ago
Solved it by using:
import re
from slackbot.bot import respond_to
from slackbot.bot import listen_to
import random
KEYWORDS = ("what", "hi", "greetings", "sup", "what's up",)
RESPONSES = ["This aggression will not stand, man.", "hey man ", "Mind if I do a J?"]
@respond_to('(.*)', re.IGNORECASE)
def check_for_greeting(message, KEYWORDS):
response = random.choice(RESPONSES)
message.reply(response)```
I have the slackbot up and running and I'm trying to make a plugin that responds to a list of keywords then gives out a random response, but I can't get the reply_to command to recognize the list of keywords as the trigger. I can use one keyword and have it respond with the random RESPONSES, but I would rather not use 11 functions when I could use a list. Anybody have any ideas on what I am doing wrong or how I could get this to work?