Created
November 4, 2018 00:36
-
-
Save terakilobyte/488f49368aba9c87e64b7ed550b085b3 to your computer and use it in GitHub Desktop.
rough example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
admins_and_mods = ["tremorai", "swarmlogic", "firecopy"] | |
def do_command(message): | |
def command(nick): | |
print(message) | |
return command | |
def do_admin_command(message): | |
def command(nick): | |
if nick in admins_and_mods: | |
print("admin command") | |
else: | |
print(f"{nick} is unauthorized") | |
return command | |
def notfound(message): | |
print('what?') | |
commands = { | |
"github": do_command("github"), | |
"discord": do_command("discord"), | |
"setproject": do_admin_command("setproject") | |
} | |
commands.get('github', notfound)("tremorai") | |
commands.get('foo', notfound)("tremorai") | |
commands.get('discord', notfound)("firecopy") | |
commands.get('setproject', notfound)("foo") | |
commands.get('setproject', notfound)('swarmlogic') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment