Skip to content

Instantly share code, notes, and snippets.

@tetrapus
Created December 29, 2013 18:15
Show Gist options
  • Save tetrapus/8173064 to your computer and use it in GitHub Desktop.
Save tetrapus/8173064 to your computer and use it in GitHub Desktop.
query = sql.execute("SELECT DISTINCT name, prefix FROM commands ORDER BY name")
commands = {}
for key, value in query.fetchall():
if key in commands:
commands[key] += [value]
else:
commands[key] = [value]
commands = ["".join("\x03%.2d%s" % ([14, 12][i % 2], p) for i, p in enumerate(sorted(v))) + "\x0f" + k for k, v in sorted(commands.items())]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment