GithubHelp home page GithubHelp logo

voucherbot's Introduction

voucherbot for discourse

The voucherbot manages the distribution of vouchers via Discourse. It was originally created for distributing the vouchers for the 36C3.

A voucher is usable a single time, but replicates itself. The idea is therefore to pass the generated tokens to your friends.

We, flipdot, receive a list of vouchers. We distribute them via Discourse to our members, who can then pass them to their friends. As soon as all their friends bought their ticket, they should send them back to us, so we can distribute it to another member.

This bot simplifies this process by automating parts of it. A yaml file serves as a database, containing a mapping of vouchers and member accounts. Optionally, you can enter a number of persons, so you are able to estimate how long the voucher will be on it's way.

Features

  • Updates a post in the forum. The post contains a table with the information which member received a vouchers
  • Sends the voucher via forum message to the member
  • Receives a returned voucher and updates the yaml file with the new one
  • Broadcast: Allows to send a message to all current voucher owners

Usage

Python 3.7 required (TODO: require 3.8 to be able to use TypedDict eventually)

Copy example_voucher.yml to voucher.yml. Enter your vouchers and their owners. Make a backup of this file (we do not make one for you and we WILL modify this file. Don't cry if something get's lost).

Open constants.py and change VOUCHER_TABLE_POST_ID. This post will be constantly updated with the table of members who currently own a voucher.

pip install -r requirements.txt
DISCOURSE_API_KEY=deadbeef python src/app.py --dry  # leave out --dry if you are brave

The script will send a message with a voucher to each person who is in voucher.yml. It will save the Discourse topic id in the file as message_id, so it won't send the same message twice.

If a user replies to that message, the script will scan for the string CHAOS[a-zA-Z0-9]+ in their messages. If it finds a new voucher, the old voucher in the yml file get's replaced by the new one and all other fields will be reset.

voucherbot's People

Contributors

soerface avatar dependabot[bot] avatar dargmuesli avatar nikeee avatar

Watchers

James Cloos avatar  avatar Daniel Huhn avatar and… avatar  avatar  avatar Robin avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.