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:
parent
613d1949fe
commit
ccb9fda5e1
31
magna.php
31
magna.php
@ -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);
|
||||
}
|
||||
|
||||
$call->playOnHold(...$songs);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user