Giter Site home page Giter Site logo

mortdegana_bot's People

Contributors

bcedu avatar davidmunoznovoa avatar destanyol avatar francescpuig7 avatar gdalmau avatar ytturi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mortdegana_bot's Issues

Allow opt-in for storing data

Following #39 ,
The bot will collect user data (username and group_id), when the database is used.
This should be easily accesible by any user using the bot (i.e. /help) and have an opt-in capability instead of working by default when the database is set on bot-level.

The way to do this would be to have an "allowed groups" table in the database and an /opt-in command (or similar).
When the bot enters the group, send a message informing of its usage.

  • Allowed groups table
  • opt-in command
  • opt-out command (and/or detect when the bot leaves the group)
  • markdown file with data usage expalanation
  • help command explaining general usage as well as data usage link

Add types + typing tests

Add types to all signatures.

Also add a typing test using mypy in our travis CI.
Only running mypy bot.py should be good enough

Add gif variants

Currently we use keywords to search for gifs in giphy (see https://github.com/ytturi/MortDeGana_Bot/blob/master/meldebot/mel/gif.py#L24)

Add other options to get gifs from, like Tenor Gifs or Gfycat. Other providers are also welcomed, however we may need a token to retrieve the gifs using the API, so please share the documentation on how to do so.

The idea is to add new methods in the same file to get the gif from those pages. The signature should be:

get_gif_url_giphy(keywords: List[str]) -> str
get_gif_url_tenor(keywords: List[str]) -> str
get_gif_url_gfycat(keywords: List[str]) -> str

Finally, update the current method (get_gif_url) to randomly use the provider-specific methods.

Move excuses to their own file

We have a list of excuses in meldebot/mel/poll.py as MOTO_QUOTE.

We'd like to move them to their own file: excuses.py, that will act just like insults.py.

Fix excuses

There's something wrong with the excuses as sometimes two of them are prompted into one:

Justament aquest dia he quedat per jugar a arrancar cebesM'he endescuidat de regar el cactus de gisce

Ensure formatting in CI

Add a CI task (.travis.yml) to validate that files are formatted as they should.
An easy way to do this is by running black --check

Add new excuses

Add excuses:

  • Es que he anat a donar sang i no m'arrba a l crevlelsskakaaa
  • Tinc un tema i no puc venir
  • Tinc compromisos amb la parenta
  • Es que he d'afegir excuses al bot
  • Acabo d'enrecordar que vaig al rocodrom, que nomes hi vaig X vegades (com al gimnas)
  • Tinc entrada per anar al cine amb la parenta, que aquesta semana esta barsto

Add new choices for get_moto_quote

Method: https://github.com/ytturi/MortDeGana_Bot/blob/master/meldebot/mel/poll.py#L59

  • Have the moto_quote_set as a global in the file (MOTO_QUOTE)
  • Increase the choices for this method

Additional choices:

Mhe endescuidat de regar el cactus de gisce
Mha semblat veure una gota a la carretera
El metge m'ha dit que no puc menjar aliments rics en sodi
Demà haig d'anar a passar la itv
Tinc el rellotge en format 24h
Volia venir pro no soc 1000itar
Volia venir pro no soc 100tifiko
Esque em guardo dies de vacances
Estic esperant la corda i tamboret que m'he demanat a amazon
No puc venir pk la dona m'ha dit que anes a la platja de palafrugell i em quedés un parell d'hores sota l'aigua 

Make `/spoiler` store the message content into the spoiler table

Requires #54

Right now the /spoiler action only removes the original message.
After we have the table, it should also store the text from the message.
Then reply with the message: f'@{username} that's a spoiler! with a button Show spoiler that will reveal the content.

See the current implementation of /spoiler to know how to handle the pop-up and the button.

Add metrics generator

We need a metrics handler, tbd the final provider, probably to be sent to influxDB.
For now, we want a new file within mel called metrics.py that we will use for all the metrics functionallities.
In this file we will prepare the metrics according to the parameters, some from the context, and some will have defaults.
I am thinking on something like:

generate_metric(data: List[Tuple[str,Union[int,float]]], send_datetime: datetime = datetime.now()) -> str
  • send_datetime is the datetime of the metric to be sent. We will probably use this as the key for some other feature.
  • data contains the actual metric. It could be:
[('count', 1), ('group_id', 123456)]

The expected output will follow the format:

<timestamp> <data>

Where data has the following format:

identifier0=value0,identifier1=value1...

With the previous values:

"12345678 count=1,group_id=123456"

Aside from that we will also need some data in order to store the metrics using the ChatID and the TelegramUser, those are extracted from the Context. We would like both methods in the utils.py

get_telegram_group_id(context: CallbackContext) -> int
get_telegram_user_id(context: CallbackContext) -> int

Spoiler action

Trigger

> /spoiler@meldebot on reply to a message

Actions

  • Remove the messages:
    • Marked message (the spoiler)
    • Trigger message (the /spolier@meldebot)
  • Send a "spoiler" message as:
    "<@author of marked message> that's a spoiler!"
    [Spoiler button that shows the pop-up with the original message]

Example

#0 A> message: Dumbledore dies!
#1 B> reply to #0: "/spoiler@meldebot"
meldebot> remove #0
meldebot> remove #1
#4 meldebot> message: "@A that's a spoiler! [Show spoiler]"
#5 B> click on "Show spoiler" < "Dumbledore dies!"

TODO

Limit users in `motos_ranking`

Currently, when using motos_ranking we query all the rows, however, we only need the first 3 or 5.
We would like to limit the results unless the caller is an admin

Add poll ranking

Our polls have essentially 2 options: A or B. mel or moto.
The polls are message, meaning that they can be identified by:


How do we store it?

I think we can store it as an InfluxDB measurement.
In order to do so, we need:

  • Implement a metrics generator ( #16 )
  • Setup an InfluxDB connector within the bot. ( #18 )
  • Implement the ranking feature using the above features.

Add a new table to store spoiler content

For now, the table would contain:

column name column type
id bigint
group_id bigint
message str

This needs to be added to database.py as well as providing a migration script to create the table in the database.

Add catalan insults

Add catalan insults from this gist. Ideas:

  • User gets a random reply to any message with a random insult We decided not to work on this one as it entangles saving some data (even if it's temporarily)
  • #43
  • Add new /insult command that insults a random user (Ets un XXX)
  • #44

First version requirements

  • README.md updated
  • ADD console command
  • ADD Changes.md
  • ADD Tests (At lease all confs.py methods)
  • Remove "WIP"'s in code

Optionally use different GIF providers

Right now we allow more than one GIF provider (See GIF_PROVIDERS in gif.py).
We would like to setup some security around the code and allow setting up only some (or none) of the providers for the bot to work.
The easier way to implement this would be a get_available_providers method that checks which providers are available based on the configuration values and then creates the available subset of GIF_PROVIDERS

Setup an InfluxDB connector within the bot

We need a connector to an InfluxDB instance for the bot.

In order to do so, we need to:

  • update the configuration parser to retrieve URI and credentials for the connection from a new section.
  • additional step to the initializer to ensure that the database and the measurements exist within the instance.
  • Add send_metric and query_metric methods (generic)

Please check the snippets available at InfluxDB


When this is solved we should be able to:

  • Connect to the InfluxDB instance
  • Send metrics to the InfluxDB instance
  • Query the InfluxDB instance

Add import sorting to `checks.sh`

Add an import sorting call to checks.sh so that the imports are "automatically" sorted.
An option could be to make use of isort.
Whatever you choose, make sure it works with black.

I'd like to get the format:

from X import x
from XY import x, y
from xxxxxxxxxxxxxxxxxxxxxxxxxxx import (
    a,
    b,
    c,
    ...
)

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.