oscarmlage / bofhers Goto Github PK
View Code? Open in Web Editor NEW#BOFHers project
#BOFHers project
https://github.com/oscarmlage/bofhers/blob/master/app/Http/Controllers/TelegramController.php handles incoming text by creating a switch with the received text:
bofhers/app/Http/Controllers/TelegramController.php
Lines 74 to 79 in fa16b54
The !addquote
event entry within the switch is handled like this:
bofhers/app/Http/Controllers/TelegramController.php
Lines 98 to 112 in fa16b54
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.
This works:
/help addquote
This doesn't:
/help /addquote
The second not working is confusing and it should.
So I can fix some typos 🦈🦈🦈
COVAD! cada día te quiero más
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)
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.
Don't need the message itself, for stat purposes it should work with just a counter
Think about a limit or something for people asking for many commands in the same minute.
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.
And delete the routes (not even with TELEGRAM_WEBHOOK_KEY in URL)
Add a command that shows some help to the users: !help
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.
Send the hourly quote only to "BOFHers" channel.
Add "congratulation" quotes to be used in birthday of the users (take in account a wildcard for Valkrieg).
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.
Use !addquote @gif word
to get the first result from @gif and return it as quote.
When the scheduled run for a random quote sends a text it is not doing neither of:
Right now testing changes for the app is quite painful because:
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.
tu ya sas cual es
Add quotes related commands:
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.).
... and maybe install arch-testing?
Every time user @alexandernst says something with specific terminations (previously analyzed) trigger proteo_plancha_amif.png
sticker.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.