A simple Cards Against Humanity bot
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
652 B

import sys
import cardcast_api
def main():
if len(sys.argv) == 3:
url = sys.argv[1]
code = sys.argv[2]
elif len(sys.argv) == 2:
code = sys.argv[1]
url = None
else:
print(f'Usage {sys.argv[0]} [url] code', file = sys.stderr)
sys.exit(1)
info = cardcast_api.info(code, base_url = url)
print('%s: %s by %s (%s black, %s white)' % (
info['code'],
info['name'],
info['author']['username'],
info['call_count'],
info['response_count']
))
print()
calls, responses = cardcast_api.cards(code, base_url = url)
for i in calls:
print('_'.join(i))
print()
for i in responses:
print(i)
if __name__ == '__main__':
main()