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
7 changes: 7 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Prevent these directories from being exported in the distribution archive
/docs export-ignore
/tests export-ignore
/.github export-ignore
/phpunit.xml export-ignore
/.gitignore export-ignore
/.gitattributes export-ignore
27 changes: 17 additions & 10 deletions docs/format.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,22 @@ $this->reply(FormatHelper::codeBlock('block code', 'php'));
// Output: <pre><code class="language-php">block code</code></pre>
```

### time(int $unix, string $format = ''): string

Formats a Unix timestamp for display. Supports multiple format options:

- `w`: Day of the week in the user's language
- `d`: Short date format (e.g., "17.03.22")
- `D`: Long date format (e.g., "17 de marzo de 2022")
- `t`: Short time format (e.g., "22:45")
- `T`: Long time format (e.g., "22:45:00")
- `r`: Relative time from current moment

```php
$this->reply(FormatHelper::time(1710691200, 't'));
// Output: <tg-time unix="1710691200" format="t">fecha</tg-time>
```

### blockQuote(string $text): string

Formats the provided text as a blockquote.
Expand All @@ -109,14 +125,5 @@ Formats the provided text as an expandable blockquote.

```php
$this->reply(FormatHelper::expandableBlockQuote('This is an expandable blockquote'));
// Output: <expandable blockquote>This is an expandable blockquote</blockquote>
```

### sanatize(string $text): string

Sanitizes the provided text, escaping HTML special characters.

```php
$this->reply(FormatHelper::sanatize('<script>alert("Hello")</script>'));
// Output: &lt;script&gt;alert(&quot;Hello&quot;)&lt;/script&gt;
// Output: <blockquote expandable>This is an expandable blockquote</blockquote>
```
2 changes: 1 addition & 1 deletion src/Bot.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Bot
{
public const NAME = 'xBot';

public const VERSION = '4.2.0';
public const VERSION = '4.2.1';

public ?Update $update = null;

Expand Down
Loading