Skip to content

Commit

Permalink
[Release] 1.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
leomotors committed Feb 22, 2022
1 parent ea60cee commit 83165fe
Show file tree
Hide file tree
Showing 9 changed files with 92 additions and 103 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to Kawaii Cocoa Grader will be documented here

Changelog before 0.2.2 will not be noted here

## [1.0.3] - 2022-02-23

- Upgrade to Cocoa Discord Utils 1.0.0 and use its new feature

## [1.0.2] - 2022-02-20

- Upgrade to Cocoa Discord Utils 1.0.0-rc.3 and use its new feature
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ A Discord Bot Grader, more specifically, '*Waifu Discord Bot*'

- Use some powerful devices (don't use Raspberry Pi that I use 😖)

## 🍫 Behind this Bot

This Discord Bot use [Cocoa Discord Utils](https://github.com/Leomotors/cocoa-discord-utils),
a library written by me for me to simplify things!

The problems are served by [stupid-problems](https://github.com/Leomotors/stupid-problems)

## 🏷️ Features

- Functional Grader with Time and Memory Limit (but does not prevent `sudo reboot`, use with caution)
Expand All @@ -26,14 +33,7 @@ A Discord Bot Grader, more specifically, '*Waifu Discord Bot*'

### Planned

- Interactive (Library like IOI)

- Better Problem Management System (to be compatible with upcoming [stupid-problems](https://github.com/Leomotors/stupid-problems))

## 🔪 Cutting Edge

Branch `future-lib` (if is ahead of main) contains `cocoa-discord-utils`
in the version that is not published on npm yet. Error will surely occur if you run it.
- Interactive (Library like IOI & IPST Camp)

## 🔧 Adding a problem

Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cocoa-grader",
"version": "1.0.2",
"version": "1.0.3",
"description": "Discord Bot Grader",
"main": "dist/bot/client.js",
"repository": "https://github.com/Leomotors/cocoa-grader",
Expand All @@ -19,18 +19,18 @@
"dependencies": {
"@discordjs/builders": "^0.12.0",
"chalk": "^5.0.0",
"cocoa-discord-utils": "^1.0.0-rc.3",
"cocoa-discord-utils": "^1.0.0",
"discord.js": "^13.6.0",
"dotenv": "^16.0.0",
"node-fetch": "^3.2.0",
"uuid": "^8.3.2"
},
"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "^3.2.0",
"@types/node": "^17.0.18",
"@types/node": "^17.0.19",
"@types/uuid": "^8.3.4",
"@typescript-eslint/eslint-plugin": "^5.12.0",
"@typescript-eslint/parser": "^5.12.0",
"@typescript-eslint/eslint-plugin": "^5.12.1",
"@typescript-eslint/parser": "^5.12.1",
"eslint": "^8.9.0",
"prettier": "^2.5.1",
"rimraf": "^3.0.2",
Expand Down
5 changes: 3 additions & 2 deletions problems/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Due to the size of test case, (some problems like nikkori_cafe is 100 MB)

I couldn't keep the test case in the repository

Some of problem statements I used in my bots are available [here](https://github.com/Leomotors/stupid-problems)
All problems/statement/testcase I used are [here](https://github.com/Leomotors/stupid-problems)

If you wish to apply this bot. You will need to prepare your statement along with test cases
If you wish to apply this bot. You will need to either
clone and compile my statements or prepare your statement along with test cases
26 changes: 4 additions & 22 deletions src/bot/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import "dotenv/config";

import {
ActivityGroupLoader,
setConsoleEvent,
checkLogin,
ConsoleManager,
useActivityGroup,
} from "cocoa-discord-utils";
import { MessageCenter } from "cocoa-discord-utils/message";
Expand All @@ -24,7 +25,6 @@ const client = new Client(CocoaOptions);

const msgcenter = new MessageCenter(client, { mention: true });
msgcenter.addCog(CocoaMsg);
msgcenter.validateCommands();
msgcenter.on("error", async (name, err, msg) => {
await msg.reply(`あら?, Error Occured: ${err}`);
});
Expand All @@ -34,7 +34,6 @@ const slashcenter = new SlashCenter(
process.env.GUILD_IDS?.split(",") ?? []
);
slashcenter.addCog(Cocoa);
slashcenter.validateCommands();
slashcenter.on("error", async (name, err, ctx) => {
await ctx.reply(`あら?, Error Occured: ${err}`);
});
Expand All @@ -53,23 +52,6 @@ client.on("ready", (cli) => {
useActivityGroup(client, groupLoader);
});

client.login(process.env.DISCORD_TOKEN);
new ConsoleManager().useLogout(client).useReload(groupLoader);

// * Console Zone
setConsoleEvent((cmd: string) => {
if (cmd.startsWith("logout")) {
client.destroy();
console.log(chalk.cyan("Logged out Successfully!"));
process.exit(0);
}

if (cmd.startsWith("reload")) {
loadProblems();
groupLoader.reload();
return;
}

console.log(
chalk.yellow(`[Console WARN] Unknown Command ${cmd.split(" ")[0]}`)
);
});
checkLogin(client, process.env.DISCORD_TOKEN);
12 changes: 8 additions & 4 deletions src/bot/commands/slash/aboutme.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import { CocoaVersion } from "cocoa-discord-utils/meta";
import { CocoaSlash } from "cocoa-discord-utils/slash";
import { CocoaBuilder, ephemeral } from "cocoa-discord-utils/template";
import {
CocoaBuilder,
Ephemeral,
getEphemeral,
} from "cocoa-discord-utils/template";

import { Cocoa, style } from "../../shared";

export const aboutme: CocoaSlash = {
command: CocoaBuilder("aboutme", "Get Info about me!")
.addBooleanOption(ephemeral())
.addBooleanOption(Ephemeral())
.toJSON(),
func: async (ctx) => {
const ephe = ctx.options.getBoolean("ephemeral") || false;
const ephemeral = getEphemeral(ctx);
const embed = style
.use(ctx)
.setTitle("Cocoa Grader")
Expand Down Expand Up @@ -48,7 +52,7 @@ export const aboutme: CocoaSlash = {

await ctx.reply({
embeds: [embed.toJSON()],
ephemeral: ephe,
ephemeral,
});
},
};
8 changes: 3 additions & 5 deletions src/bot/commands/slash/getstatement.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { CocoaSlash } from "cocoa-discord-utils/slash";
import { CocoaOption } from "cocoa-discord-utils/template";

import { SlashCommandBuilder } from "@discordjs/builders";

Expand All @@ -9,11 +10,8 @@ export const getstatement: CocoaSlash = {
command: new SlashCommandBuilder()
.setName("getstatement")
.setDescription("Get Statement of a Problem")
.addStringOption((option) =>
option
.setName("problem_name")
.setDescription("Name of the problem")
.setRequired(true)
.addStringOption(
CocoaOption("problem_name", "Name of the problem", true)
)
.toJSON(),
func: async (ctx) => {
Expand Down
4 changes: 2 additions & 2 deletions src/bot/commands/slash/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import { CocoaBuildTime, CocoaVersion } from "cocoa-discord-utils/meta";
import { CocoaSlash } from "cocoa-discord-utils/slash";
import {
CocoaBuilder,
ephemeral,
Ephemeral,
getStatusFields,
} from "cocoa-discord-utils/template";

import { Cocoa, style } from "../../shared";

export const status: CocoaSlash = {
command: CocoaBuilder("status", "Get Cocoa's Status")
.addBooleanOption(ephemeral())
.addBooleanOption(Ephemeral())
.toJSON(),
func: async (ctx) => {
const ephe = ctx.options.getBoolean("ephemeral") ?? false;
Expand Down
110 changes: 55 additions & 55 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -347,10 +347,10 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.10.tgz#616f16e9d3a2a3d618136b1be244315d95bd7cab"
integrity sha512-S/3xB4KzyFxYGCppyDt68yzBU9ysL88lSdIah4D6cptdcltc4NCPCAMc0+PCpg/lLIyC7IPvj2Z52OJWeIUkog==

"@types/node@^17.0.18":
version "17.0.18"
resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.18.tgz#3b4fed5cfb58010e3a2be4b6e74615e4847f1074"
integrity sha512-eKj4f/BsN/qcculZiRSujogjvp5O/k4lOW5m35NopjZM/QwLOR075a8pJW5hD+Rtdm2DaCVPENS6KtSQnUD6BA==
"@types/node@^17.0.19":
version "17.0.19"
resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.19.tgz#726171367f404bfbe8512ba608a09ebad810c7e6"
integrity sha512-PfeQhvcMR4cPFVuYfBN4ifG7p9c+Dlh3yUZR6k+5yQK7wX3gDgVxBly4/WkBRs9x4dmcy1TVl08SY67wwtEvmA==

"@types/uuid@^8.3.4":
version "8.3.4"
Expand All @@ -364,84 +364,84 @@
dependencies:
"@types/node" "*"

"@typescript-eslint/eslint-plugin@^5.12.0":
version "5.12.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.12.0.tgz#bb46dd7ce7015c0928b98af1e602118e97df6c70"
integrity sha512-fwCMkDimwHVeIOKeBHiZhRUfJXU8n6xW1FL9diDxAyGAFvKcH4csy0v7twivOQdQdA0KC8TDr7GGRd3L4Lv0rQ==
"@typescript-eslint/eslint-plugin@^5.12.1":
version "5.12.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.12.1.tgz#b2cd3e288f250ce8332d5035a2ff65aba3374ac4"
integrity sha512-M499lqa8rnNK7mUv74lSFFttuUsubIRdAbHcVaP93oFcKkEmHmLqy2n7jM9C8DVmFMYK61ExrZU6dLYhQZmUpw==
dependencies:
"@typescript-eslint/scope-manager" "5.12.0"
"@typescript-eslint/type-utils" "5.12.0"
"@typescript-eslint/utils" "5.12.0"
"@typescript-eslint/scope-manager" "5.12.1"
"@typescript-eslint/type-utils" "5.12.1"
"@typescript-eslint/utils" "5.12.1"
debug "^4.3.2"
functional-red-black-tree "^1.0.1"
ignore "^5.1.8"
regexpp "^3.2.0"
semver "^7.3.5"
tsutils "^3.21.0"

"@typescript-eslint/parser@^5.12.0":
version "5.12.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.12.0.tgz#0ca669861813df99ce54916f66f524c625ed2434"
integrity sha512-MfSwg9JMBojMUoGjUmX+D2stoQj1CBYTCP0qnnVtu9A+YQXVKNtLjasYh+jozOcrb/wau8TCfWOkQTiOAruBog==
"@typescript-eslint/parser@^5.12.1":
version "5.12.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.12.1.tgz#b090289b553b8aa0899740d799d0f96e6f49771b"
integrity sha512-6LuVUbe7oSdHxUWoX/m40Ni8gsZMKCi31rlawBHt7VtW15iHzjbpj2WLiToG2758KjtCCiLRKZqfrOdl3cNKuw==
dependencies:
"@typescript-eslint/scope-manager" "5.12.0"
"@typescript-eslint/types" "5.12.0"
"@typescript-eslint/typescript-estree" "5.12.0"
"@typescript-eslint/scope-manager" "5.12.1"
"@typescript-eslint/types" "5.12.1"
"@typescript-eslint/typescript-estree" "5.12.1"
debug "^4.3.2"

"@typescript-eslint/[email protected].0":
version "5.12.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.12.0.tgz#59619e6e5e2b1ce6cb3948b56014d3a24da83f5e"
integrity sha512-GAMobtIJI8FGf1sLlUWNUm2IOkIjvn7laFWyRx7CLrv6nLBI7su+B7lbStqVlK5NdLvHRFiJo2HhiDF7Ki01WQ==
"@typescript-eslint/[email protected].1":
version "5.12.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.12.1.tgz#58734fd45d2d1dec49641aacc075fba5f0968817"
integrity sha512-J0Wrh5xS6XNkd4TkOosxdpObzlYfXjAFIm9QxYLCPOcHVv1FyyFCPom66uIh8uBr0sZCrtS+n19tzufhwab8ZQ==
dependencies:
"@typescript-eslint/types" "5.12.0"
"@typescript-eslint/visitor-keys" "5.12.0"
"@typescript-eslint/types" "5.12.1"
"@typescript-eslint/visitor-keys" "5.12.1"

"@typescript-eslint/[email protected].0":
version "5.12.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.12.0.tgz#aaf45765de71c6d9707c66ccff76ec2b9aa31bb6"
integrity sha512-9j9rli3zEBV+ae7rlbBOotJcI6zfc6SHFMdKI9M3Nc0sy458LJ79Os+TPWeBBL96J9/e36rdJOfCuyRSgFAA0Q==
"@typescript-eslint/[email protected].1":
version "5.12.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.12.1.tgz#8d58c6a0bb176b5e9a91581cda1a7f91a114d3f0"
integrity sha512-Gh8feEhsNLeCz6aYqynh61Vsdy+tiNNkQtc+bN3IvQvRqHkXGUhYkUi+ePKzP0Mb42se7FDb+y2SypTbpbR/Sg==
dependencies:
"@typescript-eslint/utils" "5.12.0"
"@typescript-eslint/utils" "5.12.1"
debug "^4.3.2"
tsutils "^3.21.0"

"@typescript-eslint/[email protected].0":
version "5.12.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.12.0.tgz#5b4030a28222ee01e851836562c07769eecda0b8"
integrity sha512-JowqbwPf93nvf8fZn5XrPGFBdIK8+yx5UEGs2QFAYFI8IWYfrzz+6zqlurGr2ctShMaJxqwsqmra3WXWjH1nRQ==
"@typescript-eslint/[email protected].1":
version "5.12.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.12.1.tgz#46a36a28ff4d946821b58fe5a73c81dc2e12aa89"
integrity sha512-hfcbq4qVOHV1YRdhkDldhV9NpmmAu2vp6wuFODL71Y0Ixak+FLeEU4rnPxgmZMnGreGEghlEucs9UZn5KOfHJA==

"@typescript-eslint/[email protected].0":
version "5.12.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.12.0.tgz#cabf545fd592722f0e2b4104711e63bf89525cd2"
integrity sha512-Dd9gVeOqt38QHR0BEA8oRaT65WYqPYbIc5tRFQPkfLquVEFPD1HAtbZT98TLBkEcCkvwDYOAvuSvAD9DnQhMfQ==
"@typescript-eslint/[email protected].1":
version "5.12.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.12.1.tgz#6a9425b9c305bcbc38e2d1d9a24c08e15e02b722"
integrity sha512-ahOdkIY9Mgbza7L9sIi205Pe1inCkZWAHE1TV1bpxlU4RZNPtXaDZfiiFWcL9jdxvW1hDYZJXrFm+vlMkXRbBw==
dependencies:
"@typescript-eslint/types" "5.12.0"
"@typescript-eslint/visitor-keys" "5.12.0"
"@typescript-eslint/types" "5.12.1"
"@typescript-eslint/visitor-keys" "5.12.1"
debug "^4.3.2"
globby "^11.0.4"
is-glob "^4.0.3"
semver "^7.3.5"
tsutils "^3.21.0"

"@typescript-eslint/[email protected].0":
version "5.12.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.12.0.tgz#92fd3193191621ab863add2f553a7b38b65646af"
integrity sha512-k4J2WovnMPGI4PzKgDtQdNrCnmBHpMUFy21qjX2CoPdoBcSBIMvVBr9P2YDP8jOqZOeK3ThOL6VO/sy6jtnvzw==
"@typescript-eslint/[email protected].1":
version "5.12.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.12.1.tgz#447c24a05d9c33f9c6c64cb48f251f2371eef920"
integrity sha512-Qq9FIuU0EVEsi8fS6pG+uurbhNTtoYr4fq8tKjBupsK5Bgbk2I32UGm0Sh+WOyjOPgo/5URbxxSNV6HYsxV4MQ==
dependencies:
"@types/json-schema" "^7.0.9"
"@typescript-eslint/scope-manager" "5.12.0"
"@typescript-eslint/types" "5.12.0"
"@typescript-eslint/typescript-estree" "5.12.0"
"@typescript-eslint/scope-manager" "5.12.1"
"@typescript-eslint/types" "5.12.1"
"@typescript-eslint/typescript-estree" "5.12.1"
eslint-scope "^5.1.1"
eslint-utils "^3.0.0"

"@typescript-eslint/[email protected].0":
version "5.12.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.12.0.tgz#1ac9352ed140b07ba144ebf371b743fdf537ec16"
integrity sha512-cFwTlgnMV6TgezQynx2c/4/tx9Tufbuo9LPzmWqyRC3QC4qTGkAG1C6pBr0/4I10PAI/FlYunI3vJjIcu+ZHMg==
"@typescript-eslint/[email protected].1":
version "5.12.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.12.1.tgz#f722da106c8f9695ae5640574225e45af3e52ec3"
integrity sha512-l1KSLfupuwrXx6wc0AuOmC7Ko5g14ZOQ86wJJqRbdLbXLK02pK/DPiDDqCc7BqqiiA04/eAA6ayL0bgOrAkH7A==
dependencies:
"@typescript-eslint/types" "5.12.0"
"@typescript-eslint/types" "5.12.1"
eslint-visitor-keys "^3.0.0"

acorn-jsx@^5.3.1:
Expand Down Expand Up @@ -561,10 +561,10 @@ chalk@^5.0.0:
resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.0.0.tgz#bd96c6bb8e02b96e08c0c3ee2a9d90e050c7b832"
integrity sha512-/duVOqst+luxCQRKEo4bNxinsOQtMP80ZYm7mMqzuh5PociNL0PvmHFvREJ9ueYL2TxlHjBcmLCdmocx9Vg+IQ==

cocoa-discord-utils@^1.0.0-rc.3:
version "1.0.0-rc.3"
resolved "https://registry.yarnpkg.com/cocoa-discord-utils/-/cocoa-discord-utils-1.0.0-rc.3.tgz#93ad8b1245f07db28508e4c5abb2ea1916d405ba"
integrity sha512-WV6hDM5TADrycRwi8x7rRJJ3AEXs4rcLJfXqD6BmDUQwJmXo+TXS70Ih2nCjwdeFdq6PL0qp+fWbyvvh12CZiw==
cocoa-discord-utils@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/cocoa-discord-utils/-/cocoa-discord-utils-1.0.0.tgz#b49f69e406ed0b71daaad73aa6fefc7aa77f7cb2"
integrity sha512-5obDl1G2PWoEpCGJyoMiBtgrN/iX9CHznyT/znSMcFl3IMgB9oa2FTNPpekpcCP/z5kFT+O1vwiUl16lZ8XhXw==
dependencies:
"@discordjs/builders" "^0.12.0"
chalk "4.1.2"
Expand Down

0 comments on commit 83165fe

Please sign in to comment.