Skip to content

Commit

Permalink
Merge pull request #113 from utarwyn/release/2.x
Browse files Browse the repository at this point in the history
Release 2.2.0
  • Loading branch information
utarwyn authored Dec 4, 2021
2 parents ce310c9 + 6adfaf2 commit c526a21
Show file tree
Hide file tree
Showing 62 changed files with 5,409 additions and 787 deletions.
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
!config/locales
!src
!package.json
!package-lock.json
!.yarnclean
!yarn.lock
!tsconfig.json
!tsconfig.release.json
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-unused-vars": ["warn", { "argsIgnorePattern": "^_" }],
"@typescript-eslint/no-var-requires": "off"
}
}
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
time: "04:00"
open-pull-requests-limit: 10
reviewers:
- utarwyn
ignore:
- dependency-name: "@types/node"
8 changes: 4 additions & 4 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Install dependencies
run: npm install
run: yarn install
- name: Check formatting
run: npm run format:check
run: yarn format:check
- name: Lint
run: npm run lint
run: yarn lint
- name: Test
run: npm run test
run: yarn test
51 changes: 51 additions & 0 deletions .github/workflows/publish_docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Docker Image Build and Push

on:
push:
branches: [master, next]
tags: ['v*.*.*']

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: |
utarwyn/discord-tictactoe
ghcr.io/utarwyn/discord-tictactoe
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GHCR
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
34 changes: 26 additions & 8 deletions .github/workflows/publish_npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,34 @@ on:
types: [published]

jobs:
build:
npm-js:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
registry-url: https://registry.npmjs.org/
- run: npm install
- run: npm run release
node-version: '14.x'
registry-url: 'https://registry.npmjs.org'
- run: yarn install
- run: yarn release
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

npm-github:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14.x'
registry-url: 'https://npm.pkg.github.com'
scope: '@utarwyn'
- run: yarn install
- run: yarn release
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.15.4
14.17.0
46 changes: 46 additions & 0 deletions .yarnclean
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# test directories
__tests__
test
tests
powered-test

# asset directories
docs
doc
website
images
assets

# examples
example
examples

# code coverage directories
coverage
.nyc_output
!istanbul-reports/lib/html/assets

# build scripts
Makefile
Gulpfile.js
Gruntfile.js

# configs
appveyor.yml
circle.yml
codeship-services.yml
codeship-steps.yml
wercker.yml
.tern-project
.gitattributes
.editorconfig
.*ignore
.eslintrc
.jshintrc
.flowconfig
.documentup.json
.yarn-metadata.json
.travis.yml

# misc
*.md
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ WORKDIR /app
FROM base as build

COPY --chown=node:node . /app
RUN npm install --silent
RUN npm run build
RUN yarn install --silent --pure-lockfile && yarn build && rm -rf node_modules && yarn install --production --silent --pure-lockfile && yarn cache clean

####################################################################################################

Expand All @@ -20,4 +19,4 @@ COPY --from=build --chown=node:node /app .

USER node
ENV NODE_ENV=production
CMD ["npm", "run", "serve"]
CMD ["yarn", "serve"]
39 changes: 22 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ Created with <a href="https://github.com/discordjs/discord.js">discord.js</a>.
</h4>

