Skip to content
This repository has been archived by the owner on Nov 11, 2024. It is now read-only.

Commit

Permalink
chore: adapt from @stegripe/template and more
Browse files Browse the repository at this point in the history
  • Loading branch information
mzrtamp committed Jul 21, 2024
1 parent b94a98d commit 69aa18d
Show file tree
Hide file tree
Showing 18 changed files with 61 additions and 55 deletions.
4 changes: 2 additions & 2 deletions .env_example → .env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#==============================================================================
# IMPORTANT - What is the name of your bot?
# Example: BOT_NAME="Stegripe WhatsApp Bot"
# Default: Stegripe WhatsApp Bot
# Example: BOT_NAME="Bajigur"
# Default: Bajigur
BOT_NAME="Bajigur"

#==============================================================================
Expand Down
6 changes: 3 additions & 3 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
github: [clytage, ZenShibata]
patreon: clytage
custom: ["https://clytage.org/donate"]
github: [stegripe]
patreon: stegripe
custom: ["https://stegripe.org/donate"]
2 changes: 1 addition & 1 deletion .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["github>clytage/renovate-config"]
"extends": ["github>stegripe/renovate-config"]
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build & Push Docker Image to container image registry
name: Build and Push Docker Image to the container image registry

on:
release:
Expand All @@ -14,5 +14,5 @@ on:

jobs:
docker:
uses: stegripe/workflows/.github/workflows/docker-build.yml@main
uses: stegripe/workflows/.github/workflows/docker-build-and-push.yaml@main
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/test.yml → .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ on:

jobs:
test:
uses: stegripe/workflows/.github/workflows/pnpm-lint-and-test.yml@main
uses: stegripe/workflows/.github/workflows/pnpm-lint-and-test.yaml@main
secrets: inherit
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"typescript.tsdk": "node_modules/typescript/lib",
"files.eol": "\n",
"npm.packageManager": "npm",
"files.eol": "\n"
}
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ RUN pnpm prune --production
FROM ghcr.io/hazmi35/node:21-alpine

LABEL name "bajigur"
LABEL maintainer "Stegripe <admin@stegripe.org>"
LABEL maintainer "Stegripe Development <support@stegripe.org>"

# Install ffmpeg
RUN apk add --no-cache ffmpeg
Expand All @@ -42,4 +42,4 @@ ENV NODE_ENV production
VOLUME /app/auth_state

# Start the app with node
CMD ["node", "dist/index.js"]
CMD ["node", "dist/index.js"]
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# WhatsApp Bot
# Bajigur

> A simple and easy-to-use WhatsApp bot project, written in TypeScript.
<img src="https://badgen.net/badge/icon/typescript?icon=typescript&label">
<a href="https://github.com/clytage/whatsapp-bot/actions?query=workflow%3A%22Lint+code+and+compile+setup+script%22"><img src="https://github.com/clytage/whatsapp-bot/workflows/Lint%20code%20and%20compile%20setup%20script/badge.svg" alt="CI Status" /></a>
<a href="https://github.com/stegripe/bajugur/actions?query=workflow%3A%22Lint+code+and+compile+setup+script%22"><img src="https://github.com/stegripe/bajigur/workflows/Lint%20code%20and%20compile%20setup%20script/badge.svg" alt="CI Status" /></a>

## Features
- Easy to use.
Expand Down
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,18 @@
"name": "bajigur",
"version": "1.5.5",
"description": "A simple and easy-to-use WhatsApp bot project, written in TypeScript.",
"homepage": "https://github.com/stegripe/bajigur#readme",
"bugs": {
"url": "https://github.com/stegripe/bajigur/issues"
},
"license": "AGPL-3.0",
"author": "Stegripe Development <[email protected]>",
"repository": {
"type": "git",
"url": "git+https://github.com/stegripe/bajigur.git"
},
"license": "AGPL-3.0",
"author": "Stegripe <[email protected]>",
"type": "module",
"imports": {
"#bajigur/*": "./dist/*"
"bugs": {
"url": "https://github.com/stegripe/bajigur/issues"
},
"homepage": "https://github.com/stegripe/bajigur#readme",
"main": "dist",
"type": "module",
"scripts": {
"build": "rimraf dist && npm run lint && npm run compile",
"compile": "swc src -d dist --strip-leading-paths",
Expand All @@ -28,6 +25,13 @@
"start": "node --env-file=.env .",
"start:dev": "rimraf dist && set NODE_ENV=development && tsc-watch --onSuccess \"pnpm start\""
},
"engines": {
"node": ">=20",
"npm": ">=10"
},
"imports": {
"#bajigur/*": "./dist/*"
},
"prettier": {
"arrowParens": "avoid",
"printWidth": 100,
Expand Down Expand Up @@ -80,9 +84,5 @@
"ts-node": "10.9.2",
"tsc-watch": "^6.2.0",
"typescript": "5.5.3"
},
"engines": {
"node": ">=20",
"npm": ">=10"
}
}
}
2 changes: 1 addition & 1 deletion src/commands/general/HelpCommand.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BOT_NAME, PREFIX } from "#bajigur/config.js";
import ApplyMetadata from "#bajigur/decorators/ApplyMetadata.js";
import { BOT_NAME, PREFIX } from "#bajigur/config.js";
import Command from "#bajigur/structures/Command.js";
import { ICommand } from "#bajigur/types/index.js";
import { WAProto } from "@whiskeysockets/baileys";
Expand Down
2 changes: 1 addition & 1 deletion src/commands/general/PingCommand.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import ApplyMetadata from "#bajigur/decorators/ApplyMetadata.js";
import Command from "#bajigur/structures/Command.js";
import { ICommand } from "#bajigur/types/index.js";
import { cast } from "@sapphire/utilities";
import { WAProto } from "@whiskeysockets/baileys";
import { cast } from "@sapphire/utilities";

