mirror of
https://github.com/DerTyp7/docker_minecraft_server_auto_starter.git
synced 2025-10-28 20:32:16 +01:00
Update environment variables in readme.md
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.env
|
||||
29
app/discordHandler.py
Normal file
29
app/discordHandler.py
Normal file
@@ -0,0 +1,29 @@
|
||||
import os
|
||||
import discord
|
||||
from discord.ext import commands
|
||||
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
TOKEN = os.getenv('DISCORD_TOKEN')
|
||||
|
||||
intents = discord.Intents.default()
|
||||
client = discord.Client(intents=intents)
|
||||
|
||||
|
||||
bot = commands.Bot(command_prefix='!', intents=intents)
|
||||
|
||||
@bot.command()
|
||||
async def set_channel(ctx, channel_id: int):
|
||||
global CHANNEL_ID
|
||||
CHANNEL_ID = channel_id
|
||||
await ctx.send(f'Channel set to {channel_id}')
|
||||
|
||||
@bot.event
|
||||
async def on_ready():
|
||||
print(f'{bot.user} has connected to Discord!')
|
||||
if 'CHANNEL_ID' in globals():
|
||||
channel = bot.get_channel(CHANNEL_ID)
|
||||
await channel.send("Hello World!")
|
||||
|
||||
bot.run(TOKEN)
|
||||
18
readme.md
18
readme.md
@@ -10,8 +10,16 @@ See the [docker-compose.yml](https://github.com/DerTyp7/docker_minecraft_server_
|
||||
|
||||
## Environment Variables
|
||||
|
||||
| Variable | Description | Default | Example |
|
||||
| -------------------------------- | ----------------------------------------------------------------------------------------------------------- | ------- | -------------- |
|
||||
| `PLACEHOLDER_SERVER_SLEEPING_IP` | (optional) The internal docker-compose IP for the placeholder server when a server is sleeping | `""` | `"172.20.0.3"` |
|
||||
| `PLACEHOLDER_SERVER_STARTING_IP` | (optional) The internal docker-compose IP for the placeholder server when a server is starting | `""` | `"172.20.0.4"` |
|
||||
| `PORT_IP_MAP` | Map which matches the external Minecraft ports to the internal docker-compose IPs for the Minecraft-Servers | | |
|
||||
| Variable | Description | Default | Example |
|
||||
| -------------------------------- | ----------------------------------------------------------------------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `PLACEHOLDER_SERVER_SLEEPING_IP` | (optional) The internal docker-compose IP for the placeholder server when a server is sleeping | `""` | `"172.20.0.3"` |
|
||||
| `PLACEHOLDER_SERVER_STARTING_IP` | (optional) The internal docker-compose IP for the placeholder server when a server is starting | `""` | `"172.20.0.4"` |
|
||||
| `PORT_IP_MAP` | Map which matches the external Minecraft ports to the internal docker-compose IPs for the Minecraft-Servers | |  |
|
||||
|
||||
## Developer Usage
|
||||
|
||||
### Example .env file
|
||||
|
||||
```env
|
||||
DISCORD_TOKEN={your-bot-token}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user