I made a pls search (command from dank memer) command, but it only responds when I type in the exact word as the key in my dictionary search_list
. I'm trying to make it so that the argument I enter is case insensitive, for example after I type pls search
, it should respond to Park
or park
or PARK
(This is typed during the wait_for()
function).
My code:
@client.command()
@commands.cooldown(1, 7, commands.BucketType.user)
async def search(ctx):
amount_of_coins_found = random.randrange(3000)
search_list = {
"Sewer": f'You searched the sewer and found {amount_of_coins_found} coins!',
'Area51': f'You raided Area51 and found {amount_of_coins_found} coins! NOW RUN THE GOVERNMENT IS CHASING YOU!',
'Tree': f'You climbed the tree and found {amount_of_coins_found} coins! Good thing you didn\'t fall off and break your neck.',
'Dog': f'You pet the dog and found {amount_of_coins_found} coins! That poor poor dog... Doge also got mad at you and slapped you! You died!',
'Street': f'You searched the street and found {amount_of_coins_found} coins! Good thing you didn\'t get run over by a bus!',
'Hospital': f'You searched the hospital and found {amount_of_coins_found} coins! Did you steal from a sick person?!',
'Dumpster': f'You climbed inside the dumpster and found {amount_of_coins_found} coins! Good thing the garbage truck only comes on Thursdays.',
'Air': f'You searched the air and found {amount_of_coins_found} coins!',
'Attic': f'You searched the attic and found {amount_of_coins_found} coins!',
'Bank': f'You searched the bank and found {amount_of_coins_found} coins! WTF did you just rob that bank?!',
'Bed': f'You searched your bed and found {amount_of_coins_found} coins! I wonder how that got there...',
'Bus': f'You looked under the bus seat and found {amount_of_coins_found} coins! You also found a peice of gum.',
'Bushes': f'You looked in the bushes and found {amount_of_coins_found} coins! Good thing you didn\'t get pricked, you lucky prick!',
'Uber': f'You searched the Uber and found {amount_of_coins_found} coins! Did you just steal from your uber driver?',
'Car': f'You searched the car and found {amount_of_coins_found} coins!',
'Coat': f'You searched your coat and found {amount_of_coins_found} coins! I wonder how long that has been there...',
'Couch': f'You couchsurfed and found {amount_of_coins_found} coins! You also found your TV remote from 10 years ago.',
'Discord': f'You sifted through your dms and found {amount_of_coins_found} coins!',
'Dresser': f'While looking for your pants, you found {amount_of_coins_found} coins!',
'Laundromat': f'You searched the laundromat and found {amount_of_coins_found} coins!',
'Mailbox': f'You searched your mailbox and found {amount_of_coins_found} coins plus a love letter from a creepy stalker.',
'Pocket': f'You reached into your pocket and found {amount_of_coins_found} coins!',
'Purse': f'You looked in an old lady\'s purse and found {amount_of_coins_found} coins!',
'Grass': f'You searched the grass and found {amount_of_coins_found} coins!',
'Pantry': f'While looking for the cookies, you found {amount_of_coins_found} coins!',
'Shoe': f'You took off your shoe and found {amount_of_coins_found} coins!',
'Sink': f'You searched in the sink and found {amount_of_coins_found} coins!'
}
a = random.choice(list(search_list.keys()))
b = random.choice(list(search_list.keys()))
c = random.choice(list(search_list.keys()))
if a == b or a == c or b == c:
a = random.choice(list(search_list.keys()))
b = random.choice(list(search_list.keys()))
c = random.choice(list(search_list.keys()))
message = await ctx.send(f"<@{ctx.author.id}> Where do you want to search?\n Pick from the list below and type it in the chat:\n`{a}`, `{b}`, `{c}`")
message = await client.wait_for('message', timeout=10, check=lambda message: message.author == ctx.author)
await open_account(ctx.author)
if message.content.startswith(a):
await message.channel.send(str(search_list.get(a)))
await update_bank(ctx.author, amount_of_coins_found)
if message.content.startswith(b):
await message.channel.send(str(search_list.get(b)))
await update_bank(ctx.author, amount_of_coins_found)
if message.content.startswith(c):
await message.channel.send(str(search_list.get(c)))
await update_bank(ctx.author, amount_of_coins_found)
if message.content != a or b or c:
await ctx.send(f"<@{ctx.author.id}> That's not a valid option lmao.")