Skip to content

Commit

Permalink
Merge branch 'beta'
Browse files Browse the repository at this point in the history
  • Loading branch information
ptkdev committed Nov 10, 2022
2 parents dac6455 + cca69ce commit d0c062c
Show file tree
Hide file tree
Showing 38 changed files with 3,562 additions and 4,630 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Expand Up @@ -12,4 +12,8 @@ indent_size = 4

[*.py]
indent_style = space
indent_size = 4

[*.yml]
indent_style = space
indent_size = 4
7 changes: 4 additions & 3 deletions .github/workflows/beta.yml
Expand Up @@ -6,7 +6,7 @@ on:
jobs:
build:
runs-on: ubuntu-latest
if: "!startsWith(github.event.head_commit.message, '[🚀 Release]')"
if: "!startsWith(github.event.head_commit.message, '[🚀 Release Beta]')"
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -19,10 +19,11 @@ jobs:
- run: git config --global user.email 'support@ptkdev.io'
- run: npm ci
- run: npm run github-workflow-next-version -- --cmd beta
- run: npm run release
- run: npm run pre-commit
- id: pkgjson
run: chmod +x ./scripts/version.sh && ./scripts/version.sh
- run: git add . && git commit -m "[🚀 Release] v${{ steps.pkgjson.outputs.pkgversion }}" && git push
- run: git add . && git commit -m "[🚀 Release Beta] v${{ steps.pkgjson.outputs.pkgversion }}" && git push
- run: npm publish --tag beta
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand All @@ -31,4 +32,4 @@ jobs:
- run: npm run pre-commit
- id: nextnightly
run: chmod +x ./scripts/version.sh && ./scripts/version.sh
- run: git add . && git commit -m "[🚀 Release] v${{ steps.nextnightly.outputs.pkgversion }}" && git push
- run: git add . && git commit -m "[🚀 Release Nightly] v${{ steps.nextnightly.outputs.pkgversion }}" && git push
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Expand Up @@ -6,6 +6,7 @@ on:
jobs:
build:
runs-on: ubuntu-latest
if: "!startsWith(github.event.head_commit.message, '[🚀 Release]')"
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -18,6 +19,7 @@ jobs:
- run: git config --global user.email 'support@ptkdev.io'
- run: npm ci
- run: npm run github-workflow-next-version -- --cmd main
- run: npm run release
- run: npm run pre-commit
- id: pkgjson
run: chmod +x ./scripts/version.sh && ./scripts/version.sh
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/nightly.yml
Expand Up @@ -2,13 +2,10 @@ name: Release Nightly
on:
schedule:
- cron: "30 23 * * *"
push:
branches:
- nightly
jobs:
build:
runs-on: ubuntu-latest
if: "!startsWith(github.event.head_commit.message, '[🚀 Release]') || startsWith(github.event.head_commit.message, '[🚀 Release] Nightly')"
if: "!startsWith(github.event.head_commit.message, '[🚀 Release Nightly]')"
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -22,10 +19,12 @@ jobs:
- run: git config --global user.email 'support@ptkdev.io'
- run: npm ci
- run: npm run github-workflow-next-version -- --cmd nightly
- run: npm run pkg-upgrade
- run: npm run release
- run: npm run pre-commit
- id: pkgjson
run: chmod +x ./scripts/version.sh && ./scripts/version.sh
- run: git add . && git commit -m "[🚀 Release] v${{ steps.pkgjson.outputs.pkgversion }}" && git push
- run: git add . && git commit -m "[🚀 Release Nightly] v${{ steps.pkgjson.outputs.pkgversion }}" && git push
- run: npm publish --tag nightly
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
21 changes: 21 additions & 0 deletions .github/workflows/release.yml
@@ -0,0 +1,21 @@
name: Try Release
on:
push:
branches:
- nightly
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.GIT_TOKEN }}
ref: nightly
- uses: actions/setup-node@v2
with:
node-version: "16.x"
registry-url: "https://registry.npmjs.org"
- run: git config --global user.name 'Patryk Rzucidlo (@PTKDev)'
- run: git config --global user.email 'support@ptkdev.io'
- run: npm ci
- run: npm run release
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -121,6 +121,7 @@ npm-debug.log

