Skip to content

Commit

Permalink
chore: add (basic) guild bindings
Browse files Browse the repository at this point in the history
* Add Guild bindings

* Fix namespace & composer issue

* Add guild traits

* Add bindings and tests

* Add get bans & get ban calls

* Add member role management calls

* Add more bindings

* More guild bindings

* Add bindings

* Add binding

* still a lot of bindings to go woo

* Guild bindings almost done :D

* cs & md

* Add last of the guild bindings

* Add missing strict type

---------

Co-authored-by: Exan <[email protected]>
  • Loading branch information
Exanlv and Exan authored Jun 15, 2023
1 parent 4875e62 commit 0c43406
Show file tree
Hide file tree
Showing 22 changed files with 1,431 additions and 2 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
"phpunit": "phpunit",
"phpunit-coverage": "@php -d xdebug.mode=coverage ./vendor/bin/phpunit --coverage-html .phpunit.cache/cov-html",

"test": "@php tests/WebsocketTestServer.php & PID=$!; composer phpunit; kill $PID;",
"test-coverage": "@php tests/WebsocketTestServer.php & PID=$!; composer phpunit-coverage; kill $PID;"
"test": "php tests/WebsocketTestServer.php & PID=$!; composer phpunit; kill $PID;",
"test-coverage": "php tests/WebsocketTestServer.php & PID=$!; composer phpunit-coverage; kill $PID;"
},
"config": {
"allow-plugins": {
Expand Down
11 changes: 11 additions & 0 deletions src/Enums/DefaultMessageNotifications.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

declare(strict_types=1);

namespace Ragnarok\Fenrir\Enums;

enum DefaultMessageNotifications: int
{
case ALL_MESSAGES = 0;
case ONLY_MENTIONS = 1;
}
18 changes: 18 additions & 0 deletions src/Parts/ActiveGuildThreads.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

declare(strict_types=1);

namespace Ragnarok\Fenrir\Parts;

class ActiveGuildThreads
{
/**
* @var \Ragnarok\Fenrir\Parts\Channel[]
*/
public array $threads;

/**
* @var \Ragnarok\Fenrir\Parts\ThreadMember[]
*/
public array $members;
}
11 changes: 11 additions & 0 deletions src/Parts/GuildBan.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

declare(strict_types=1);

namespace Ragnarok\Fenrir\Parts;

class GuildBan
{
public ?string $reason;
public User $user;
}
37 changes: 37 additions & 0 deletions src/Parts/GuildPreview.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

declare(strict_types=1);

namespace Ragnarok\Fenrir\Parts;

use Ragnarok\Fenrir\Enums\Parts\GuildFeatures;

class GuildPreview
{
public string $id;
public string $name;
public ?string $icon;
public ?string $splash;
public ?string $discovery_splash;
public array $emojis;
/**
* @var \Ragnarok\Fenrir\Enums\Parts\GuildFeatures[]
*/
public array $features;
public ?int $approximate_member_count;
public ?int $approximate_presence_count;
public ?string $description;
/**
* @var \Ragnarok\Fenrir\Parts\Sticker[]
*/
public ?array $stickers;

public function setFeatures(array $value): void
{
$this->features = [];

foreach ($value as $entry) {
$this->features[] = GuildFeatures::from($entry);
}
}
}
10 changes: 10 additions & 0 deletions src/Parts/PruneCount.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

declare(strict_types=1);

namespace Ragnarok\Fenrir\Parts;

class PruneCount
{
public ?int $pruned;
}
23 changes: 23 additions & 0 deletions src/Parts/Widget.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

namespace Ragnarok\Fenrir\Parts;

class Widget
{
public string $id;
public string $name;
public ?string $instant_invite;

/**
* @var \Ragnarok\Fenrir\Parts\Channel[]
*/
public array $channels;

/**
* @var \Ragnarok\Fenrir\Parts\User[]
*/
public array $users;
public int $presence_count;
}
11 changes: 11 additions & 0 deletions src/Parts/WidgetSettings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

declare(strict_types=1);

namespace Ragnarok\Fenrir\Parts;

class WidgetSettings
{
public bool $enabled;
public string $channel_id;
}
Loading

0 comments on commit 0c43406

Please sign in to comment.