<p align="center">
<a href="https://github.com/utarwyn/discord-tictactoe/actions">
<img src="https://github.com/utarwyn/discord-tictactoe/workflows/Node.js%20CI/badge.svg" alt="Node.js CI">
</a>
<a href="https://hub.docker.com/r/utarwyn/discord-tictactoe">
<img src="https://img.shields.io/docker/cloud/build/utarwyn/discord-tictactoe" alt="Docker Build status">
</a>
<a href="https://github.com/utarwyn/discord-tictactoe/releases">
<img src="https://img.shields.io/github/package-json/v/utarwyn/discord-tictactoe" alt="Npm version">
</a>
<a href="https://github.com/utarwyn/discord-tictactoe/blob/master/LICENSE">
<img src="https://img.shields.io/github/license/utarwyn/discord-tictactoe" alt="License">
</a>
<a href="https://sonarcloud.io/dashboard?id=utarwyn_discord-tictactoe">
<img src="https://sonarcloud.io/api/project_badges/measure?project=utarwyn_discord-tictactoe&metric=alert_status" alt="Quality Gate Status">
</a>
<a href="https://npmjs.com/package/discord-tictactoe">
<img alt="npm" src="https://img.shields.io/npm/v/discord-tictactoe">
</a>
<a href="https://hub.docker.com/r/utarwyn/discord-tictactoe">
<img src="https://img.shields.io/github/workflow/status/utarwyn/discord-tictactoe/Docker%20Image%20Build%20and%20Push?label=docker%20build" alt="Docker Build status">
</a>
<a href="https://github.com/utarwyn/discord-tictactoe/blob/master/LICENSE">
<img src="https://img.shields.io/github/license/utarwyn/discord-tictactoe" alt="License">
</a>
</p>

<p align="center">
Expand All @@ -31,20 +31,18 @@ Works **out-of-the-box**, no configuration needed.

If you have a problem when using the bot, or you want to propose a new feature, feel free to open an issue.

Have fun!

> A **SaaS-based bot** (hosted solution) is under consideration. More info soon!
Have fun! 🥳

Installation
------------

Before installing the bot, you need to create your own [Discord Application][6].
Then, you can install the bot via Docker or npm (check below!). If you are not a programmer, I recommend you to opt for Docker because its the simplest solution.
Then, you can install the bot via Docker or npm (check below!). If you are not a programmer, I recommend you to opt for Docker because its the easiest solution.

The bot works **out-of-the-box**. Otherwise if you want to configure it, check [config.example.json][7] file in the config folder.
Create a file called `config.json` to change default options.

