I have created a ban bot for an XMPP server, this is a part of my script:
resources = ['private', 'sergeant', 'staffsergeant']
"""presence detection script here"""
if resource in resources:
pass
else:
print "the jid has been banned"
"""ban script here"""
So the code above bans any user that enters unless their resource is private, sergeant or staffsergeant.
I want to change the above script to not ban any of the above resources if and only if they have an integer after the resource name (for example: sergeant343, private5654, etc.), but to ban them if they come without any integer. So jid/sergeant gets banned but jid/sergeant432 passes. The integer could be any number in range(0, 99999). How can I do this?
The solution looks like this: