def _karma(bot, event, *args): username = '******'.join(args) username = username.replace('@', '') add = username.count("+") sub = username.count("-") if add > 6: add = 6 if sub > 6: sub = 6 username = username.replace("+", "") username = username.replace("-", "") username = username.lower() for u in sorted(event.conv.users, key=lambda x: x.full_name.split()[-1]): if username not in u.full_name.lower(): continue if u.id_ == event.user.id_: bot.send_message(event.conv, "Your Karma changes with actions upon others, not actions upon oneself.") return new_karma = None if add >= 2 and sub == 0: new_karma = UtilBot.change_karma(u.id_[0], add - 1) elif sub >= 2 and add == 0: new_karma = UtilBot.change_karma(u.id_[0], (sub - 1) * -1) if new_karma is not None: bot.send_message(event.conv, "{}'s karma is now {}".format(u.full_name, new_karma)) return yield from bot._client.settyping(event.conv_id, schemas.TypingStatus.STOPPED)