So I'm working on a personal bot in Python on my Discord server that can do a variety of things, one of which being mimicking the common Dadbot. Here's the code that does that:
if any(word in msg for word in imlist):
resp = message.content.split(" ",1)[1]
await message.channel.send("Hi "+ resp +", I'm Pigeonbot")
if any(word in msg for word in iamlist):
resp = message.content.split(" ",2)[2]
await message.channel.send("Hi "+ resp +", I'm Pigeonbot")
And here are the two lists:
imlist = ["I'm", "Im", "im", "i'm", "IM", "I'M"]
iamlist = ["i am", "I am", "I AM"]
If you type a message in discord like "I'm hungry", it will respond with "Hi hungry, I'm Pigeonbot". However if you say something before the "I'm", such as "It's hot outside, and I'm hungry", it will return "Hi hot outside, and I'm hungry, I'm Pigeonbot". Is there a way to make it so that the bot will find where in the message the imlist or iamlist is and start the "Hi [], I'm Pigeonbot" from there? Thank you :)