> :warning: Check that your Discord bot has these permissions in all channels where games can be played:\
> ⚠️ Make sure your Discord bot has these permissions in all channels where games can be played:\
> *"Add reactions", "Manage messages", "Read message history", "Send messages", "View channel"*
Running via Docker
Expand Down Expand Up @@ -99,6 +97,12 @@ Running via Node.js
client.login('YOUR_BOT_TOKEN');
```

Using slash command ✨
--------

Want to play TicTacToe with a slash command?\
Follow [this detailed guide][8] to configure the module to use it! **(you must use version 2.2+)**

License
--------

Expand All @@ -115,3 +119,4 @@ License
[5]: https://twitter.com/Utarwyn
[6]: https://discordapp.com/developers/applications
[7]: https://github.com/utarwyn/discord-tictactoe/blob/next/config/config.example.json
[8]: https://github.com/utarwyn/discord-tictactoe/wiki/Using-slash-command
6 changes: 5 additions & 1 deletion config/config.example.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
"token": "YOUR_BOT_USER_TOKEN",
"language": "en",
"command": "!ttt",
"slashCommand": "tictactoe",
"allowedChannelIds": [],
"allowedRoleIds": [],
"requestExpireTime": 60,
"requestCooldownTime": 0,
"simultaneousGames": false,
"gameExpireTime": 30,
"gameBoardDelete": false
"gameBoardDelete": false,
"gameBoardEmojies": []
}
4 changes: 4 additions & 0 deletions config/locales/de.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"command": {
"description": "Play a game of TicTacToe",
"option-user": "User you want to play with"
},
"duel": {
"title": ":crossed_swords: Neues Duell",
"challenge": "{invited} fordert **{initier}** zu einem Duell heraus!",
Expand Down
4 changes: 4 additions & 0 deletions config/locales/en.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"command": {
"description": "Play a game of TicTacToe",
"option-user": "User you want to play with"
},
"duel": {
"title": ":crossed_swords: New duel challenge",
"challenge": "{invited}, **{initier}** challenged you to a duel!",
Expand Down
4 changes: 4 additions & 0 deletions config/locales/es.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"command": {
"description": "Play a game of TicTacToe",
"option-user": "User you want to play with"
},
"duel": {
"title": ":crossed_swords: Nuevo desafío de duelo",
"challenge": "{invited}, **{initier}** te desafió a un duelo!",
Expand Down
4 changes: 4 additions & 0 deletions config/locales/fr.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"command": {
"description": "Jouer une partie de TicTacToe",
"option-user": "Membre avec lequel vous voulez jouer"
},
"duel": {
"title": ":crossed_swords: Demande de duel",
"challenge": "{invited}, **{initier}** souhaite te défier au morpion !",
Expand Down
4 changes: 4 additions & 0 deletions config/locales/it.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"command": {
"description": "Play a game of TicTacToe",
"option-user": "User you want to play with"
},
"duel": {
"title": ":crossed_swords: Sfida a tris",
"challenge": "{invited}, **{initier}** ti ha sfidato ad un duello!",
Expand Down
24 changes: 24 additions & 0 deletions config/locales/nl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"command": {
"description": "Play a game of TicTacToe",
"option-user": "User you want to play with"
},
"duel": {
"title": ":crossed_swords: Nieuwe spel uitdaging!",
"challenge": "{invited}, **{initier}** daagt je uit voor een spel!",
"action": "Reageer op dit bericht om het spel te accepteren of te weigeren.",
"expire": ":x: `{invited}` heeft te laat gereageerd!",
"reject": ":x: `{invited}` heeft het spel geweigerd!",
"unknown-user": "Je kan dit lid niet uitdagen!"
},
"game": {
"title": ":game_die: `{player1}` **VS** `{player2}`",
"action": "{player}, het is jouw beurt:",
"load": "Reacties worden geladen, eventjes geduld...",
"end": "Gelijk spel! Niemand heeft gewonnen! Nog een keer?",
"win": ":tada: {player} heeft gewonnen!",
"expire": ":x: Het spel is **verlopen**... Misschien is iemand niet actief?",
"waiting-ai": ":robot: De AI is aan het spelen, eventjes geduld...",
"ai": "AI"
}
}
24 changes: 24 additions & 0 deletions config/locales/pl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"command": {
"description": "Play a game of TicTacToe",
"option-user": "User you want to play with"
},
"duel": {
"title": ":crossed_swords: Nowy pojedynek",
"challenge": "{invited}, **{initier}** wyzwał cię na pojedynek!",
"action": "Zareaguj odpowiednią emotką do tej wiadomości, aby zaakceptować lub odrzucić zaproszenie.",
"expire": ":x: `{invited}` nie odpowiedział na zaproszenie do pojedynku.",
"reject": ":x: `{invited}` odrzucił zaproszenie do pojedynku.",
"unknown-user": "nie możesz wyzwać na pojedynek tego użytkownika."
},
"game": {
"title": ":game_die: `{player1}` **VS** `{player2}`",
"action": "{player}, wybierz swój ruch:",
"load": "Reakcje się ładują, proszę czekać...",
"end": "Remis! Nikt nie wygrał. Może spróbujcie jeszcze raz?",
"win": ":tada: {player} wygrał grę w kółko i krzyżyk!",
"expire": ":x: Gra **wygasła**... Może przez nieaktywność któregoś z graczy?",
"waiting-ai": ":robot: Trwa ruch Sztucznej Inteligencji, proszę czekać...",
"ai": "Sztuczna Inteligencja"
}
}
4 changes: 4 additions & 0 deletions config/locales/pt-br.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"command": {
"description": "Play a game of TicTacToe",
"option-user": "User you want to play with"
},
"duel": {
"title": ":crossed_swords: Novo duelo",
"challenge": "{invited}, **{initier}** te desafiou para um duelo!",
Expand Down
Loading

0 comments on commit c526a21

Please sign in to comment.