Skip to content

Commit

Permalink
Merge pull request #27 from neirowork/develop
Browse files Browse the repository at this point in the history
Shovel Red, Greenに追従
  • Loading branch information
10mocy authored Feb 7, 2020
2 parents 9d44b80 + 39a4379 commit 81922fe
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fais",
"version": "1.35",
"version": "1.36",
"main": ".dist/index.js",
"repository": "https://github.com/neirowork/FAIS.git",
"author": "Tomotada Saigusa <[email protected]>",
Expand Down
23 changes: 23 additions & 0 deletions src/commands/word-delete.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import * as Shovel from './../helpers/shovel-db';

const main = async (): Promise<void> => {
if (process.argv.length !== 3) {
console.error('引数が足りません');
return process.exit(-1);
}

const db = new Shovel.DB('mongodb://localhost:27017', 'fais');
await db.start().then(() => {
db.removeWord({
word: process.argv[2]
})
.then(() => {
console.log(`success 単語データ削除完了 ${process.argv[2]}`);
})
.catch(err => {
throw err;
});
});
};

main();
5 changes: 4 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,11 @@ class FAISBot {
}

private async handleShovelCommand(msg: Discord.Message): Promise<void> {
// const shovelCmd = msg.content.match(
// /^!sh[gr]? (?:(add|delete)_word|([ad])w)\s(\S+)(?:\s(\S+))?/
// );
const shovelCmd = msg.content.match(
/^!sh[gr]? (?:(add|delete)_word|([ad])w)\s(\S+)(?:\s(\S+))?/
/^!sh? (?:(add|delete)_word|([ad])w)\s(\S+)(?:\s(\S+))?/
);
if (!shovelCmd) return;

Expand Down

0 comments on commit 81922fe

Please sign in to comment.