Hi, I'm @magicalcrazypony the webradio.
Call me to listen to some awesome music, or send /call to make me call you (don't forget to disable call privacy settings!).
Use /skip to skip the current song.
You can also program a phone call with /program:
/program 29 August 2018 - call me the 29th of august 2018
/program +1 hour 30 minutes - call me in one hour and thirty minutes
/program next Thursday - call me next Thursday at midnight
Send /start to see this message again.
I also provide advanced stats during calls!
I'm a userbot powered by @MadelineProto, created by @danogentili.
Source code: https://github.com/danog/MadelineProto
Propic art by magnaluna on deviantart.
Note for iOS users: the official Telegram iOS app has a bug which prevents me from working properly, I'm looking into it, try calling from your Mac/Android/PC, instead!
I'm very happy to announce the first release of https://github.com/danog/php-tokio: you can now use any async Rust library from PHP!
It's fully integrated with revolt: this allows full compatibility with amphp, PSL and reactphp, and with any Rust library powered by tokio.rs.
Here's an example from the repo, using the async Rust reqwest library to make asynchronous HTTP requests from PHP:
<?phpI'm really excited for the potential usecases of php-tokio, and its implications for the PHP async ecosystem.
use Reqwest\Client;
use function Amp\async;
use function Amp\Future\await;
require 'vendor/autoload.php';
Client::init();
function test(int $delay): void {
$url = "https://httpbin.org/delay/$delay";
$t = time();
echo "Making async reqwest to $url that will return after $delay seconds...".PHP_EOL;
Client::get($url);
$t = time() - $t;
echo "Got response from $url after ~".$t." seconds!".PHP_EOL;
};
$futures = [];
$futures []= async(test(...), 5);
$futures []= async(test(...), 5);
$futures []= async(test(...), 5);
await($futures);
Just download this file on your host and start it: https://github.com/danog/MadelineProto/blob/v8/examples/tgstories_dl_bot.php
Читать полностью…Hi, I'm Magna Luna the webradio, and I'm back with even more funky tunes 🎵🎺🎉
Call me 📞 to hear some awesome tunes! ❤️❤️❤️
I'm powered by the latest version of @MadelineProto, now with free webhost support!
MadelineProto was updated (8.0.0-beta101)!
After introducing plugins », bound methods », filters », a built-in cron system », IPC support for the event handler » and automatic static analysis for event handler code » in beta100, beta101 brings some bugfixes and the getDownloadLink
function!getDownloadLink
can be used to fetch a direct download link for any file up to 4GB, even using a bot API file ID!
Other features:
- Added an openFileAppendOnly
function, that can be used to asynchronously open a file in append-only mode!
Fixes:
- Improved the markdownEscape
function!
- Translated even more MadelineProto UI elements!
- Improve the static analyzer.
- Made some fixes to simple filters.
- Relax markdown parser.
Here's an example on how to use the new getDownloadLink()
function:
<?php
if (!file_exists('madeline.php')) {
copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php');
}
include 'madeline.php';
$MadelineProto = new \danog\MadelineProto\API('session.madeline');
$MadelineProto->start();
$link = $MadelineProto->getDownloadLink($MessageMedia);
$MessageMedia
can be a a media object or even a bot API file ID (files up to 4GB are supported!).getDownloadLink()
bound method:class MyEventHandler extends SimpleEventHandler {In both cases, the download link will be generated automatically if running via web.
/**
* Gets a download link for any file up to 4GB!
*/
#[FilterCommand('dl')]
public function downloadLink(Incoming&Message $message): void
{
if (!$message->replyToMsgId) {
$message->reply("This command must reply to a media message!");
return;
}
$message = $message->getReply();
if (!$message instanceof Message || !$message->media) {
$message->reply("This command must reply to a media message!");
return;
}
$message->reply("Download link: ".$message->media->getDownloadLink());
}
}
Here's a more detailed explanation of the most important new features of MadelineProto 8.0.0-beta100!
- Native plugin system
To create a plugin, simply create an event handler that extends PluginEventHandler.
For example, create a plugins/Danogentili/PingPlugin.php
file:
<?php declare(strict_types=1);And use a plugin base to run all plugins included in the
namespace MadelinePlugin\Danogentili\PingPlugin;
use danog\MadelineProto\PluginEventHandler;
use danog\MadelineProto\EventHandler\Filter\FilterText;
use danog\MadelineProto\EventHandler\Message;
use danog\MadelineProto\EventHandler\SimpleFilter\Incoming;
class PingPlugin extends PluginEventHandler
{
#[FilterCommand('echo')]
public function echoCmd(Incoming & Message $message): void
{
// Contains the arguments of the command
$args = $message->commandArgs;
$message->reply($args[0] ?? '');
}
#[FilterRegex('/.*(mt?proto).*/i')]
public function testRegex(Incoming & Message $message): void
{
$message->reply("Did you mean to write MadelineProto instead of ".$message->matches[1].'?');
}
#[FilterText('ping')]
public function pingCommand(Incoming&Message $message): void
{
$message->reply("Pong");
}
}
plugins
folder. reply()
, delete()
, getReply()
, getHTML()
and simplified properties like chatId
, senderId
, command
, commandArgs
and many more, see the documentation for more info!Cron
attribute are now automatically invoked by MadelineProto every period
seconds: use danog\MadelineProto\EventHandler\Attributes\Cron;See the documentation for more info!
class MyEventHandler extends SimpleEventHandler
{
/**
* This cron function will be executed forever, every 60 seconds.
*/
#[Cron(period: 60.0)]
public function cron1(): void
{
$this->sendMessageToAdmins("The bot is online, current time ".date(DATE_RFC850)."!");
}
}
getEventHandler()
on an API
instance, see the docs for more info!is there a demo for decrypting web push notifications available. I've been researching for a long time, but I haven't figured it ou
Читать полностью…For 10 web push, the token must be a JSON-encoded object with the following keys: endpoint: Absolute URL exposed by the push service where the application server can send push messages
keys: P-256 elliptic curve Diffie-Hellman parameters in the following object
p256dh: Base64url-encoded P-256 elliptic curve Diffie-Hellman public key
auth: Base64url-encoded authentication secret
How do I pass the parameters of this interface when using web push for account.registerDevice? Can anyone help me
I always try to return to WEBPUSH_ KEY_ INVALID
rm: cannot remove '*1.ma*': No such file or directory
PHP Fatal error: Uncaught TypeError: danog\MadelineProto\API::__construct(): Argument #2 ($settings) must be of type ?danog\MadelineProto\SettingsAbstract, array given, called in /home/ubuntu/a/login.php on line 14 and defined in phar:///home/ubuntu/a/madeline-8.0.0-beta136.phar/vendor/danog/madelineproto/src/API.php:201
Stack trace:
#0 /home/ubuntu/a/login.php(14): danog\MadelineProto\API->__construct()
#1 {main}
thrown in phar:///home/ubuntu/a/madeline-8.0.0-beta136.phar/vendor/danog/madelineproto/src/API.php on line 201
Update: fixed a small issue with the quality selections of photos and getDownloadLink with bot api file ids, remove the vendor folder and re-run composer update to get the latest version (beta102)!
Читать полностью…Coming up next, even more abstracted media methods, keyboard builders, a new web UI, MadelineProto in the browser with WASM, a getDownloadLink
method and much more!
Introducing MadelineProto's biggest update yet, 8.0.0-beta100!
This version introduces plugins », bound methods », filters », a built-in cron system », IPC support for the event handler » and automatic static analysis for event handler code ».
See the following post for examples!
Other features:
- Thanks to the many translation contributors @ https://weblate.madelineproto.xyz/, MadelineProto is now localized in Hebrew, Persian, Kurdish, Uzbek, Russian, French and Italian!
- Added simplified sendMessage
, sendDocument
, sendPhoto
methods that return abstract Message objects with simplified properties and bound methods!
- You can now use Tools::callFork
to fork a new green thread!
- You can now automatically pin messages broadcasted using broadcastMessages
, broadcastForwardMessages
by using the new pin: true
parameter!
- You can now use sendMessageToAdmins
to send messages to the bot's admin (the peers returned by getReportPeers
).
- Added wrapUpdate
, wrapMessage
, wrapMedia
methods to wrap low-level MTProto updates into an abstracted Message object with bound methods!
- The waveform
attribute of Voice
objects is now automatically encoded and decoded to an array of 100 integer values!
- Added a custom PeerNotInDbException
class for "This peer is not present in the internal peer database" errors
- Added a label
property to the Button class, directly indicating the button label (instead of manually fetching it as an array key).
- Added isForum
method to check whether a given supergroup is a forum
- Added an entitiesToHtml
method to convert a message and a set of Telegram entities to an HTML string!
- You can now use reportMemoryProfile()
to generate and send a pprof
memory profile to all report peers to debug the causes of high memory usage.
- Added support for pay
, loginurl, webapp
and tg://user?id=
buttons in bot API syntax!
- Added a getAdminIds
function that returns the IDs of the admin of the bot (equal to the peers returned by getReportPeers in the event handler).
- Added a new ParseMode
enum!
- Added support for HTML lists in parseMode!
- Fixed parsing of markdown code blocks!
Breaking changes:
- Switched to a custom markdown parser with bot API MarkdownV2 syntax, which differs from the previous Markdown syntax supported by parsedown.
- Markdown text can't contain HTML anymore.
Fixes:
- Fixed file uploads with ext-uv!
- Fixed file re-uploads!
- Improve background broadcasting with the broadcast API using a pre-defined list of whitelist
IDs!
- Fixed a bug that caused updates to get paused if an exception is thrown during onStart.
- Broadcast IDs are now unique across multiple broadcasts, even if previous broadcasts already completed their ID will never be re-used.
- Now uploadMedia, sendMedia and upload can upload files from string buffers created using ReadableBuffer
.
- Reduced memory usage during flood waits by tweaking config defaults.
- Reduced memory usage by clearing the min database automatically as needed.
- Automatically try caching all dialogs if a peer not found error is about to be thrown.
- Fixed some issues with pure phar installs.
- Fixed splitting of HTML and markdown messages
- Fixed formatting of multiline markdown codeblocks
- And many other performance improvements and bugfixes!