# Examples

***

{% hint style="info" %}
These examples assume that you have the **Message Content** privileged intent enabled. Follow step 4 on the [Create a bot](https://dispy.gitbook.io/docs/documentation/readme/setup-your-bot-on-discord) guide.
{% endhint %}

### Base Template

This is how the base code of your bot should like, but I recommend hiding the token better.

```python
from dispy import Bot

token = 'your_token'
bot = Bot(token)

@bot.once('READY')
def on_ready():
   print('READY')

bot.run()
```

### Help Command

To test your command, simply send `!help` in a channel that the bot has access to.

```python
from dispy import Bot
from dispy.types import (
   Message,
   User
)

token = 'your_token'
bot = Bot(token)

@bot.once('READY')
def on_ready():
   print('READY')
   
@bot.on('MESSAGE_CREATE')
def on_message(msg: Message, user: User):
   if msg.content == '!help':
      msg.reply('My commands are:\n- !help - List the commands')

bot.run()
```

### Embed Example

This is a basic example of the embed functionality, to see your embed, simply send `!help` in a channel that the bot has access to.

```python
from dispy import Bot, EmbedBuilder
from dispy.types import (
   Message,
   User
)

token = 'your_token'
bot = Bot(token)

@bot.once('READY')
def on_ready():
    print('READY')
   
@bot.on('MESSAGE_CREATE')
def on_message(msg: Message, user: User):
    if msg.content == '!help':
        helpCommand = (EmbedBuilder()
            .setTitle('Commands List')
            .setColor('blue')
            .addField('!help', 'List the commands')
        )
        msg.reply(embeds=helpCommand)

bot.run()
```


---

# 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://dispy.gitbook.io/docs/documentation/examples.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.
