Does telethon telegram client has any command handler? - command

Does the telethon library supports any command handler such that I can build a telegram bot, and when someone types, lets say "/add 123" (both handling command and taking in argument), it would reply by 123?
I know there're many other libraries that are able to do it, for example pyrogram, telegram.ext. However, I'm already using a very specific functions within telethon, so I would like to add these new features to my bot with only telethon

Related

How can I get message/reaction logs from Discord as triggers to a swift program?

I'm currently looking to automate counting in Discord in Swift using keystrokes. The bot that registers the counting, however, has a small chance to not validate a number. To get around this, I am trying to use the check reaction, the validation from the bot, as a trigger to type the next number. Is there a way I can fetch the "reaction data" from discord to do so? Thanks!

Design Commands And Events while Handling External partner with Axon 4

This is a question related to designing command handling with Axon 4.
Let say I've a domain that model the concept of a Payment.
The actual payment will be done by an external Partner. I want to track it in my system via the following events: a Payment Request Was Issued followed by either
Partner Agreed the Payment or Partner Declined the Payment.
Every events issued by the command should be enrolled in the same database transaction.
What would be the best practice to actually call my partner in Axon 4 ?
Here's what I've done so far:
Have one command named RequestPaymentCommand
This command will be handled by a Payment Aggregate like this:
do some checks
apply the event PaymentRequestWasIssued
and then, call the external partner and given the result it will apply either PaymentAccepted or PaymentRefused
In this answer from stackoverflow, it is said that
All the data that you need to apply the event should normally be available in the command
With this statement in mind, I understand that I should create as much Commands as Events ? But In this case, what is the point of all theses commands ? Should I end up with something like:
My command RequestPaymentCommand will generate the PaymentRequestWasIssued event.
Then from somewhere I call my partner and then send another command (how to name it ?) that will generate the event given the result from the partner ?
The actual payment will be done by an external Partner
This means that your application is not the source of truth and it should not try to behave like one. This means that it should only observe what is happening in the remote system and possible react to remote events. To "observe" could mean to duplicate/copy the remote events in local databases, without modifications, just for cache reasons or for display reasons. Your system should not directly give other interpretations to these events, other than those given by their source.
After the remote events are copied locally, your system could react to them. This could mean that a Saga, after receives the Partner Agreed the Payment it sends a UnlockFeature command to a local Aggregate (see DDD).
With this statement in mind, I understand that I should create as much Commands as Events ? But In this case, what is the point of all theses commands ?
This is an indication that those are not your events: you should not emit them from your code; in the worst case you store them and react to them (in a Saga/Process manager). This means that you should discover the local business processes and model them as such: they react to events by sending commands.

stmp and imap send and fetch

I'd like to make a simple program to send and fetch emails from selected email. Is there any simple methods of doing that? I searched, and found a couple of examples like https://developer.ibm.com/swift/2017/05/31/4675/ , but is there any way to simplify that? (to simplify code to up couple of functions or use only basics of that? Instead of loading frameworks, or loading only needed elements?) It's for Mac OS X prog.
Main question is is it possible to simplify this process and how to fetch email (one or more) from server back to app or something similar.
Is there any MessageUI equivalent for mac os?

Print service with user payment

Working at a company, I've been set to develop a print service solution which will be used from multiple platforms. The service should be available at least from Windows (native print dialog), OSX, IOS and Android. I need to be able to see which user is printing, how many pages etc.
I'm looking for a system like CUPS for Windows or Linux, which allows me add/connect to this payment system. The payment system confirms the user have enough points to be able to print the given document. The system should be as transparent as possible for the user and he/she should be able to print like a normal network printer.
The payment system is an existing product, so my system should only handle printing and user authentication.
My first thought was to develop a simple listener that would be running on the server and the clients could connect to, add files to the print queue and print if they had enough points. How ever I could not find any tutorial or similar projects for this approach. Therefore I'm looking into adjusting an already existing product for my needs.
I have made a drawing of how I think the system should look like
I found a solution using CUPS with Tea4Cups. Tea4Cups provides pre/post-hooks where the user can define some scripts/commands to run before and after the document is sent to the printer.
More information about this here:
https://serverfault.com/questions/208268/run-command-before-and-after-printing-with-cups
Run a script when user press print, and not start spooling before script ends (linux, cups)

I'm trying to program a unique app, and use voice command to trigger specific functions within the app

If anyone can help me with this, I'd be eternally in their debt.
Without getting bogged down in details, I'm trying to program an app so
that, for instance, while the application is currently launched, if I say the words,
"activate function A", a specific function which already exists in my app, is activated.
Have I explained myself clearly? In other words, on the screen of the phone is a button
which says "function A". When the software is "armed" and in listening mode, I want
the user to have the ability to simply say the words "activate function A",
(or any other phrase of my choice) and the screen option will be selected without requiring
the user to press the button with their hand, but rather, the option is selected/activated
via voice command.
My programmers and I have faced difficulties incorporating this new voice command capability,
even though it is obviously possible to do google searches with voice command, for instance.
Other voice command apps are currently in circulation, such as SMS dictation apps,
email writing apps, etc, so it is clearly possible to create voice command apps.
Does anyone know if this is possible, and if so, do you have advice on how to implement
this function?
QUESTION 2
Assuming that we are unable to activate function A via voice command, is it possible
to use voice command to cause the phone to place a call, and this call is received
by our server? The server then 'pings' the iPhone and instructs it to activate function A?
For this workaround to work, I would need the ability to determine the exact phrase.
In other words, the user can't be forced to use the word "call function A". I need the
ability to select the phrase which launches the function.
Hopefully I've been clear.
In other words, as a potential workaround to the obstacles we've been facing regarding
using voice command to activate a specific function within our app, is it possible
to harness the voice command capability already present in the phone? aka, to place
a phone call? And then this call is received by our server, and the server
accordingly pings the phone which placed the call, and instructs it to activate the function?
I obviously understand the necessity for the app to be currently launched, before it
would be possible for my application to receive the instruction from the server.
If someone can help me to solve this vexing problem, it is not hyperbole to say that
you would change my life!
Thanks so much in advance for any help one of you kind souls can provide!!!
Michael
I don't believe the iPhone comes with any built in speech recognition functions. Consider speaking to Nuance about buying and embedding one of their speech recognition engines. They have DragonDictate for iPhone, but they also provide a fair amount of other recognition engines that serve different functions. Embedded solutions is clearly one of their areas of expertise.
Your other path of pushing the audio to your server may be more involved than you expect. Typically this process involves end-pointing (when is speech present) and identification of basic characteristics so the raw stream doesn't need to be passed. Again, investigation into the speech recognition engine you intend to use may provide you with the data processing details you need. Passing continuous, raw voice from all phones to your servers is probably not going to be practical.