Compare commits

..

4 Commits

Author SHA1 Message Date
b8880f9a17 automagically build docker?
All checks were successful
Build and Push Docker Image / build (push) Successful in 1m31s
2026-03-11 13:25:39 -04:00
b34d1281f2 better readme 2026-03-11 13:25:32 -04:00
95777bb389 accept discord token as env
we only really need that to function anyway, other things like jellyfin will
just not do anything and we have default value for avatar reset.
2026-03-11 13:25:15 -04:00
81c5e916dc better docker 2026-03-11 13:22:09 -04:00
7 changed files with 113 additions and 13 deletions

View File

@@ -1,3 +1,6 @@
docker-compose.yml
node_modules
.git
config.json
state.json
config.json
avatars

View File

@@ -0,0 +1,36 @@
name: Build and Push Docker Image
on:
push:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Login to Registry
uses: docker/login-action@v2
with:
registry: git.cesium.one
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build Docker Image
run: |
# Build the image with the commit hash tag
docker build -t git.cesium.one/kira/cockinator .
- name: Push Docker Images
env:
BRANCH_NAME: ${{ github.ref_name }}
SHORT_HASH: ${{ github.sha }}
run: |
docker push git.cesium.one/kira/cockinator
- name: Log out from registry
if: always()
run: docker logout registry.example.com

View File

@@ -1,6 +1,6 @@
FROM node:25
RUN mkdir -p /usr/scr/bot
WORKDIR /usr/src/bot
COPY . /usr/src/bot
FROM node:25-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
CMD ["node", "index.js"]
COPY . .
CMD ["node", "index.js"]

View File

@@ -1,3 +1,42 @@
# girl cock inator
its docker compose, copy the default to `docker-compose.yml` and put a discord token in and start the container and it works i hope
it finds twitter links and turns them into girlcock links for better embed
## easiest way
docker image published at `git.cesium.one/kira/cockinator:latest` only needs `DISCORD` passed as a variable with your token
### examples
`docker run -e "DISCORD=TOKEN_HERE" git.cesium.one/kira/cockinator:latest`
```yml
services:
bot:
restart: unless-stopped
image: git.cesium.one/kira/cockinator
environment:
- DISCORD=TOKEN_HERE
```
## easy way
this also works in not docker with regular node.js, and pass it the `DISCORD` variable however you like
`npm i && DISCORD=TOKEN_HERE node index.js`
## other ways
you can build the image yourself with `docker build . -t cockinator` to then run with `docker run cockinator`
you can also build the image with docker-compose, by replacing `image: git.cesium.one/kira/cockinator` with `build: .`
## the config file
for the full functionality of the bot, you can copy `config.json.default` to `config.json` and fill it in.
it'll need to be in the main directory, and for docker that means mounting it as a volume with `-v ./config.json:/app/config.json`
## profile picture rotation
it'll take everything in ./avatars and shuffle them before rotating through them. this can also be mounted for docker with `-v ./avatars:/app/avatars`

View File

@@ -1,5 +1,8 @@
let config = {}
try { config = require('../config.json'); }
catch { config.jellyfin = null; }
const { SlashCommandBuilder } = require('discord.js');
const config = require('../config.json');
const { createClient } = require('../lib/jellyfin');
async function sendChunked(interaction, content) {
@@ -73,7 +76,10 @@ module.exports = {
),
async execute(interaction) {
if (!config.jellyfin.users.includes(interaction.user.id)) {
if (!config.jellyfin) {
interaction.reply({ content: 'This bot is not configured with a Jellyfin instance.', flags: 64 });
return;
} else if (!config.jellyfin.users.includes(interaction.user.id)) {
interaction.reply({ content: 'You are not authorized to use this command.', flags: 64 });
return;
} else if (interaction.channel.type !== 1) {
@@ -187,4 +193,4 @@ module.exports = {
await interaction.editReply(`Error fetching from Jellyfin: ${err.message}`);
}
},
};
};

View File

@@ -2,5 +2,11 @@ services:
bot:
restart: unless-stopped
build: .
volumes:
- ./config.json:/usr/src/bot/config.json
environment:
- DISCORD=TOKEN_HERE
# volumes:
# Uncomment the config for advanced configuration like Jellyfin.
# - ./config.json:/app/config.json
# Uncomment avatars for an avatars folder it can rotate through.
# - ./avatars:/app/avatars

View File

@@ -1,4 +1,14 @@
const config = require('./config.json');
let config = {};
try {
config = require('./config.json');
} catch {
if (process.env.DISCORD && process.env.DISCORD != "TOKEN_HERE") {
config.token = process.env.DISCORD;
} else {
console.error("FATAL: Discord token required. Either pass it as an environment variable \"DISCORD\", or fill out config.json.default.");
process.exit(1);
}
}
// the basic discord setup stuff yoinked from their guide
const { Client, Events, GatewayIntentBits, Partials, ActivityType, MessageFlags, Collection } = require('discord.js');
const client = new Client({