# العمل مع المتغيرات

## كيفية الحصول على قيم متغيرات العميل

get\_client\_var() | get\_client\_vars()

<details>

<summary>الوصف</summary>

<mark style="background-color:blue;">**للحصول على قيمة متغير واحد**</mark>

**get\_client\_var(client\_id, variable)**

المعلمات:\ <mark style="color:red;">**!**</mark>**&#x20;client\_id -** معرّف العميل\ <mark style="color:red;">**!**</mark>**&#x20;variable -** اسم المتغير

<mark style="background-color:blue;">**للحصول على قيم عدة متغيرات**</mark>

**get\_client\_vars(client\_id, names)**

المعلمات:\ <mark style="color:red;">**!**</mark>**&#x20;client\_id -** معرّف العميل\ <mark style="color:red;">**!**</mark>**&#x20;names-** مصفوفة من المتغيرات

</details>

<details>

<summary>مثال</summary>

لنرسل إلى المدير رسالة تتضمن رقم الدرس الذي يحضره أحد المشاركين في مشروعنا:

<div data-with-frame="true"><figure><img src="/files/4acedc5453943ec32eaad15105f3ba375acfbf22" alt="" width="563"><figcaption><p>مثال على استخدام الدالة للحصول على قيمة متغير</p></figcaption></figure></div>

<div data-with-frame="true"><figure><img src="/files/d842a3479b31c4eb8a170611b138e5b3ad58bdb2" alt="" width="375"><figcaption><p>نتيجة الدالة</p></figcaption></figure></div>

الخيار نفسه، ولكن مع إخراج، على سبيل المثال، المستوى والدرس داخله:

<div data-with-frame="true"><figure><img src="/files/9f233fc45a2a8fcbe99d9a7d92eab8e4e3ecdbaa" alt=""><figcaption><p>مثال على استخدام الدالة للحصول على قيم متعددة</p></figcaption></figure></div>

<div data-with-frame="true"><figure><img src="/files/fc4f2de6e4e5e005bc83e27beb6ecb7d4ca40741" alt="" width="350"><figcaption><p>نتيجة الدالة</p></figcaption></figure></div>

</details>

<details>

<summary>مثال على الكود للنسخ</summary>

```
/*الحصول على متغير واحد*/
trial=get_client_var(64732310, 'lesson')

/*الحصول على عدة متغيرات*/
names=["level","lesson"]
trial=get_client_vars(64732310, names)
```

</details>

## كيفية تعيين متغير عميل

set\_client\_var() | set\_client\_vars()

<details>

<summary>الوصف</summary>

<mark style="background-color:blue;">**لتعيين قيمة متغير واحد**</mark>

**set\_client\_var(client\_id, variable, value)**

المعلمات:

**client\_id** — معرّف عميل MaviBot\
**variable** — اسم المتغير المراد تعيينه\
**value** — قيمة المتغير

<mark style="background-color:blue;">**لتعيين عدة متغيرات**</mark>

**set\_client\_vars(client\_id, variables\_dict)**

المعلمات:

**client\_id** — معرّف عميل MaviBot\
**variables\_dict** — قاموس؛ يحتوي على جميع أسماء المتغيرات وقيمها التي سيتم إضافتها. \
الصيغة:\
'{"var\_name1": "var\_value1", "var\_name2": "var\_value2", "var\_name3": "var\_value3"}'

</details>

<details>

<summary>مثال</summary>

مثال 1:

set\_client\_var(client\_id, "new", "yes")

<div data-with-frame="true"><figure><img src="/files/a00730cd5695d6ceccca4c70eb11e82f1ccb53d9" alt="" width="563"><figcaption></figcaption></figure></div>

<div data-with-frame="true"><figure><img src="/files/d88dde5f6ac7fbbcb9f93b63342f06035cd4573c" alt=""><figcaption></figcaption></figure></div>

مثال 2:

set\_client\_vars(1136, '{"var\_name1": "var\_value1", "var\_name2": "var\_value2", "var\_name3": "var\_value3"}')

<div data-with-frame="true"><figure><img src="/files/1f23f9df5fe32ff13d1e8ff98d7b56c07103d88b" alt=""><figcaption></figcaption></figure></div>

قسم المتغيرات في بطاقة العميل

<div data-with-frame="true"><figure><img src="/files/b49581ab86d32d3a950c6fd3ef8507e5c90c361c" alt=""><figcaption></figcaption></figure></div>

&#x20;

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mavibot.ai/doc/ar/chatbot/functions/alaalh-alhasbh/variables.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
