commit
129b3cdb35
9 changed files with 4176 additions and 3753 deletions
104
.github/workflows/release.yml
vendored
Normal file
104
.github/workflows/release.yml
vendored
Normal file
|
@ -0,0 +1,104 @@
|
|||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, next, dev]
|
||||
pull_request:
|
||||
branches: [main, next, dev]
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
- name: Cache Node.js dependencies
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Build TypeScript source code
|
||||
run: npm run build
|
||||
|
||||
- name: Semantic Release
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
run: npx semantic-release
|
||||
|
||||
- name: Store build artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: build-artifacts
|
||||
path: . # Include all files in the artifact
|
||||
path-ignore: node_modules
|
||||
|
||||
docker:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Download build artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: build-artifacts
|
||||
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: |
|
||||
zyner/xyter
|
||||
tags: |
|
||||
type=schedule
|
||||
type=ref,event=branch
|
||||
type=ref,event=pr
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{major}}
|
||||
type=sha
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Login to Docker Hub
|
||||
if: github.event_name != 'pull_request'
|
||||
run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Login to Container registry
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
platforms: linux/amd64
|
|
@ -1,12 +1,12 @@
|
|||
# Dependencies
|
||||
FROM node:19-alpine3.17 AS dependencies
|
||||
FROM node:20-alpine3.21 AS dependencies
|
||||
|
||||
WORKDIR /app
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm install
|
||||
|
||||
# Build
|
||||
FROM node:19-alpine3.17 AS build
|
||||
FROM node:20-alpine3.21 AS build
|
||||
|
||||
WORKDIR /app
|
||||
COPY --from=dependencies /app/node_modules ./node_modules
|
||||
|
@ -15,7 +15,7 @@ COPY . .
|
|||
RUN npx prisma generate && npm run build
|
||||
|
||||
# Deploy
|
||||
FROM node:19-alpine3.17 as deploy
|
||||
FROM node:20-alpine3.20 as deploy
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
version: "3.7"
|
||||
services:
|
||||
xyter:
|
||||
container_name: xyter
|
||||
image: registry.zyner.org/zyner/xyter/bot
|
||||
image: zyner/xyter
|
||||
#build:
|
||||
# context: .
|
||||
restart: unless-stopped
|
||||
|
|
7766
package-lock.json
generated
7766
package-lock.json
generated
File diff suppressed because it is too large
Load diff
38
package.json
38
package.json
|
@ -34,36 +34,36 @@
|
|||
"email": "vermium@zyner.org"
|
||||
},
|
||||
"dependencies": {
|
||||
"@prisma/client": "^4.7.1",
|
||||
"@prisma/client": "^6.0.1",
|
||||
"@semantic-release/gitlab": "^12.0.3",
|
||||
"axios": "^1.4.0",
|
||||
"chance": "^1.1.9",
|
||||
"date-fns": "^2.29.3",
|
||||
"date-fns": "^4.1.0",
|
||||
"discord.js": "^14.7.1",
|
||||
"dotenv": "^16.0.3",
|
||||
"node-schedule": "^2.1.0",
|
||||
"uuid": "^9.0.0",
|
||||
"uuid": "^11.0.3",
|
||||
"winston": "^3.8.2",
|
||||
"winston-daily-rotate-file": "^4.7.1"
|
||||
"winston-daily-rotate-file": "^5.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@semantic-release/git": "^10.0.1",
|
||||
"@semantic-release/release-notes-generator": "^11.0.0",
|
||||
"@types/chance": "1.1.3",
|
||||
"@types/node-schedule": "2.1.0",
|
||||
"@types/uuid": "^9.0.1",
|
||||
"@typescript-eslint/eslint-plugin": "^5.46.1",
|
||||
"@typescript-eslint/parser": "^5.46.1",
|
||||
"eslint": "^8.29.0",
|
||||
"eslint-config-prettier": "^8.8.0",
|
||||
"@semantic-release/release-notes-generator": "^12.1.0",
|
||||
"@types/chance": "1.1.6",
|
||||
"@types/node-schedule": "2.1.7",
|
||||
"@types/uuid": "^10.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "^8.18.0",
|
||||
"@typescript-eslint/parser": "^8.18.0",
|
||||
"eslint": "^9.16.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-import": "^2.27.5",
|
||||
"eslint-plugin-no-loops": "0.3.0",
|
||||
"eslint-plugin-prettier": "4.2.1",
|
||||
"lint-staged": "^13.2.2",
|
||||
"nodemon": "^2.0.22",
|
||||
"prettier": "^2.8.8",
|
||||
"prisma": "^4.9.0",
|
||||
"semantic-release": "^21.0.0",
|
||||
"eslint-plugin-no-loops": "0.4.0",
|
||||
"eslint-plugin-prettier": "5.2.1",
|
||||
"lint-staged": "^15.2.11",
|
||||
"nodemon": "^3.1.7",
|
||||
"prettier": "^3.4.2",
|
||||
"prisma": "^6.0.1",
|
||||
"semantic-release": "^22.0.12",
|
||||
"typescript": "^5.0.4"
|
||||
},
|
||||
"lint-staged": {
|
||||
|
|
|
@ -62,6 +62,8 @@ export const execute = async (interaction: ChatInputCommandInteraction) => {
|
|||
|
||||
await sendResponse(interaction, { embeds: [embed] });
|
||||
|
||||
const cooldownDuration = 4 * 7 * 24 * 60 * 60; // 1 month in seconds
|
||||
const cooldownName = await generateCooldownName(interaction);
|
||||
await cooldownManager.setCooldown(
|
||||
await generateCooldownName(interaction),
|
||||
guild,
|
||||
|
|
|
@ -57,6 +57,8 @@ export const execute = async (interaction: ChatInputCommandInteraction) => {
|
|||
|
||||
await sendResponse(interaction, { embeds: [embed] });
|
||||
|
||||
const cooldownDuration = 7 * 24 * 60 * 60; // 1 week in seconds
|
||||
const cooldownName = await generateCooldownName(interaction);
|
||||
await cooldownManager.setCooldown(
|
||||
await generateCooldownName(interaction),
|
||||
guild,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import {
|
||||
CommandInteraction,
|
||||
ChatInputCommandInteraction,
|
||||
EmbedBuilder,
|
||||
SlashCommandSubcommandBuilder,
|
||||
SlashCommandSubcommandBuilder
|
||||
} from "discord.js";
|
||||
import deferReply from "../../../../utils/deferReply";
|
||||
import sendResponse from "../../../../utils/sendResponse";
|
||||
|
@ -17,7 +17,7 @@ export const builder = (command: SlashCommandSubcommandBuilder) => {
|
|||
);
|
||||
};
|
||||
|
||||
export const execute = async (interaction: CommandInteraction) => {
|
||||
export const execute = async (interaction: ChatInputCommandInteraction) => {
|
||||
const { options, user } = interaction;
|
||||
|
||||
await deferReply(interaction, false);
|
||||
|
|
|
@ -31,10 +31,12 @@ export default async (message: Message) => {
|
|||
};
|
||||
|
||||
if (message.author.bot) return;
|
||||
if (message.channel.type != ChannelType.GuildText) return;
|
||||
|
||||
const checkTime = 5 * 1000; // Milliseconds
|
||||
const maxMessageAmount = 3; // Anti Spam Rule, remove 1 credit per message above this value during "checkTime" variable
|
||||
const amount = 1; //Amount to give if valid
|
||||
|
||||
const penaltyAmount = 2; //Amount to take if invalid
|
||||
|
||||
await message.channel
|
||||
|
|
Loading…
Add table
Reference in a new issue