Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

DISCORD_TOKEN=
DISCORD_BOT_TOKEN=
GITHUB_WEBHOOK_SECRET=
GITHUB_API_TOKEN=

Expand Down
2 changes: 1 addition & 1 deletion .env.testing.example
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ AWS_USE_PATH_STYLE_ENDPOINT=false

VITE_APP_NAME="${APP_NAME}"

DISCORD_TOKEN=
DISCORD_BOT_TOKEN=

# API mobile (he4rt-app) — valor fixo, não é segredo de produção.
JWT_SECRET=testing-jwt-secret-do-not-use-in-production
2 changes: 1 addition & 1 deletion app-modules/bot-discord/phpstan.ignore.neon
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ parameters:
message: '#^Parameter \#1 \$roles of method Discord\\Parts\\Guild\\Member\\Member::setRoles\(\) expects#'
identifier: argument.type
count: 1
path: src/Disabled/SlashCommands/CargoDelasCommand.php
path: src/SlashCommands/CargoDelasCommand.php
-
message: '#^Parameter \#1 \$roles of method Discord\\Parts\\Guild\\Member\\Member::setRoles\(\) expects#'
identifier: argument.type
Expand Down
4 changes: 3 additions & 1 deletion app-modules/bot-discord/src/Events/GreetingsEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ class GreetingsEvent extends Event
public function handle(Message $message, Discord $discord): void
{
$mentionsBot = $message->mentions->get('id', $discord->id) !== null;
$mentionsNobody = $message->mentions->count() === 0;
$isAddressedToSomeoneElse = !$mentionsBot && !$mentionsNobody;

if ($message->author->bot || !$mentionsBot) {
if ($message->author->bot || $isAddressedToSomeoneElse) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace He4rt\BotDiscord\Disabled\Events;
namespace He4rt\BotDiscord\Events;

use Discord\Parts\Channel\Message;
Comment thread
gvieira18 marked this conversation as resolved.
Resolved
use Discord\WebSockets\Event as Events;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace He4rt\BotDiscord\Disabled\Events;
namespace He4rt\BotDiscord\Events;

use Discord\Discord;
use Discord\Parts\Guild\Member\Member;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

declare(strict_types=1);

namespace He4rt\BotDiscord\Disabled\SlashCommands;
namespace He4rt\BotDiscord\SlashCommands;

use Discord\Parts\Guild\Member\Member;
use Discord\Parts\Guild\Role\Role;
use Discord\Parts\Interactions\Command\Option;
use Discord\Parts\Interactions\Interaction;
use He4rt\BotDiscord\SlashCommands\AbstractSlashCommand;

class CargoDelasCommand extends AbstractSlashCommand
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ function greetingsMessage(Discord $discord, string $content, array $mentionedIds
GreetingsEvent::make()->handle($message, $this->discord);
});

it('greets a member who mentions nobody', function (): void {
$message = greetingsMessage($this->discord, 'bom dia', []);
$message->shouldReceive('reply')->once()->with('Bom dia!');

GreetingsEvent::make()->handle($message, $this->discord);
});

it('ignores a greeting that does not mention the bot', function (): void {
$message = greetingsMessage($this->discord, sprintf('<@%s> bom dia', GREETINGS_OTHER_BOT_ID), [GREETINGS_OTHER_BOT_ID]);
$message->shouldNotReceive('reply');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
declare(strict_types=1);

return [
'token' => env('DISCORD_TOKEN'),
'token' => env('DISCORD_BOT_TOKEN'),
];
2 changes: 1 addition & 1 deletion app/Console/Commands/FetchDiscordMembers.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function handle(): void
$guildId = config('he4rt.discord.guild_id');

if (!$token) {
$this->error('Discord bot token not configured (HE4RT_DISCORD_BOT_KEY).');
$this->error('Discord bot token not configured (DISCORD_BOT_TOKEN).');

return;
}
Expand Down
20 changes: 10 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"bacon/bacon-qr-code": "^2.0.8",
"calebporzio/sushi": "^2.5.4",
"dedoc/scramble": "^0.13.53",
"filament/filament": "^5.11.1",
"filament/spatie-laravel-media-library-plugin": "^5.11.1",
"filament/filament": "^5.11.2",
"filament/spatie-laravel-media-library-plugin": "^5.11.2",
"guzzlehttp/guzzle": "^7.16.1",
"he4rt/activity": "^1.0.0",
"he4rt/bot-discord": "^1.0.0",
Expand Down Expand Up @@ -44,13 +44,13 @@
"inertiajs/inertia-laravel": "^3.7.0",
"internachi/modular": "^3.0.2",
"laracord/framework": "dev-next#e7b64d6",
"laravel/framework": "^13.40.0",
"laravel/framework": "^13.42.0",
"laravel/head": "^0.2.2",
"laravel/nightwatch": "^1.30.6",
"laravel/reverb": "^1.12",
"laravel/sanctum": "^4.3.3",
"laravel/telescope": "^5.27.0",
"laravel/tinker": "^3.0.2",
"laravel/reverb": "^1.13",
"laravel/sanctum": "^4.4.0",
"laravel/telescope": "^5.28.0",
"laravel/tinker": "^3.1.0",
"league/flysystem-sftp-v3": "^3.36.0",
"livewire/flux": "^2.21.0",
"marvinlabs/laravel-discord-logger": "^1.4.4",
Expand All @@ -73,11 +73,11 @@
"fruitcake/laravel-debugbar": "^4.4.5",
"larastan/larastan": "^3.14.0",
"laravel/boost": "^2.10.4",
"laravel/pail": "^1.2.7",
"laravel/pail": "^1.3.0",
"laravel/pao": "^1.1.5",
"laravel/pint": "^1.32.1",
"laravel/pint": "^1.32.2",
"mockery/mockery": "^1.6.15",
"nunomaduro/collision": "^8.9.5",
"nunomaduro/collision": "^8.9.6",
"pestphp/pest": "^5.3.5",
"pestphp/pest-plugin-faker": "^5.0.0",
"pestphp/pest-plugin-laravel": "^5.0.1",
Expand Down
Loading
Loading