I would like to clean my code from excessive if/else and translate to match/case. However, I am unable to access the value by key. I get the error called match pattern must be a type
.
My code:
match message.channel.id: #int type 123123
case channels.get("EventID") | channels.get("AnnouncmentsID"): #list of values int types {"EventID" : 123213} | {"PetsID : 234234}
#some code
case channels.get("DeathID"): #value int type {"DeathID" :123123}
if message.attachments:
#some code
###Same cases
case _:
pass
I tried explicitly changing int/string types, use the dict[key] and dict.get('key') keys directly. Nothing comes out.