Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Castaway/update docs for bot #29

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,46 @@
*.05.2022:

Telegram bot:

* added commands for listing/creating inductions
* added commands for balance / paying for snacks etc

TODO:
* Make /inductions <no args> list own inductions
* Use https://core.telegram.org/bots/api#forcereply to prompt for missing args (especially useful if command run from botfather prompt list)
* Add "inductors <tool>" (summary if no arg?)
* Make everything cope somehow with no args?


24.03.2022:

Sendinblue / accesssystem:

* Make sendinblue newsletter signup form? - https://help.sendinblue.com/hc/en-us/articles/360019485320
* Import/link back to accesssystem!? (aka upgrade from subscriber to member)
* Export members from accessystem to sendinblue, when make changes, pay, sign up etc!

* subscribe/ unsubscribe using topics (aka not from entire thing):
** unsub page (links to sub page)
https://help.sendinblue.com/hc/en-us/articles/208772629

* create one contact list per "topic"

* ALL members (past/present/paying or not) now in "All People"
** to make sub lists https://help.sendinblue.com/hc/en-us/articles/208771609

04.09.2021:

Rob McK + yearly payments

1) patch that checks if balance >= year (dues+12+0.1), if so set payment amount to that, and expiry date to one year's time
2) create transaction/payment as before but with diff amount/time

recalculate (after change to transactions+payments):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should public docs contain anything about people's money?

Rob paid 270 (year) in Dec 2019, so should have gotten date of Dec 2020, then another year in May 2020 (in 2 sep payments, accidentally)

Adjusted to end Jan 2022


13.07.2018:

Expand Down
43 changes: 39 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ Technologies

* Barclayscrape - Pull current transactions from a Barclays bank account

* Telegram::Bot::Brain - A Mojo based module to create a Telegram bot.

INSTALL
-------

Expand All @@ -52,26 +54,59 @@ INSTALL

* Checkout this git repo, cd into the repo directory.

* Install dependencies for this system: carton install --cached
* Install dependencies for this system: carton install --deployment

CONFIGURATION
-------------

Create a file *accesssystem_api.conf*, using *accesssystem_api.conf.example* as a template. This is an Apache style config file.

Main things to add/edit:

* dsn, user, password - Database connection string, see (https://metacpan.org/pod/DBI)[DBI docs] for details.
* cc - for emails, add yours here for testing emails (else they are CC'd to [email protected])
* namespace - if running this not in a / path, add the proxied path here
* OneAll - logins for the /profile etc pages, details from your oneall account

RUN
---

This respository contains two pieces of software, the first is a thin layer over (https://metacpan.org/pod/RapidApp)[RadpiApp]. To run this, use the script:
This respository contains two main pieces of software, the first is a thin layer over (https://metacpan.org/pod/RapidApp)[RadpiApp]. To run this, use the script:

carton exec perl script/accesssystem_server.pl --port 3001
CATALYST_HOME=$PWD carton exec perl script/accesssystem_server.pl --port 3001

Which will start a service on http://localhost:3001/admin

To run the API, use the script:

carton exec perl script/accesssystem_api_server.pl --port 3000
CATALYST_HOME=$PWD carton exec perl script/accesssystem_api_server.pl --port 3000

Which will start a service on http://localhost:3000/

NB: There is no index page on the API server, see below for details

Telegram bot
------------

To run the telegram bot, you will need to contact @BotFather on telegram and setup your own test bot, it will give you an API key.

The bot does not require Catalyst or RapidApp, it does require two config files:

* accesssystem_api.conf - the Model::AccessDB section
* keys.conf - create a keys.conf with the following:

<Telegram::Bot>
api <yourbotapikey>
</Telegram::Bot>

Currently the bot requires a patch/branch of the Telegram::Bot::Brain code, checkout (or clone and checkout) the following repository/branch:

git clone [email protected]:castaway/Telegram-Bot.git
cd Telegram-Bot
git checkout castaway/implement_callback_queries

To run: BOT_HOME=$PWD carton exec perl -I <path to checkout>/lib script/access_telegram.pl

API/UI
------

Expand Down
16 changes: 16 additions & 0 deletions accesssystem_api.conf.example
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
<Model::AccessDB>
<connect_info>
dsn dbi:SQLite:db/test.db
# dsn dbi:Pg:database=mydb;host=localhost;port=1234
# user XXX
# password YYY
</connect_info>
</Model::AccessDB>
<HTML::FormHandlerX::Field::noCAPTCHA>
site_key 6LdHZx0TAAAAAMuUdG-NScgCCbJ_HMyL1bdeM9vp
secret_key 6LdHZx0TAAAAAEAnQyttqqhDkEVXfUcsnDLPGmvi
</HTML::FormHandlerX::Field::noCAPTCHA>
<emails>
cc [email protected]
</emails>
<Controller::Root>
namespace accesssystem
</Controller::Root>
<OneAll>
subdomain <yourdomain>
domain <yourdomain>.api.oneall.com
public_key <yourpubkey>
private_key <yourpriavtekey>
callback_url <yourdomain>/accesssystem/oneall_login_callback
</OneAll>