Skip to content

Commit

Permalink
encoder tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
danielguirra committed Mar 21, 2024
1 parent ce81196 commit 81fd627
Show file tree
Hide file tree
Showing 56 changed files with 326 additions and 293 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
node_modules
npm-debug.log
docker-compose.yml
yarn.lock
Procfile
.eslintrc.js
Expand Down
5 changes: 0 additions & 5 deletions .envexemple

This file was deleted.

5 changes: 5 additions & 0 deletions .envexemple.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"BOTTOKEN": "",
"TENORKEY": "",
"HGTOKEN": ""
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
!.yarn/cache
#.pnp.*
bin
docker-compose.yml
.vscode
dist
.env
envs.json
Expand Down
3 changes: 0 additions & 3 deletions .vscode/settings.json

This file was deleted.

29 changes: 20 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,27 @@ Token TenorGif [Offical TenorApi website](https://tenor.com/gifapi)

NodeJS

- #### Windows
- #### Windows

[Official Node.js website](https://nodejs.org/) and download the installer.
[Official Node.js website](https://nodejs.org/) and download the installer.

- #### Node installation on Ubuntu
- #### Node installation on Ubuntu

$ sudo apt install nodejs
$ sudo apt install npm
$ sudo apt install nodejs
$ sudo apt install npm

- #### Other Operating Systems
You can find more information about the installation on the [official Node.js website](https://nodejs.org/) and the [official NPM website](https://npmjs.org/).
- #### Other Operating Systems
You can find more information about the installation on the [official Node.js website](https://nodejs.org/) and the [official NPM website](https://npmjs.org/).

---

I used this version of NodeJS, I don't guarantee it will work on older versions

$ node --version
v16.16.0
v20.11.1

$ npm --version
v8.15.1
v10.2.4

## Deploy

Expand Down Expand Up @@ -74,6 +74,17 @@ You can deploy to Heroku or Replit or install locally yourself.
$ yarn dev
$ npm run dev

## Can't Use Sure Docker or Docker Compose

#### Docker

$ docker build . --f ./Dockerfile --tag ts-bot-image
$ docker run -p 4040:4040 --name ts-bot ts-bot-image

#### Compose

$ docker-compose -up -d

## License

[MIT](https://choosealicense.com/licenses/mit/)
File renamed without changes.
10 changes: 10 additions & 0 deletions docke-compose.exemple.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: '3'

services:
ts-bot:
image: ts-bot-image
container_name: ts-bot
ports:
- '4040:4040'
restart: always
command: node ./dist/src/server.js
198 changes: 0 additions & 198 deletions googleImage/index.ts

This file was deleted.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "ts-bot",
"version": "1.0",
"version": "1.1",
"icon": "https://cdn.discordapp.com/avatars/811255307673010246/8f145d7279847a9a6e46efd5ee3df6bf.webp",
"repository": "https://github.com/danielguirra/ts-bot",
"description": "DiscordBot in TypeScript",
"license": "MIT",
"author": "Daniel Guirra <[email protected]>",
"scripts": {
"build": "node ./build.js",
"build": "node ./util/build.js",
"dev": "npx nodemon ./src/server.ts",
"start": "node ./build && node ./dist/src/server.js",
"start": "npm run build && node ./dist/src/server.js",
"test": "node --import tsx --test ./test/comand.spec.ts",
"startnotbuild": "npx ts-node ./src/server.ts",
"commandCreator": "node ./util/commandBaseTs/commandCreatorForName.js"
Expand Down Expand Up @@ -44,4 +44,4 @@
"nodemon": "^2.0.13",
"ts-node": "^10.9.2"
}
}
}
19 changes: 1 addition & 18 deletions src/command/Builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,7 @@ import {
} from 'discord.js';

import { allComands } from './allComands';

export class Command {
constructor(comm: Command) {
Object.assign(this, comm);
}

data!:
| SlashCommandBuilder
| Omit<SlashCommandBuilder, 'addSubcommand' | 'addSubcommandGroup'>;
executeMessageCommand!: (
message: Message
) => Promise<Message<boolean> | void | undefined>;
executeSlashCommand!: (
commandSlash: CommandInteraction
) => Promise<
void | Message<boolean> | InteractionResponse<boolean> | undefined
>;
}
import { Command } from '../interfaces/Command';

export const commands = new Collection() as Collection<string, Command>;

Expand Down
2 changes: 1 addition & 1 deletion src/command/commandAdvice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {

import { embedBuilder } from '../../src/util/getEmbed';
import { translateText } from '../util/translate';
import { Command } from './Builder';
import { Command } from '../interfaces/Command';

/**
* Don't forget to export
Expand Down
2 changes: 1 addition & 1 deletion src/command/commandAllSkinsOfChampLol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
SlashCommandBuilder,
} from 'discord.js';

import { Command } from './Builder';
import { Command } from '../interfaces/Command';

/**
* Don't forget to export
Expand Down
2 changes: 1 addition & 1 deletion src/command/commandAvatar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
SlashCommandBuilder,
} from 'discord.js';

import { Command } from './Builder';
import { Command } from '../interfaces/Command';

/**
* Don't forget to export
Expand Down
2 changes: 1 addition & 1 deletion src/command/commandBan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
User,
} from 'discord.js';

import { Command } from './Builder';
import { Command } from '../interfaces/Command';

/**
* Don't forget to export
Expand Down
Loading

0 comments on commit 81fd627

Please sign in to comment.