Skip to content

Commit

Permalink
Never use empty lines around tips
Browse files Browse the repository at this point in the history
  • Loading branch information
KnorpelSenf committed Jul 8, 2023
1 parent 44f0c66 commit 13525c1
Show file tree
Hide file tree
Showing 38 changed files with 10 additions and 98 deletions.
1 change: 0 additions & 1 deletion site/docs/es/advanced/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ Escribe tests para tu bot. Esto se puede hacer con grammY así
2. Define y envía ejemplos de actualización a tu bot via `bot.handleUpdate` ([referencia API](https://deno.land/x/grammy/mod.ts?s=Bot#method_handleUpdate_0)). Considere inspirarse en [estos ejemplos](https://core.telegram.org/bots/webhooks#testing-your-bot-with-updates) proporcionados por el equipo de Telegram.

::: tip Contribuye al framework de testing.

Aunque grammY proporciona lo necesario para empezar a escribir tests, sería muy útil tener un framework para los bots.
Este es un territorio novedoso, tales frameworks no existen en gran medida.
¡Esperamos tus contribuciones!.
Expand Down
3 changes: 0 additions & 3 deletions site/docs/es/guide/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ Sin embargo, el servidor de la API del bot que se encarga de traducir las petici
Por lo tanto, si evitas el servidor Bot API que Telegram ejecuta por ti, y simplemente [alojas tu propio servidor Bot API](https://core.telegram.org/bots/api#using-a-local-bot-api-server), puedes permitir que tu bot envíe archivos de hasta 2000 MB.

> Nota: si estás trabajando con archivos grandes a través de [long polling](./deployment-types), deberías usar [grammY runner](../plugins/runner).
:::

## Llamar a la API del Bot
Expand Down Expand Up @@ -109,11 +108,9 @@ Ajusta tu `tsconfig.json` en consecuencia y añade la línea resaltada:
En algunos casos, esto también puede funcionar sin ajustar la configuración de TypeScript.

::: warning Autocompletar incorrecto

Si no cambias tu archivo `tsconfig.json` como se ha descrito anteriormente, puede ocurrir que tu editor de código sugiera en el autocompletado importar tipos de `grammy/out/client` o algo así.
**Todas las rutas que comienzan con `grammy/out` son internas. No las utilices.
Podrían cambiarse arbitrariamente en cualquier momento, por lo que te aconsejamos encarecidamente que importes desde `grammy/types` en su lugar.

:::

### Haciendo llamadas a la API en bruto
Expand Down
1 change: 0 additions & 1 deletion site/docs/es/guide/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ grammY maneja esto automáticamente por ti, así que `bot.command("start")` coin
Puedes elegir coincidir sólo con comandos específicos especificando `bot.command("start@your_bot_name")`.

::: tip Sugerir comandos a los usuarios

Puedes llamar a:

```ts
Expand Down
2 changes: 0 additions & 2 deletions site/docs/es/guide/context.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,9 @@ Por ejemplo, puede llamar a `ctx.hasCommand("start")` para ver si el objeto de c
Esta es la razón por la que los métodos se denominan colectivamente _has checks_.

::: tip Saber cuándo usar Has Checks

Esta es exactamente la misma lógica que utiliza `bot.command("start")`.
Tenga en cuenta que normalmente debería utilizar [consultas de filtro](./filter-queries) y métodos similares.
El uso de las comprobaciones has funciona mejor dentro del plugin [conversaciones](../plugins/conversations).

:::

Las comprobaciones has acotan correctamente el tipo de contexto.
Expand Down
1 change: 0 additions & 1 deletion site/docs/es/guide/filter-queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ bot.on("message:left_chat_member:me"); // tu bot abandonó el chat (fue eliminad
```

::: tip Filtrar por propiedades del usuario

Si quieres filtrar por otras propiedades de un usuario, necesitas realizar una petición adicional, por ejemplo `await ctx.getAuthor()` para el autor del mensaje.
Las consultas de filtrado no realizarán secretamente otras peticiones a la API por ti.
Sigue siendo sencillo realizar este tipo de filtrado:
Expand Down
2 changes: 0 additions & 2 deletions site/docs/es/guide/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,13 @@ Esto detendrá tu bot.
Entonces, necesitas repetir los pasos 2 y 3.

::: tip Espera, ¿qué?

Instalar Node.js y configurar todo correctamente lleva mucho tiempo.
Si nunca has hecho esto antes, deberías esperar encontrarte con un montón de problemas confusos que son difíciles de solucionar.

Por eso esperamos que sepas cómo configurar tu sistema, o que seas capaz de aprender por ti mismo.
(Instalar Node.js _de la forma correcta_ es tan complicado que no cabe en esta página).

Si te sientes perdido en este punto, deberías dejar Node.js y usar [Deno](#requisitos-previos-para-deno) en su lugar.

:::

¿Aún confiado?
Expand Down
1 change: 0 additions & 1 deletion site/docs/es/guide/middleware.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ Si alguna vez llamas a `next()` sin la palabra clave `await`, varias cosas se ro
En su lugar, verás que se producirá un `UnhandledPromiseRejectionWarning`, que puede hacer que tu proceso bot se caiga.
- :x: Se rompe el mecanismo de backpressure de [grammY runner](../plugins/runner), que protege a tu servidor de una carga excesiva, como por ejemplo durante los picos de carga.
- :skull: A veces, también mata a todos tus inocentes gatitos. :crying_cat_face:

:::

La regla de usar `await` es especialmente importante para `next()`, pero en realidad se aplica a cualquier expresión en general que devuelva una `Promise`.
Expand Down
4 changes: 0 additions & 4 deletions site/docs/es/plugins/conversations.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ El objeto de contexto actual se pasa como segundo argumento a la función de con
Por ejemplo, si inicias tu conversación con `await ctx.reply(ctx.message.text)`, contendrá la actualización que contiene `/start`.

::: tip Cambiar el identificador de la conversación

Por defecto, tienes que pasar el nombre de la función a `ctx.conversation.enter()`.
Sin embargo, si prefieres utilizar un identificador diferente, puedes especificarlo así

Expand Down Expand Up @@ -669,9 +668,7 @@ const response = await conversation.external(() => externalApi());
Esto incluye tanto la lectura de datos como la realización de efectos secundarios (como la escritura en una base de datos).
::: tip Comparable a React
Si estás familiarizado con React, puede que conozcas un concepto comparable de `useEffect`.
:::
### Regla II: Todo comportamiento aleatorio debe estar envuelto
Expand Down Expand Up @@ -920,7 +917,6 @@ Los plugins hacen esto posible almacenando objetos de contexto antiguos, y reaba
Esta es la razón por la que los objetos de contexto dentro de las conversaciones no siempre se ven afectados por algunos plugins de grammY de la manera que cabría esperar.
::: warning Menús interactivos dentro de conversaciones
Con el [plugin de menú](./menu), estos conceptos chocan mucho.
Aunque los menús _pueden_ funcionar dentro de las conversaciones, no recomendamos usar estos dos plugins juntos.
En su lugar, utilice el plugin [inline keyboard plugin](./keyboard#teclados-en-linea) (hasta que añadamos soporte nativo de menús para conversaciones).
Expand Down
6 changes: 0 additions & 6 deletions site/docs/es/plugins/i18n.md
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,6 @@ await ctx.i18n.renegotiateLocale();
```

::: tip Renegociación de la configuración regional

Cuando se utilizan sesiones o alguna otra cosa---aparte de `ctx.from.language_code`---para seleccionar una configuración regional personalizada para el usuario, hay algunas situaciones en las que se puede cambiar el idioma mientras se maneja una actualización.
Por ejemplo, eche un vistazo al ejemplo anterior utilizando sesiones.

Expand All @@ -489,11 +488,9 @@ await ctx.i18n.renegotiateLocale();
Después, cada vez que usemos el método `t`, el bot intentará responder con la traducción al alemán de ese mensaje (especificada en `locales/de.ftl`).

Además, recuerda que cuando utilices sesiones incorporadas, puedes conseguir el mismo resultado utilizando el método `setLocale`.

:::

::: tip Para establecer la configuración regional cuando no se utilizan sesiones

Cuando [no se usan sesiones](#sin-sesiones), si hay un caso en el que necesitas establecer la configuración regional para un usuario, puedes hacerlo usando el método `useLocale`.

```ts
Expand All @@ -503,7 +500,6 @@ await ctx.i18n.useLocale("de");
Establece la configuración regional especificada para ser utilizada en futuras traducciones.
El efecto dura sólo para la actualización actual y no se conserva.
Puedes utilizar este método para cambiar la configuración regional de la traducción en medio de la actualización (por ejemplo, cuando el usuario cambia el idioma).

:::

## Negociación personalizada de la configuración regional
Expand Down Expand Up @@ -534,11 +530,9 @@ Este es el orden por defecto de cómo el plugin elige su configuración regional
Recomendamos** establecer una configuración regional que exista en sus traducciones como `defaultLocale` en las opciones `I18n`.

::: tip Negociación de la configuración regional

La negociación de la configuración regional ocurre normalmente sólo una vez durante el proceso de actualización de Telegram.
Sin embargo, puedes ejecutar `ctx.i18n.renegotiateLocale()` para llamar al negociador de nuevo y determinar la nueva localización.
Es útil si la configuración regional cambia durante el procesamiento de una sola actualización.

:::

Este es un ejemplo de `localeNegotiator` donde usamos `locale` de la sesión en lugar de `__language_code`.
Expand Down
1 change: 0 additions & 1 deletion site/docs/es/plugins/session.md
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,6 @@ Crear un adaptador de almacenamiento personalizado es extremadamente sencillo.
La opción `storage` funciona con cualquier objeto que se adhiera a [esta interfaz](https://deno.land/x/grammy/mod.ts?s=StorageAdapter), por lo que puedes conectarte a tu almacenamiento con sólo unas líneas de código.
> Si has publicado tu propio adaptador de almacenamiento, no dudes en editar esta página y enlazarla aquí, para que otras personas puedan utilizarla.
:::
Todos los adaptadores de almacenamiento pueden instalarse de la misma manera.
Expand Down
3 changes: 0 additions & 3 deletions site/docs/guide/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ However, the Bot API server that is responsible for translating the requests to
Hence, if you circumvent the Bot API server that Telegram runs for you, and simply [host your own Bot API server](https://core.telegram.org/bots/api#using-a-local-bot-api-server), you can allow your bot to send files up to 2000 MB.

> Note: if you are working with large files over [long polling](./deployment-types), you should use [grammY runner](../plugins/runner).
:::

## Calling the Bot API
Expand Down Expand Up @@ -109,11 +108,9 @@ Adjust your `tsconfig.json` accordingly and add the highlighted line:
In some cases, this can also work without adjusting your TypeScript configuration.

::: warning Wrong Autocomplete

If you do not change your `tsconfig.json` file as described above, it may happen that your code editor suggests in autocomplete to import types from `grammy/out/client` or something.
**All paths starting with `grammy/out` are internal. Do not use them.**
They could be changed arbitrarily at any point in time, so we strongly advise you to import from `grammy/types` instead.

:::

### Making Raw API Calls
Expand Down
2 changes: 0 additions & 2 deletions site/docs/guide/context.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,9 @@ For example, you can call `ctx.hasCommand("start")` to see if the context object
This is why the methods are collectively named _has checks_.

::: tip Know When to Use Has Checks

This is the exact same logic that is used by `bot.command("start")`.
Note that you should usually use [filter queries](./filter-queries) and similar methods.
Using has checks works best inside the [conversations plugin](../plugins/conversations).

:::

The has checks correctly narrow down the context type.
Expand Down
2 changes: 0 additions & 2 deletions site/docs/guide/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,13 @@ This will stop your bot.
Then, you need to repeat steps 2 and 3.

::: tip Wait, what?

Installing Node.js and setting up and configuring everything correctly takes a lot of time.
If you have never done this before, you should expect to run into plenty of confusing problems that are hard to fix.

This is why we sort of expect that you know how to set up your system, or that you are able to teach yourself.
(Already installing Node.js _the right way_ is so complicated that it does not fit this page.)

If you feel lost at this point, you should leave Node.js behind and use [Deno](#prerequisites-for-deno) instead.

:::

Still confident?
Expand Down
1 change: 0 additions & 1 deletion site/docs/guide/middleware.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ If you ever call `next()` without the `await` keyword, several things will break
Instead, you will see that an `UnhandledPromiseRejectionWarning` will occur, which may crash your bot process.
- :x: The backpressure mechanism of [grammY runner](../plugins/runner) breaks, which protects your server from overly-high load, such as during load spikes.
- :skull: Sometimes, it also kills all of your innocent kittens. :crying_cat_face:

:::

The rule that you should use `await` is especially important for `next()`, but it actually applies to any expression in general that returns a `Promise`.
Expand Down
3 changes: 0 additions & 3 deletions site/docs/id/guide/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ Namun, server API Bot---yang bertanggung jawab untuk menerjemahkan request ke HT
Untuk menyiasati batasan tersebut, kamu bisa [meng-hosting server API Bot sendiri](https://core.telegram.org/bots/api#using-a-local-bot-api-server) supaya bot kamu bisa mengirim file dengan ukuran hingga 2000 MB.

> Catatan: Jika menangani file-file berukuran besar menggunakan [long polling](./deployment-types), kamu sebaiknya menggunakan [grammY runner](../plugins/runner).
:::

## Memanggil API Bot
Expand Down Expand Up @@ -110,12 +109,10 @@ Atur `tsconfig.json` dengan benar lalu tambahkan baris yang disorot berikut:
Terkadang ia juga bisa bekerja meski kita tidak mengatur konfigurasi Typescript-nya terlebih dahulu.

::: warning Keliru Menyetel Auto-complete

Jika kamu tidak mengubah file `tsconfig.json` seperti yang telah dijelaskan di atas, kemungkinan besar auto-complete code editor kamu akan menyarankan untuk meng-import types dari `grammy/out/client` atau semacamnya.
**Semua path yang dimulai dengan `grammy/out` adalah file internal. Jangan digunakan!**
File tersebut bisa berubah sewaktu-waktu.
Oleh karena itu, kami sangat menyarankan kamu untuk meng-import dari `grammy/types`.

:::

### Membuat Panggilan Raw API
Expand Down
2 changes: 0 additions & 2 deletions site/docs/id/guide/context.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,9 @@ Contohnya, kamu bisa memanggil `ctx.hasCommand("start")` untuk memeriksa apakah
Itulah kenapa method ini dinamakan _has checks_.

::: tip Kapan Waktu yang Tepat untuk Menggunakan Has Checks?

Method ini menggunakan logika yang sama yang digunakan oleh `bot.command("start")`.
Kami menyarankan kamu untuk selalu menggunakan [filter queries](./filter-queries) dan method-method lain yang serupa.
has checks sebaiknya digunakan di [plugin conversations](../plugins/conversations).

:::

has checks secara tepat mengerucutkan type context terkait.
Expand Down
3 changes: 0 additions & 3 deletions site/docs/id/guide/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ Luangkan waktumu sebentar untuk menonton [video 34 detik ini](https://youtu.be/8
> Inti dari video tersebut adalah satu-satunya cara untuk belajar pemrograman---dengan cepat---adalah jangan terlalu banyak menonton video tutorial ataupun pelatihan-pelatihan semacamnya.
> Teori memang penting, tetapi yang perlu kamu prioritaskan adalah memperbanyak latihan, alias praktik langsung ngoding.
> Untuk versi bahasa Indonesia, mungkin yang mirip dengan video di atas adalah [video 3 menit ini](https://youtu.be/a6yeLjujJXo)---lebih tepatnya 18 detik pertama.
:::

Dengan memilih grammY, kamu telah menggunakan sebuah bahasa pemrograman, yaitu TypeScript.
Expand Down Expand Up @@ -204,14 +203,12 @@ Tekan `Ctrl+C` di terminal untuk menghentikan proses tersebut, yang nantinya jug
Kemudian, ulangi langkah 2 dan 3.

::: tip Hah, maksudnya?

Proses instalasi Node.js beserta pengaturan konfigurasinya memerlukan waktu yang tidak sedikit.
Jika kamu belum pernah melakukannya, kemungkinan besar kamu akan mengalami berbagai masalah yang cukup rumit untuk diatasi.

Itulah kenapa kami sedikit berharap kamu mengerti bagaimana mengatur sistem kamu, atau bahkan mempelajarinya secara mandiri---Proses penginstalan Node.js _dengan cara yang benar_ sangatlah rumit sehingga tidak cukup untuk kami menjelaskannya di halaman ini.

Jika kamu merasa kebingungan di titik ini, sebaiknya tinggalkan Node.js dan beralih menggunakan [Deno](#persiapan-untuk-deno).

:::

Masih percaya diri?
Expand Down
1 change: 0 additions & 1 deletion site/docs/id/guide/middleware.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ Kalau kamu memanggil `next()` tanpa `await`, beberapa hal tidak akan berjalan de
Akibatnya, kamu akan melihat sebuah `UnhandledPromiseRejectionWarning` yang membuat bot menjadi crash.
- :x: Mekanisme backpressure [grammY runner](../plugins/runner)---yang berfungsi untuk melindungi server dari beban yang terlalu tinggi, misalnya saat terjadi lonjakan beban---menjadi tidak berfungsi.
- :skull: Terkadang, juga dapat membunuh kucing imut yang tidak berdosa. :crying_cat_face:

:::

Aturannya adalah kamu harus menggunakan `await`, khususnya untuk `next()`.
Expand Down
4 changes: 0 additions & 4 deletions site/docs/id/plugins/conversations.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ Context object-nya akan diteruskan ke conversation builder function sebagai argu
Contohnya, jika kamu membuat conversation dengan `await ctx.reply(ctx.message.text)`, ia akan memiliki update yang di dalamnya terdapat `/start`.

::: tip Mengubah Conversation Identifier

Secara bawaan, kamu diharuskan mengisi nama function ke `ctx.conversation.enter()`.
Jika kamu memilih untuk menggunakan identifier yang berbeda, kamu bisa melakukannya dengan cara seperti ini:

Expand Down Expand Up @@ -668,9 +667,7 @@ const response = await conversation.external(() => externalApi());
Ini termasuk pembacaan data maupun melakukan [side-effect](https://softwareengineering.stackexchange.com/questions/40297/what-is-a-side-effect) (misalnya menulis ke sebuah database).
::: tip Serupa dengan React
Jika kamu familiar dengan React, kamu mungkin paham sebuah konsep yang serupa dengan `useEffect`.
:::
### Aturan II: Semua Perilaku Acak Harus Dibungkus
Expand Down Expand Up @@ -930,7 +927,6 @@ Plugin ini bisa melakukan hal tersebut dengan cara menyimpan context object yang
Itulah kenapa plugin-plugin grammY tidak selalu bisa mempengaruhi context object di dalam percakapan seperti yang diharapkan.
::: warning Menu Interaktif di Dalam Percakapan
Konsep ini bertolak belakang dengan [plugin menu](./menu).
Meski menu _bisa_ bekerja di dalam percakapan, namun kami tidak menyarankan untuk menggunakan kedua plugin ini secara bersamaan.
Sebagai gantinya, gunakan [plugin keyboard inline](./keyboard#keyboard-inline) biasa (hingga kami menambahkan dukungan menu asli untuk percakapan).
Expand Down
6 changes: 0 additions & 6 deletions site/docs/id/plugins/i18n.md
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,6 @@ await ctx.i18n.renegotiateLocale();
```

::: tip Me-renegotiate Locale

Ketika kamu menggunakan session atau hal lainnya---selain dari `ctx.from.language_code`---untuk memilih locale khusus untuk suatu user, ada beberapa situasi dimana kamu berkeinginan untuk mengganti bahasanya ketika menangani sebuah update.
Coba lihat kembali contoh yang menggunakan session di atas.

Expand All @@ -484,11 +483,9 @@ await ctx.i18n.renegotiateLocale();
Setelah itu, setiap kali kita menggunakan method `t`, bot akan membalas dengan terjemahan bahasa Indonesia untuk pesan tersebut (yang telah ditentukan di `locales/id.ftl`).

Perlu diingat juga, ketika menggunakan session built-in, kamu bisa mendapatkan hasil yang serupa dengan menggunakan method `setLocale`.

:::

::: tip Mengatur Locale Tanpa Menggunakan Session

Jika suatu saat kamu perlu menentukan locale untuk suatu user, tetapi kamu [tidak sedang menggunakan session](#tanpa-session), maka kamu bisa melakukannya dengan menggunakan method `useLocale`.

```ts
Expand All @@ -498,7 +495,6 @@ await ctx.i18n.useLocale("id");
Ia akan menggunakan locale yang telah ditentukan untuk terjemahan selanjutnya.
Efeknya hanya akan berlaku untuk update yang sedang berlangsung, dan tidak permanen.
Kamu bisa menggunakan method ini untuk mengubah terjemahan ketika sedang menangani update (misal, ketika user mengubah bahasa).

:::

## Locale Negotiation Khusus
Expand Down Expand Up @@ -528,11 +524,9 @@ Berikut langkah-langkah bawaan yang dilakukan oleh plugin ketika memilih sebuah
Kami **sangat merekomendasikan** untuk menetapkan sebuah locale yang tersedia di terjemahan kamu sebagai `defaultLocale` di opsi `I18n`.

::: tip Locale Negotiation

Locale negotiation biasanya hanya terjadi sekali selama pemrosesan update Telegram berlangsung.
Meski begitu, kamu bisa memanggil kembali negotiator dan menentukan locale yang baru dengan menjalankan `ctx.i18n.renegotiateLocale()`.
Ini akan berguna jika locale mengalami perubahan selama proses update berlangsung.

:::

Berikut sebuah contoh penerapan `localeNegotiator` dimana kita menggunakan `locale` dari sebuah session alih-alih menggunakan `__language_code`.
Expand Down
1 change: 0 additions & 1 deletion site/docs/id/plugins/session.md
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,6 @@ Membuat storage adapter sendiri sangat mudah dilakukan.
Opsi `storage` bekerja dengan berbagai object yang menganut [interface berikut](https://deno.land/x/grammy/mod.ts?s=StorageAdapter), sehingga kamu bisa melakukan koneksi ke storage-mu hanya dengan beberapa baris kode.
> Kalau kamu ingin mempublikasikan storage adapter buatanmu, silahkan ubah halaman ini dan sertakan juga link-nya agar orang-orang bisa menggunakannya.
:::
Semua storage adapter bisa diinstal dengan cara yang sama.
Expand Down
Loading

0 comments on commit 13525c1

Please sign in to comment.