1
0
mirror of https://github.com/danog/magnaluna.git synced 2024-11-30 04:19:16 +01:00

Add skip command

This commit is contained in:
Daniil Gentili 2023-08-29 19:51:58 +02:00
parent 613d1949fe
commit ccb9fda5e1
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7

View File

@ -104,7 +104,7 @@ class MyEventHandler extends SimpleEventHandler
{
$this->restart();
}
#[FilterCommand('broadcast')]
public function broadcastCommand(Message & FromAdmin $message): void
{
@ -121,6 +121,33 @@ class MyEventHandler extends SimpleEventHandler
);
}
#[FilterCommand('bforward')]
public function broadcastForwardCommand(Message & FromAdmin $message): void
{
// We can broadcast messages to all users with /broadcast
if (!$message->replyToMsgId) {
$message->reply("You should reply to the message you want to broadcast.");
return;
}
$this->broadcastForwardMessages(
from_peer: $message->senderId,
message_ids: [$message->replyToMsgId],
drop_author: false,
pin: true,
);
}
#[FilterCommand('skip')]
public function skipCommand(Incoming&Message $message): void
{
$call = $this->getCallByPeer($message->chatId);
if (!$call) {
$message->reply("You're not currently in a call with me!");
return;
}
$call->skip();
}
public function getMe(): string
{
return $this->me;
@ -153,11 +180,7 @@ class MyEventHandler extends SimpleEventHandler
private function configureCall(VoIP $call): void
{
$songs = $this->songs;
$songs_length = count($songs);
for ($x = 0; $x < $songs_length; $x++) {
shuffle($songs);
}
shuffle($songs);
$call->playOnHold(...$songs);
}