This commit is contained in:
parent
a664de2e3a
commit
790872f92c
31
.gitea/workflows/build.yml
Normal file
31
.gitea/workflows/build.yml
Normal file
@ -0,0 +1,31 @@
|
||||
name: Build Docker
|
||||
run-name: Build Docker Image
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
Build Docker:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Install Docker
|
||||
run : |
|
||||
apt-get install ca-certificates curl gnupg
|
||||
install -m 0755 -d /etc/apt/keyrings
|
||||
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
|
||||
chmod a+r /etc/apt/keyrings/docker.gpg
|
||||
echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||
apt-get update
|
||||
apt-get install docker-ce-cli -y
|
||||
- name: Build Docker image
|
||||
run : |
|
||||
echo "${{ secrets.DOCKERGIT_TOKEN }}" | docker login git.woodburn.au -u nathanwoodburn --password-stdin
|
||||
tag_num=$(git rev-parse --short HEAD)
|
||||
docker build -t woodburn-bot:$tag_num .
|
||||
docker tag woodburn-bot:$tag_num git.woodburn.au/nathanwoodburn/woodburn-bot:$tag_num
|
||||
docker push git.woodburn.au/nathanwoodburn/woodburn-bot:$tag_num
|
||||
docker tag woodburn-bot:$tag_num git.woodburn.au/nathanwoodburn/woodburn-bot:latest
|
||||
docker push git.woodburn.au/nathanwoodburn/woodburn-bot:latest
|
||||
|
||||
|
||||
|
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
|
||||
.env
|
6
Dockerfile
Normal file
6
Dockerfile
Normal file
@ -0,0 +1,6 @@
|
||||
FROM python:3.10-bullseye
|
||||
COPY requirements.txt /app/
|
||||
WORKDIR /app
|
||||
RUN pip install -r requirements.txt
|
||||
COPY . .
|
||||
CMD ["python3", "bot.py"]
|
40
bot.py
Normal file
40
bot.py
Normal file
@ -0,0 +1,40 @@
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
import discord
|
||||
from discord import app_commands
|
||||
|
||||
|
||||
load_dotenv()
|
||||
TOKEN = os.getenv('DISCORD_TOKEN')
|
||||
|
||||
intents = discord.Intents.default()
|
||||
client = discord.Client(intents=intents)
|
||||
tree = app_commands.CommandTree(client)
|
||||
|
||||
# Commands
|
||||
@tree.command(name="ping", description="Check bot connection")
|
||||
async def ping(ctx):
|
||||
await ctx.response.send_message("Pong!",ephemeral=True)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def updateStatus():
|
||||
activity = discord.Activity(name="Nathan try to get set me up", type=discord.ActivityType.watching)
|
||||
client.loop.create_task(client.change_presence(activity=activity))
|
||||
|
||||
# When the bot is ready
|
||||
@client.event
|
||||
async def on_ready():
|
||||
await tree.sync()
|
||||
print("Ready!")
|
||||
updateStatus()
|
||||
|
||||
client.run(TOKEN)
|
2
requirements.txt
Normal file
2
requirements.txt
Normal file
@ -0,0 +1,2 @@
|
||||
discord.py
|
||||
python-dotenv
|
Loading…
Reference in New Issue
Block a user