<|im_start|>system
You are a helpful AI assistant.<|im_end|>
<|im_start|>user
Write me a skeleton discord bot in python using discord.py<|im_end|>
<|im_start|>assistant
Sure, here's a skeleton Discord bot in Python using the discord.py library:

```python
import discord
from discord.ext import commands

bot = commands.Bot(command_prefix='!')

@bot.event
async def on_ready():
    print(f'{bot.user.name} has connected to Discord!')

@bot.command(name='ping')
async def ping(ctx):
    await ctx.send('Pong!')

bot.run('<your-bot-token>')
```

This code sets up a basic Discord bot that responds with "Pong!" when a user sends the command `!ping`. To use this code, you'll need to replace `<your-bot-token>` with your actual bot token.

Once you have the code saved as a Python file, you can run it from the command line or terminal using: 

```bash
python3 <filename>.py
``` 

Make sure that you have installed the `discord.py` library by running `pip install discord.py` beforehand.<|im_end|>
<|im_start|>user
How should I store my API token? It's a bad idea to hardcode in the code.<|im_end|>
<|im_start|>assistant
You're right. It's not a good idea to hardcode sensitive information such as API tokens directly in your code. Instead, you can use environment variables to securely store and access the token. Here's how you can do that:

1. First, install the python-dotenv package to easily work with environment variables:
``` 
pip install python-dotenv
``` 
2. Create a new file named .env in the same directory as your Python script. In this file, add the following line:
```
DISCORD_TOKEN=your_token_here
```
Replace your_token_here with your actual Discord API token.

3. Modify your Python script to load the token from the environment variable using python-dotenv. Here's the updated script:
```
import os
import discord
from discord.ext import commands
from dotenv import load_dotenv

load_dotenv()
token = os.getenv('DISCORD_TOKEN')

bot = commands.Bot(command_prefix='!')

@bot.event
async def on_ready():
    print(f'{bot.user.name} has connected to Discord!')

@bot.command()
async def hello(ctx):
    await ctx.send('Hello!')

bot.run(token)
```
Now, your Discord token is stored securely in the .env file and accessed through the environment variable in your script. Make sure to add the .env file to your .gitignore if you're using version control to prevent accidentally sharing your token.<|im_end|>