Skip to content

Commit

Permalink
Development (#3)
Browse files Browse the repository at this point in the history
* Bugfix

* Php Stan fix
  • Loading branch information
Domenikus authored Jan 14, 2023
1 parent afcfc96 commit 061dc3f
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 124 deletions.
7 changes: 3 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
TEAMSPEAK_IP=127.0.0.1
TEAMSPEAK_PORT=9987
TEAMSPEAK_IP=
TEAMSPEAK_PORT=
TEAMSPEAK_QUERY_USER=
TEAMSPEAK_QUERY_PASSWORD=
TEAMSPEAK_QUERY_PORT=10011
TEAMSPEAK_DEFAULT_CHANNEL=
TEAMSPEAK_PARENT_CHANNEL=
LOG_CHANNEL=stack
LOG_LEVEL=info
LOG_LEVEL=debug
6 changes: 5 additions & 1 deletion app/Providers/ClientServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public function register(): void
$channelAdminGroupId = config('teamspeak.channel_admin_group_id');
$channelNeededJoinPower = config('teamspeak.channel_needed_join_power');
$channelNeededSubscribePower = config('teamspeak.channel_needed_subscribe_power');
$defaultChannel = config('teamspeak.default_channel');
$channelNameLists = config('channel-names.lists');
$channelListName = config('channel-names.default');

Expand All @@ -31,6 +32,7 @@ public function register(): void
(! is_numeric($channelAdminGroupId) && ! is_null($channelAdminGroupId)) ||
(! is_numeric($channelNeededJoinPower) && ! is_null($channelNeededJoinPower)) ||
(! is_numeric($channelNeededSubscribePower) && ! is_null($channelNeededSubscribePower)) ||
(! is_numeric($defaultChannel) && ! is_null($defaultChannel)) ||
(! is_array($channelNameLists)) ||
(! is_string($channelListName)) ||
(empty($channelNameLists[$channelListName]))
Expand All @@ -45,10 +47,12 @@ public function register(): void
/** @var int|null $channelAdminGroupId */
/** @var int|null $channelNeededJoinPower */
/** @var int|null $channelNeededSubscribePower */
/** @var int|null $defaultChannel */
$this->app->bind(ClientServiceInterface::class, function () use (
$defaultChannel,
$channelNeededSubscribePower,
$channelNeededJoinPower, $channelClientLimit, $channelAdminGroupId, $parentChannel, $channelNames) {
return new ClientService((int) $parentChannel, $channelNames, $channelClientLimit, $channelAdminGroupId, $channelNeededJoinPower, $channelNeededSubscribePower);
return new ClientService((int) $parentChannel, $channelNames, $defaultChannel, $channelClientLimit, $channelAdminGroupId, $channelNeededJoinPower, $channelNeededSubscribePower);
});
}
}
8 changes: 6 additions & 2 deletions app/Services/ClientService.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,19 @@ class ClientService implements ClientServiceInterface

protected array $channelNames;

protected ?int $defaultChannel;

protected ?int $channelNeededJoinPower;

protected ?int $channelNeededSubscribePower;

protected int $parentChannel;

public function __construct(int $parentChannel, array $channelNames, ?int $channelClientLimit = null, ?int $channelAdminGroupId = null, ?int $channelNeededJoinPower = null, ?int $channelNeededSubscribePower = null)
public function __construct(int $parentChannel, array $channelNames, ?int $defaultChannel, ?int $channelClientLimit = null, ?int $channelAdminGroupId = null, ?int $channelNeededJoinPower = null, ?int $channelNeededSubscribePower = null)
{
$this->parentChannel = $parentChannel;
$this->channelNames = $channelNames;
$this->defaultChannel = $defaultChannel;
$this->channelClientLimit = $channelClientLimit;
$this->channelAdminGroupId = $channelAdminGroupId;
$this->channelNeededJoinPower = $channelNeededJoinPower;
Expand All @@ -43,7 +46,8 @@ public function handleClientMove(int $clientId, int $targetChannelId): void
}

TeamspeakGateway::moveClient($client->getId(), $newChannelId);
TeamspeakGateway::moveClient(TeamspeakGateway::getOwnClientId(), $this->parentChannel);
$botChannel = $this->defaultChannel ?: $this->parentChannel;
TeamspeakGateway::moveClient(TeamspeakGateway::getOwnClientId(), $botChannel);

if ($this->channelAdminGroupId) {
TeamspeakGateway::assignChannelGroupToClient($client, $newChannelId, $this->channelAdminGroupId);
Expand Down
116 changes: 0 additions & 116 deletions config/database.php

This file was deleted.

1 change: 0 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/bin/sh

php /app/channel-creator-bot migrate --force
php /app/channel-creator-bot run

0 comments on commit 061dc3f

Please sign in to comment.