nostr events added

This commit is contained in:
HolgerHatGarKeineNode
2023-02-24 10:35:07 +01:00
parent 1aaa955567
commit 38a2b63e3f
11 changed files with 167 additions and 212 deletions

View File

@@ -3,12 +3,13 @@
namespace App\Observers;
use App\Models\Meetup;
use App\Traits\TwitterTrait;
use App\Traits\NostrTrait;
use Exception;
use Illuminate\Support\Facades\Log;
class MeetupObserver
{
use TwitterTrait;
use NostrTrait;
/**
* Handle the Meetup "created" event.
@@ -16,22 +17,16 @@ class MeetupObserver
public function created(Meetup $meetup): void
{
try {
if (config('feeds.services.twitterAccountId')) {
$this->setNewAccessToken(1);
$meetupName = $meetup->name;
if ($meetup->twitter_username) {
$meetupName .= ' @'.$meetup->twitter_username;
}
$text = sprintf("Eine neue Meetup Gruppe wurde hinzugefügt:\n\n%s\n\n%s\n\n#Bitcoin #Meetup #Einundzwanzig #gesundesgeld",
$meetupName,
url()->route('meetup.landing', ['country' => $meetup->city->country->code, 'meetup' => $meetup])
);
$this->postTweet($text);
$meetupName = $meetup->name;
if ($meetup->nostr) {
$meetupName .= ' @'.$meetup->nostr;
}
} catch (\Exception $e) {
$text = sprintf("Eine neue Meetup Gruppe wurde hinzugefügt:\n\n%s\n\n%s\n\n#Bitcoin #Meetup #Einundzwanzig #gesundesgeld",
$meetupName,
url()->route('meetup.landing', ['country' => $meetup->city->country->code, 'meetup' => $meetup])
);
$this->publishOnNostr($meetup, $text);
} catch (Exception $e) {
Log::error($e->getMessage());
}
}