|
@@ -0,0 +1,40 @@
|
|
|
+package MumbleBot::Event::Handler::MuteAndDeafenOnConnect;
|
|
|
+
|
|
|
+use Modern::Perl;
|
|
|
+
|
|
|
+use Moo;
|
|
|
+
|
|
|
+use MumbleBot::Event::Priority;
|
|
|
+
|
|
|
+with 'MumbleBot::Event::Handler';
|
|
|
+
|
|
|
+around BUILDARGS => sub {
|
|
|
+ my ($orig, $class, %args) = @_;
|
|
|
+
|
|
|
+ $args{event_type} = 'ServerSyncEvent';
|
|
|
+ $args{priority} = MumbleBot::Event::Priority::LOW;
|
|
|
+
|
|
|
+ return $class->$orig(%args);
|
|
|
+};
|
|
|
+
|
|
|
+sub on_event {
|
|
|
+ my ($self, $event) = @_;
|
|
|
+
|
|
|
+ my $bot = MumbleBot->instance;
|
|
|
+
|
|
|
+ my $user = $bot->state->bot_user;
|
|
|
+ $user->is_deaf(1);
|
|
|
+ $user->is_mute(1);
|
|
|
+
|
|
|
+ $bot->client->send(
|
|
|
+ MumbleBot::Client::Packet->new(
|
|
|
+ type => MumbleBot::Client::Packet::Type::USER_STATE,
|
|
|
+ payload => {
|
|
|
+ self_mute => 1,
|
|
|
+ self_deaf => 1,
|
|
|
+ },
|
|
|
+ )
|
|
|
+ );
|
|
|
+}
|
|
|
+
|
|
|
+1;
|