# App #
#######
.env
/app/configs/config.js
/app/configs/config.ts
/app/configs/config.json
Expand Down
1 change: 0 additions & 1 deletion .npmignore
@@ -1,5 +1,4 @@
**/*
|.github
!/extra/**/*
!*.d.ts
!*.md
Expand Down
10 changes: 7 additions & 3 deletions CHANGELOG.md
@@ -1,14 +1,18 @@
# v0.7.2 (January 10, 2022)
# v0.7.3 (November 07, 2022)

- Fix: now split with two HASHTAGS (##), not with MINUS sign (-)
- Feature: TOP10 yearly
- Fix: Telegram Topics

<!-- all-shields/sponsors-badges:START -->

[![Donate Paypal](https://img.shields.io/badge/donate-paypal-005EA6.svg?style=for-the-badge&logo=paypal)](https://www.paypal.me/ptkdev) [![Donate Ko-Fi](https://img.shields.io/badge/donate-ko--fi-29abe0.svg?style=for-the-badge&logo=ko-fi)](https://ko-fi.com/ptkdev) [![Donate Github Sponsors](https://img.shields.io/badge/donate-sponsors-ea4aaa.svg?style=for-the-badge&logo=github)](https://github.com/sponsors/ptkdev) [![Donate Patreon](https://img.shields.io/badge/donate-patreon-F87668.svg?style=for-the-badge&logo=patreon)](https://www.patreon.com/join/ptkdev) [![Donate Bitcoin](https://img.shields.io/badge/BTC-35jQmZCy4nsxoMM3QPFrnZePDVhdKaHMRH-E38B29.svg?style=flat-square&logo=bitcoin)](https://ptk.dev/img/icons/menu/bitcoin_wallet.png) [![Donate Ethereum](https://img.shields.io/badge/ETH-0x8b8171661bEb032828e82baBb0B5B98Ba8fBEBFc-4E8EE9.svg?style=flat-square&logo=ethereum)](https://ptk.dev/img/icons/menu/ethereum_wallet.png)

<!-- all-shields/sponsors-badges:END -->

# v0.7.2 (January 10, 2022)

- Fix: now split with two HASHTAGS (##), not with MINUS sign (-)
- Feature: TOP10 yearly

# v0.6.0 (November 24, 2021)

- Refactor: No Any
Expand Down
4 changes: 2 additions & 2 deletions LICENSE.md
Expand Up @@ -28,7 +28,7 @@ SOFTWARE.

> Images, assets and logos
Copyleft (c) 2021 Patryk Rzucidło (PTKDev)
Copyleft (c) 2022 Patryk Rzucidło (PTKDev)

#### You are free to:

Expand All @@ -50,7 +50,7 @@ No additional restrictions — You may not apply legal terms or technological me

> Documentation and Translations
Copyleft (c) 2021 Patryk Rzucidło (PTKDev)
Copyleft (c) 2022 Patryk Rzucidło (PTKDev)

#### You are free to:

Expand Down
22 changes: 12 additions & 10 deletions README.md
Expand Up @@ -2,7 +2,7 @@

<!-- all-shields/header-badges:START -->

[![v0.7.2](https://img.shields.io/badge/version-v0.7.2-lightgray.svg?style=flat&logo=)](https://github.com/ptkdev/quizquickanswer-telegram-game-bot/blob/main/CHANGELOG.md) [![](https://img.shields.io/npm/v/@ptkdev/quizquickanswer-telegram-game-bot?color=CC3534&logo=npm)](https://www.npmjs.com/package/@ptkdev/quizquickanswer-telegram-game-bot) [![License: MIT](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat&logo=license)](https://github.com/ptkdev/quizquickanswer-telegram-game-bot/blob/main/LICENSE.md) [![Language: TypeScript](https://img.shields.io/badge/language-typescript-blue.svg?style=flat&logo=typescript)](https://www.typescriptlang.org/) [![Framework: Grammy](https://img.shields.io/badge/powered%20by-grammy-009dca.svg?style=flat&logo=telegram)](https://grammy.dev/) [![ECMAScript: 2019](https://img.shields.io/badge/ES-9-F7DF1E.svg?style=flat&logo=javascript)](https://github.com/tc39/ecma262) [![Discord Server](https://discordapp.com/api/guilds/383373985666301975/embed.png)](https://discord.ptkdev.io)
[![v0.7.3-beta.1](https://img.shields.io/badge/version-v0.7.3--beta.1-lightgray.svg?style=flat&logo=)](https://github.com/ptkdev/quizquickanswer-telegram-game-bot/blob/main/CHANGELOG.md) [![](https://img.shields.io/npm/v/@ptkdev/quizquickanswer-telegram-game-bot?color=CC3534&logo=npm)](https://www.npmjs.com/package/@ptkdev/quizquickanswer-telegram-game-bot) [![License: MIT](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat&logo=license)](https://github.com/ptkdev/quizquickanswer-telegram-game-bot/blob/main/LICENSE.md) [![Language: TypeScript](https://img.shields.io/badge/language-typescript-blue.svg?style=flat&logo=typescript)](https://www.typescriptlang.org/) [![Framework: Grammy](https://img.shields.io/badge/powered%20by-grammy-009dca.svg?style=flat&logo=telegram)](https://grammy.dev/) [![ECMAScript: 2019](https://img.shields.io/badge/ES-9-F7DF1E.svg?style=flat&logo=javascript)](https://github.com/tc39/ecma262) [![Discord Server](https://discordapp.com/api/guilds/383373985666301975/embed.png)](https://discord.ptkdev.io)

<!-- all-shields/header-badges:END -->

Expand Down Expand Up @@ -75,7 +75,7 @@ If you have no telegram groups of friends you can play in the official one, you
2. Write to [@botfather](https://t.me/botfather) on telegram and create new bot (save token and set bot username)
3. Set bot token: `export BOT_TOKEN=1234:asdfghjkl`
4. Set mongodb connection url: `export MONGODB=mongodb://localhost:27017/quizquickanswerdb`
5. Run `npm run init`
5. Run `npm install`
6. Run `npm run dev`
7. Write `/start` on telegram bot.

Expand All @@ -85,7 +85,7 @@ Deploy bot to your server and:

1. Set bot token: `export BOT_TOKEN=1234:asdfghjkl`
2. Set mongodb connection url: `export MONGODB=mongodb://localhost:27017/quizquickanswerdb`
3. Run init `npm run init`
3. Run init npm install
4. Generate release `npm run release`
5. Start bot `npm run start-pm2`

Expand All @@ -101,19 +101,21 @@ Thanks to all our backers! 🙏 Donate 3$ or more on [paypal](https://www.paypal

## 👨‍💻 Contributing

I ❤️ contributions! I will happily accept your pull request! Translations, grammatical corrections (GrammarNazi you are welcome! Yes my English is bad, sorry), etc... Do not be afraid, if the code is not perfect we will work together 👯 and remember to insert your name in `.all-contributorsrc` and `package.json` file.
I ❤️ contributions! I will happily accept your pull request! (**IMPORTANT**: Only to nightly branch!) Translations, grammatical corrections (GrammarNazi you are welcome! Yes my English is bad, sorry), etc... Do not be afraid, if the code is not perfect we will work together 👯 and remember to insert your name in `.all-contributorsrc` and `package.json` file.

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

<!-- ALL-CONTRIBUTORS-LIST:START -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tr>
<td align="center"><a href="https://ptk.dev"><img src="https://avatars1.githubusercontent.com/u/442844?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Patryk Rzucidło</b></sub></a><br /><a href="https://github.com/ptkdev/ptkdev/quizquickanswer-telegram-game-bot/commits?author=ptkdev" title="Code">💻</a> <a href="#translation-ptkdev" title="Translation">🌍</a> <a href="https://github.com/ptkdev/ptkdev/quizquickanswer-telegram-game-bot/commits?author=ptkdev" title="Documentation">📖</a> <a href="https://github.com/ptkdev/ptkdev/quizquickanswer-telegram-game-bot/issues?q=author%3Aptkdev" title="Bug reports">🐛</a></td>
<td align="center"><img src="https://avatars1.githubusercontent.com/u/50172746?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Alì Shadman</b></sub><br /><a href="https://github.com/ptkdev/ptkdev/quizquickanswer-telegram-game-bot/commits?author=AliShadman95" title="Code">💻</a> <a href="#translation-AliShadman95" title="Translation">🌍</a> <a href="https://github.com/ptkdev/ptkdev/quizquickanswer-telegram-game-bot/commits?author=AliShadman95" title="Documentation">📖</a> <a href="https://github.com/ptkdev/ptkdev/quizquickanswer-telegram-game-bot/issues?q=author%3AAliShadman95" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://instagram.com/den_karina"><img src="https://avatars1.githubusercontent.com/u/91738047?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Denise Scazzari</b></sub></a><br /><a href="#translation-DeniseKarina" title="Translation">🌍</a></td>
</tr>
<tbody>
<tr>
<td align="center" valign="top" width="16.66%"><a href="https://ptk.dev"><img src="https://avatars1.githubusercontent.com/u/442844?v=4?s=100" width="100px;" alt="Patryk Rzucidło"/><br /><sub><b>Patryk Rzucidło</b></sub></a><br /><a href="https://github.com/ptkdev/ptkdev/quizquickanswer-telegram-game-bot/commits?author=ptkdev" title="Code">💻</a> <a href="#translation-ptkdev" title="Translation">🌍</a> <a href="https://github.com/ptkdev/ptkdev/quizquickanswer-telegram-game-bot/commits?author=ptkdev" title="Documentation">📖</a> <a href="https://github.com/ptkdev/ptkdev/quizquickanswer-telegram-game-bot/issues?q=author%3Aptkdev" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="16.66%"><img src="https://avatars1.githubusercontent.com/u/50172746?v=4?s=100" width="100px;" alt="Alì Shadman"/><br /><sub><b>Alì Shadman</b></sub><br /><a href="https://github.com/ptkdev/ptkdev/quizquickanswer-telegram-game-bot/commits?author=AliShadman95" title="Code">💻</a> <a href="#translation-AliShadman95" title="Translation">🌍</a> <a href="https://github.com/ptkdev/ptkdev/quizquickanswer-telegram-game-bot/commits?author=AliShadman95" title="Documentation">📖</a> <a href="https://github.com/ptkdev/ptkdev/quizquickanswer-telegram-game-bot/issues?q=author%3AAliShadman95" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="16.66%"><a href="https://instagram.com/den_karina"><img src="https://avatars1.githubusercontent.com/u/91738047?v=4?s=100" width="100px;" alt="Denise Scazzari"/><br /><sub><b>Denise Scazzari</b></sub></a><br /><a href="#translation-DeniseKarina" title="Translation">🌍</a></td>
</tr>
</tbody>
</table>

<!-- markdownlint-restore -->
Expand Down Expand Up @@ -155,4 +157,4 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
- Images and logos have **CC BY-NC 4.0 License**
- Documentations and Translations have **CC BY 4.0 License**

###### Copyleft (c) 2021 [Patryk Rzucidło](https://ptk.dev) ([@PTKDev](https://twitter.com/ptkdev)) <[support@ptkdev.io](mailto:support@ptkdev.io)>
###### Copyleft (c) 2022 [Patryk Rzucidło](https://ptk.dev) ([@PTKDev](https://twitter.com/ptkdev)) <[support@ptkdev.io](mailto:support@ptkdev.io)>
2 changes: 1 addition & 1 deletion app/configs/config.js.tpl
Expand Up @@ -16,7 +16,7 @@ module.exports = {
database: { URL: process.env.MONGODB || "mongodb://localhost:27017/quizquickanswerdb" },

// Debug
debug: process.env.DEBUG || true,
debug: process.env.DEBUG || "disabled",

// LOGS
// https://github.com/ptkdev/ptkdev-logger
Expand Down
13 changes: 3 additions & 10 deletions app/functions/api/database/master.ts
Expand Up @@ -23,6 +23,7 @@ const schema = new Schema<MasterInterface>({
question: { type: String, default: "" },
description: { type: String, default: "" },
pin_id: { type: Number, default: 0 },
message_thread_id: { type: Number, default: 0 },
});

const query = model<MasterInterface>("Master", schema, "master");
Expand Down Expand Up @@ -52,11 +53,7 @@ const add = async (user: MasterInterface): Promise<void> => {
*/
const remove = async (search: Record<string, number | string | boolean>): Promise<void> => {
try {
await query.findOneAndDelete(search, function (error: string) {
if (error) {
logger.error(error || "");
}
});
await query.findOneAndDelete(search);
} catch (error: unknown) {
logger.error(JSON.stringify(error || ""), "master.ts:remove()");
}
Expand All @@ -72,11 +69,7 @@ const remove = async (search: Record<string, number | string | boolean>): Promis
*/
const update = async (search: Record<string, number | string | boolean>, user: MasterInterface): Promise<void> => {
try {
await query.findOneAndUpdate(search, user, function (error: string) {
if (error) {
logger.error(error || "");
}
});
await query.findOneAndUpdate(search, user);
} catch (error: unknown) {
logger.error(JSON.stringify(error || ""), "master.ts:update()");
}
Expand Down
18 changes: 3 additions & 15 deletions app/functions/api/database/questions.ts
Expand Up @@ -50,11 +50,7 @@ const add = async (user: QuestionsInterface): Promise<void> => {
*/
const remove = async (search: Record<string, number | string | boolean>): Promise<void> => {
try {
await query.findOneAndDelete(search, function (err) {
if (err) {
return err;
}
});
await query.findOneAndDelete(search);
} catch (error: unknown) {
logger.error(JSON.stringify(error || ""), "question.ts:remove()");
}
Expand All @@ -70,11 +66,7 @@ const remove = async (search: Record<string, number | string | boolean>): Promis
*/
const update = async (search: Record<string, number | string | boolean>, user: QuestionsInterface): Promise<void> => {
try {
await query.findOneAndUpdate(search, user, function (err) {
if (err) {
return err;
}
});
await query.findOneAndUpdate(search, user);
} catch (error: unknown) {
logger.error(JSON.stringify(error || ""), "question.ts:update()");
}
Expand All @@ -91,11 +83,7 @@ const update = async (search: Record<string, number | string | boolean>, user: Q
*/
const get = async (search: Record<string, number | string | boolean>): Promise<QuestionsInterface> => {
try {
const user = await query.findOne(search, function (error: string) {
if (error) {
logger.error(JSON.stringify(error || ""), "question.ts:get()");
}
});
const user = await query.findOne(search);

return (await user) || new query().toJSON();
} catch (error: unknown) {
Expand Down
25 changes: 4 additions & 21 deletions app/functions/api/database/scores.ts
Expand Up @@ -51,12 +51,7 @@ const add = async (user: MasterInterface): Promise<void> => {
*/
const remove = async (search: Record<string, number | string | boolean>): Promise<void> => {
try {
query.findOneAndDelete(search, function (err) {
if (err) {
return err;
}
logger.info("User with score deleted");
});
query.findOneAndDelete(search);
} catch (error: unknown) {
logger.error(JSON.stringify(error || ""), "scores.ts:remove()");
}
Expand All @@ -72,11 +67,7 @@ const remove = async (search: Record<string, number | string | boolean>): Promis
*/
const update = async (search: Record<string, number | string | boolean>, user: MasterInterface): Promise<void> => {
try {
await query.findOneAndUpdate(search, user, function (err) {
if (err) {
return err;
}
});
await query.findOneAndUpdate(search, user);
} catch (error: unknown) {
logger.error(JSON.stringify(error || ""), "scores.ts:update()");
}
Expand All @@ -93,11 +84,7 @@ const update = async (search: Record<string, number | string | boolean>, user: M
*/
const get = async (search: Record<string, number | string | boolean>): Promise<MasterInterface> => {
try {
const user = await query.findOne(search, function (error: string) {
if (error) {
logger.error(JSON.stringify(error || ""), "scores.ts:get()");
}
});
const user = await query.findOne(search);

return (await user) || new query().toJSON();
} catch (error: unknown) {
Expand All @@ -118,11 +105,7 @@ const get = async (search: Record<string, number | string | boolean>): Promise<M
*/
const getMultiple = async (search: Record<string, number | string | boolean>): Promise<MasterInterface[]> => {
try {
const user = await query.find(search, function (error: string) {
if (error) {
logger.error(JSON.stringify(error || ""), "scores.ts:getMultiple()");
}
});
const user = await query.find(search);
return user || [];
} catch (error: unknown) {
logger.error(JSON.stringify(error || ""), "scores.ts:getMultiple()");
Expand Down
12 changes: 2 additions & 10 deletions app/functions/api/database/settings.ts
Expand Up @@ -46,11 +46,7 @@ const add = async (settings: SettingsInterface): Promise<void> => {
*/
const remove = async (search: Record<string, number | string | boolean>): Promise<void> => {
try {
await query.findOneAndDelete(search, function (error: string) {
if (error) {
logger.error(error || "");
}
});
await query.findOneAndDelete(search);
} catch (error: unknown) {
logger.error(JSON.stringify(error || ""), "settings.ts:remove()");
}
Expand All @@ -69,11 +65,7 @@ const update = async (
settings: SettingsInterface,
): Promise<void> => {
try {
await query.findOneAndUpdate(search, settings, function (error: string) {
if (error) {
logger.error(error || "");
}
});
await query.findOneAndUpdate(search, settings);
} catch (error: unknown) {
logger.error(JSON.stringify(error || ""), "settings.ts:update()");
}
Expand Down

0 comments on commit d0c062c

Please sign in to comment.