Giter Site home page Giter Site logo

bofhers's People

Contributors

dsmatilla avatar hluaces avatar marcosbl avatar oscarmlage avatar pniaps avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

bofhers's Issues

"0" text triggers an !addquote event

https://github.com/oscarmlage/bofhers/blob/master/app/Http/Controllers/TelegramController.php handles incoming text by creating a switch with the received text:

if (in_array($this->chat_id, $allowed_channels)) {
switch ($this->text) {
case '/menutifu':
$this->sendMessage('Aquí debería ir el menú con los comandos disponibles');
//$this->showMenu();

The !addquote event entry within the switch is handled like this:

// Save new quotes
case ( preg_match( '/!addquote.*/', $this->text ) ? true : false ):
if(trim(ltrim($this->text, '!addquote')) == '') {
$this->sendMessage('❌ Pezqueñines no, gracias... ¡hay que dejarlos crecer! 🤷');
break;
}
$data = [
'chat_id'=>$this->chat_id,
'nick'=>$this->username,
'first_name'=>$this->first_name,
'last_name'=>$this->last_name,
'telegram_user_id'=>$this->telegram_user_id,
'quote'=>trim(ltrim($this->text, '!addquote')),
'active'=>0,
];

As the previous preg_match returns 0 on a non-match, a text 0 would wrongly trigger an !addquote event. Text should be verified as valid before using the regexp.

Covid

COVAD! cada día te quiero más

Edit quote object and command !quote

in the !addquote command, allow something like
!addquote TEXT [tag]

if you send !quote tag, it shows quotes in that quote-tag-list.

This allows things like !quote insult !quote joke !quote rusa, an so on.

With this variaton, you can have some of the others issues solved (like the insult, salutation, ie)

Autovalidate quotes

It's needed a bot admin to validate the quotes. As the groups count grows, it could be overwhelming for the admins.

If there is a flag to mark a group as auto, the quotes will be added as validated.

Limit user requests

Think about a limit or something for people asking for many commands in the same minute.

Refactor !commands to use the Telegram command API

As of now, the bot's is parsing every received text message in order to determine if they are a command or not.

Is this by design? Telegram's commands api allows the bot to receive commands without having to parse any incoming text. It could also allow it to not depend on having to listen too all messages if at some point in the future privacy reasons force us to reevaluate #12

It's also helpful because it provides autocompletion, descriptions and prevents us from having to worry about parsing text, which might up bringing more issues.

I want to add category support for !addquote and !quote and I could benefit from the command API if this is not a design choice.

!quote uses different condicional while rotating quotes

When Tifu says a quote in a channel we pick only active ones and mark the randomly selected one as inactive (TelegramController.php around line 120):

$quote = Quote::where('chat_id', $this->chat_id)->where('active', 1)

but then in the conditional (just to see if all quotes are inactives) we're not filtering for channel:

if(Quote::where('active', 1)->count() == 0)

So if quotes are over in a channel, there is no quote to send and it crashes because $quote->quote does not always exist.

Add congratulations quote

Add "congratulation" quotes to be used in birthday of the users (take in account a wildcard for Valkrieg).

Rotating quotes

tienes un campo "active" 0/1, solo has de crear el estado -1. Cuando lances !quote, pones active=-1 en el quote elegido. Y luego metes un Si el where de active = 1 devuelve 0, pones todos los -1 a 1.

Documentation on how to create a test environment

Right now testing changes for the app is quite painful because:

  • There is no easy way to do it.
  • Even if you deploy local services, there's no documentation on how to set up the application.
  • There's also no documentation on how to set up Telegram's integration.

Ideally it should be as easy as "fill a configuration file" and "click a button" so that making changes is less painful both for new and veteran contributors.

Add quotes to TifuBot

Add quotes related commands:

  • !addquote
  • !quote

Needs a proper db table and, maybe, a command for schedule in Kernel to be able to send a random quote in a random hour from 7am to 2am (i.e.).

Add ruskifilter

Every time user @alexandernst says something with specific terminations (previously analyzed) trigger proteo_plancha_amif.png sticker.

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.