Compare commits
4 Commits
fe7b30908e
...
b8880f9a17
| Author | SHA1 | Date | |
|---|---|---|---|
| b8880f9a17 | |||
| b34d1281f2 | |||
| 95777bb389 | |||
| 81c5e916dc |
@@ -1,3 +1,6 @@
|
||||
docker-compose.yml
|
||||
node_modules
|
||||
.git
|
||||
state.json
|
||||
config.json
|
||||
avatars
|
||||
|
||||
36
.gitea/workflows/docker.yml
Normal file
36
.gitea/workflows/docker.yml
Normal 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
|
||||
|
||||
@@ -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
|
||||
COPY . .
|
||||
CMD ["node", "index.js"]
|
||||
41
README.md
41
README.md
@@ -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`
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
12
index.js
12
index.js
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user