@ApplyMetadata<ICommand>({
name: "ping",
Expand Down
2 changes: 1 addition & 1 deletion src/commands/general/StickerCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { ICommand } from "#bajigur/types/index.js";
import GetMediaTypeFromBuffer from "#bajigur/utils/GetMediaTypeFromBuffer.js";
import { WAProto, downloadMediaMessage } from "@whiskeysockets/baileys";
import { unlinkSync, writeFileSync } from "fs";
import { join } from "path";
import { createSticker } from "wa-sticker";
import { join } from "path";

@ApplyMetadata<ICommand>({
name: "sticker",
Expand Down
4 changes: 2 additions & 2 deletions src/listeners/ConnectionUpdateListener.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import ApplyMetadata from "#bajigur/decorators/ApplyMetadata.js";
import Listener from "#bajigur/structures/Listener.js";
import { IListener } from "#bajigur/types/index.js";
import { Boom } from "@hapi/boom";
import { cast } from "@sapphire/utilities";
import { BaileysEventMap, DisconnectReason } from "@whiskeysockets/baileys";
import { cast } from "@sapphire/utilities";
import { Boom } from "@hapi/boom";
import { rmSync } from "node:fs";

@ApplyMetadata<IListener>({
Expand Down
2 changes: 1 addition & 1 deletion src/listeners/MessageUpsertListener.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PREFIX } from "#bajigur/config.js";
import ApplyMetadata from "#bajigur/decorators/ApplyMetadata.js";
import Listener from "#bajigur/structures/Listener.js";
import { IListener } from "#bajigur/types/index.js";
import { PREFIX } from "#bajigur/config.js";
import { BaileysEventMap } from "@whiskeysockets/baileys";

@ApplyMetadata<IListener>({
Expand Down
14 changes: 5 additions & 9 deletions src/structures/BajigurClient.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import { ISDEV } from "#bajigur/config.js";
import ImportURLToString from "#bajigur/utils/ImportURLToString.js";
import {
makeCacheableSignalKeyStore,
makeWASocket,
useMultiFileAuthState
} from "@whiskeysockets/baileys";
import { resolve } from "path";
import { Logger, pino } from "pino";
import { CommandHandler } from "./Command.js";
import { ISDEV } from "#bajigur/config.js";
import { ListenerHandler } from "./Listener.js";
import { CommandHandler } from "./Command.js";
import { makeCacheableSignalKeyStore, makeWASocket, useMultiFileAuthState } from "@whiskeysockets/baileys";
import { Logger, pino } from "pino";
import { resolve } from "path";

export default class BajigurClient {
public socket?: ReturnType<typeof makeWASocket>;
Expand Down
6 changes: 3 additions & 3 deletions src/structures/Command.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import ReadDirRecursive from "#bajigur/utils/ReadDirRecursive.js";
import { DEVS, ISDEV, PREFIX } from "#bajigur/config.js";
import { ICommand } from "#bajigur/types/index.js";
import ImportClass from "#bajigur/utils/ImportClass.js";
import ReadDirRecursive from "#bajigur/utils/ReadDirRecursive.js";
import { ICommand } from "#bajigur/types/index.js";
import BajigurClient from "./BajigurClient.js";
import { Collection } from "@discordjs/collection";
import { mergeDefault } from "@sapphire/utilities";
import { WAProto } from "@whiskeysockets/baileys";
import { resolve } from "node:path";
import BajigurClient from "./BajigurClient.js";

export default abstract class Command implements ICommand {
public constructor(
Expand Down
8 changes: 4 additions & 4 deletions src/structures/Listener.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { IListener } from "#bajigur/types/index.js";
import importClass from "#bajigur/utils/ImportClass.js";
import readdirRecursive from "#bajigur/utils/ReadDirRecursive.js";
import { Collection } from "@discordjs/collection";
import importClass from "#bajigur/utils/ImportClass.js";
import { IListener } from "#bajigur/types/index.js";
import BajigurClient from "./BajigurClient.js";
import { BaileysEvent, BaileysEventMap } from "@whiskeysockets/baileys";
import { Collection } from "@discordjs/collection";
import { resolve } from "path";
import BajigurClient from "./BajigurClient.js";

export default abstract class Listener implements IListener {
public constructor(
Expand Down
20 changes: 15 additions & 5 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"target": "ES2022",
"module": "Node16",
"moduleResolution": "Node16",
"lib": ["ES2022"],
"lib": [
"ES2022"
],
"strict": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
Expand All @@ -12,14 +14,22 @@
"skipLibCheck": true,
"noEmitHelpers": true,
"importHelpers": true,
"rootDir": "src",
"outDir": "dist",
"rootDir": "src",
"baseUrl": "src",
"typeRoots": ["node_modules/@types", "src/types"],
"typeRoots": [
"node_modules/@types",
"src/types"
],
"paths": {
"#bajigur/*": ["*"]
}
},
"exclude": ["node_modules/**", "**/.*/"],
"include": ["src/**/*.ts"]
"include": [
"src/**/*.ts"
],
"exclude": [
"node_modules/**",
"**/.*/"
]
}

0 comments on commit 69aa18d

Please sign in to comment.