Code Monkey home page Code Monkey logo

clanbattlebot's Introduction

ClanBattleBot

ci workflow

プリンセスコネクト!Re:Diveのクランバトルを管理するためのDiscordBot

機能

メイン機能

  • 凸宣言
  • 凸報告
  • クラン内凸一覧の確認

順次機能は追加予定。

おまけ

  • 運命のダイスロール

開発環境

  • node.js v20.2.0
  • MySQL v8.0.33

その他はpackage.jsonを参照。

使い方

discordBotのユーザー作成は各自行ってください。 (動作サンプルのサーバーは公開していません)

インストール

$ git clone https://github.com/yuina1056/ClanBattleBot.git

作者

@yuina1056

ライセンス

MIT

clanbattlebot's People

Contributors

yuina1056 avatar drakontia avatar dependabot[bot] avatar yonta avatar iteduki avatar

Stargazers

kjfsm avatar  avatar  avatar

Watchers

 avatar  avatar

clanbattlebot's Issues

救援ボタンを作る

ロールメンションで救援呼べるが最初。
凸残ってる人を個別メンションできるとベスト

凸状況がきちんと反映されない時がある

3凸しても1凸目が凸状況に反映されないことがある。他にも同様のケースが散見される。

コルネ — 今日 00:33
やり方が間違ってたらごめんなさい。1凸の持ち越しが違うのと、2、3凸が入力されてないっぽい?
凸宣言して何凸目か選択して、削りが撃破おしてます
端末はアイポン7(古)

持ち越しを含んだ時の処理が上手くいっていないのか?

優先度高く対応をお願いします。

周回数の管理はクランと分離する

今DBにおいてクランの中に周回数が埋め込まれていますが、毎度リセットする手間が発生するので、イベントごとにした方がいいと思います。

宣言メッセージとボス状況を分離する

image

宣言とボス状況とボタンが一緒になっているが、分離した方がいい。

宣言はchannel.sendで送る。

ボス状況はできれば、編集にしたいが無理なら新しく送る

image

持ち越しが発生しているかの判定が機能していない

以下のところで判定していますが、機能していません。

let isCarryOver = false;
const reports = await DataSource.getRepository(Report).find({
where: {
userId: user.id,
eventId: event.id,
day: declaration.day,
attackCount: declaration.attackCount,
},
});
if (reports.length === 0) {
isCarryOver = true;
}

おそらく、取得したreportsのlengthを厳密に0か判定していますが、nullかなんかが返ってきているのを想定できていません。
なので、毎度判定がすり抜けます。
findの返り値を確認して、的確に判定する必要があります。

代理入力が出来る様にする

メンバーの凸宣言および削り/撃破入力を進行メンバーが代理で入力できるようにする。
(ひとまずは進行メンバーでなくても、誰でもできてもいいかもしれない)

解凍処理を実装する

解凍とは、凸宣言をしている状態で救援などで凸宣言の対象であるボスが撃破された際に凸宣言をキャンセルさせるものである。
解凍操作自体は、凸宣言のキャンセルで実施出来るが、よりわかりやすくするために別途解凍ボタンを設置した方がいいと思われる操作のし忘れなどの防止に実装しておいた方がいい。
処理としては、解凍対象のボスに凸宣言されているものを一律で消去すれば問題ないと考えられる。

凸状況で持越があることを表示する

[2撃破/5削り/3削り]

上のような場合において、持越凸が残っている場合は下のように持越が残っていることを表記するようにする。

[2撃破-/5削り/3削り]

ORM決める

クラバト期間常時稼働ならオンメモリでもOK。各種記録残しておきたいならDBに入れておく必要ある。
DB入れる場合ORM入れたいが、何を入れるか決める。

候補

  • prisma
  • typeORM

撃破実施時にReportの生成が失敗した

mysql> select * from declaration where userId=44;
+-----+--------+--------+---------+--------+-----+-----+-------------+------------+----------------------------+----------------------------+
| id  | clanId | userId | eventId | bossId | lap | day | attackCount | isFinished | CreatedAt                  | UpdatedAt                  |
+-----+--------+--------+---------+--------+-----+-----+-------------+------------+----------------------------+----------------------------+
| 225 |      2 |     44 |       4 |     10 |  23 |   1 |           1 |          1 | 2023-11-26 02:27:01.761509 | 2023-11-26 02:32:58.000000 |
| 233 |      2 |     44 |       4 |     10 |  24 |   1 |           1 |          1 | 2023-11-26 02:49:08.021522 | 2023-11-26 02:53:53.000000 |
| 236 |      2 |     44 |       4 |      7 |  24 |   1 |           2 |          1 | 2023-11-26 03:01:41.279601 | 2023-11-26 03:02:22.000000 |
| 238 |      2 |     44 |       4 |      8 |  23 |   1 |           3 |          1 | 2023-11-26 03:34:13.863365 | 2023-11-26 03:35:54.000000 |
| 442 |      2 |     44 |       4 |      8 |  25 |   2 |           1 |          1 | 2023-11-27 00:16:02.421635 | 2023-11-27 00:16:09.000000 |
| 443 |      2 |     44 |       4 |     10 |  26 |   2 |           2 |          1 | 2023-11-27 00:17:12.895175 | 2023-11-27 00:21:20.000000 |
| 450 |      2 |     44 |       4 |      7 |  26 |   2 |           3 |          1 | 2023-11-27 00:36:31.669690 | 2023-11-27 00:36:37.000000 |
| 453 |      2 |     44 |       4 |      7 |  27 |   2 |           3 |          1 | 2023-11-27 00:38:16.744103 | 2023-11-27 00:47:49.000000 |
| 458 |      2 |     44 |       4 |      8 |  26 |   2 |           1 |          1 | 2023-11-27 00:52:04.103379 | 2023-11-27 00:59:52.000000 |
| 579 |      2 |     44 |       4 |      7 |  27 |   3 |           1 |          1 | 2023-11-27 20:57:14.222633 | 2023-11-27 20:59:49.000000 |
| 583 |      2 |     44 |       4 |      8 |  28 |   3 |           2 |          1 | 2023-11-27 21:01:00.217214 | 2023-11-27 21:05:55.000000 |
| 592 |      2 |     44 |       4 |     10 |  29 |   3 |           3 |          1 | 2023-11-27 21:31:49.933460 | 2023-11-28 22:43:21.000000 |
| 829 |      2 |     44 |       4 |      7 |  31 |   4 |           1 |          0 | 2023-11-28 22:35:41.776629 | 2023-11-28 22:35:41.776629 |
+-----+--------+--------+---------+--------+-----+-----+-------------+------------+----------------------------+----------------------------+
13 rows in set (0.00 sec)

mysql> select * from report where userId=44;
+-----+--------+--------+---------+--------+-----+-----+-------------+--------+-------------+----------------------------+----------------------------+----------+
| id  | clanId | userId | eventId | bossId | lap | day | attackCount | damage | isCarryOver | CreatedAt                  | UpdatedAt                  | isDefeat |
+-----+--------+--------+---------+--------+-----+-----+-------------+--------+-------------+----------------------------+----------------------------+----------+
| 225 |      2 |     44 |       4 |      5 |  24 |   1 |           1 |      0 |           0 | 2023-11-26 02:53:53.628717 | 2023-11-26 02:53:53.628717 |        0 |
| 227 |      2 |     44 |       4 |      2 |  24 |   1 |           2 |      0 |           0 | 2023-11-26 03:02:22.214453 | 2023-11-26 03:02:22.214453 |        0 |
| 229 |      2 |     44 |       4 |      3 |  23 |   1 |           3 |      0 |           0 | 2023-11-26 03:35:54.421798 | 2023-11-26 03:35:54.421798 |        0 |
| 415 |      2 |     44 |       4 |      3 |  26 |   2 |           1 |      0 |           0 | 2023-11-27 00:16:09.701205 | 2023-11-27 00:16:09.701205 |        1 |
| 416 |      2 |     44 |       4 |      5 |  26 |   2 |           2 |      0 |           0 | 2023-11-27 00:21:20.600527 | 2023-11-27 00:21:20.600527 |        0 |
| 421 |      2 |     44 |       4 |      2 |  27 |   2 |           3 |      0 |           0 | 2023-11-27 00:36:37.708355 | 2023-11-27 00:36:37.708355 |        1 |
| 423 |      2 |     44 |       4 |      2 |  27 |   2 |           3 |      0 |           0 | 2023-11-27 00:41:09.925472 | 2023-11-27 00:55:50.985687 |        0 |
| 428 |      2 |     44 |       4 |      3 |  26 |   2 |           1 |      0 |           0 | 2023-11-27 00:52:17.660724 | 2023-11-27 00:52:17.660724 |        0 |
| 545 |      2 |     44 |       4 |      2 |  27 |   3 |           1 |      0 |           0 | 2023-11-27 20:57:27.418599 | 2023-11-27 21:00:42.967177 |        0 |
| 550 |      2 |     44 |       4 |      3 |  28 |   3 |           2 |      0 |           0 | 2023-11-27 21:05:24.190807 | 2023-11-27 21:05:49.896531 |        0 |
| 558 |      2 |     44 |       4 |      5 |  29 |   3 |           1 |      0 |           0 | 2023-11-27 21:36:13.519448 | 2023-11-27 21:36:13.519448 |        0 |
| 793 |      2 |     44 |       4 |      2 |  32 |   4 |           3 |      0 |           0 | 2023-11-28 22:43:21.778156 | 2023-11-28 22:43:21.778156 |        1 |
+-----+--------+--------+---------+--------+-----+-----+-------------+--------+-------------+----------------------------+----------------------------+----------+
12 rows in set (0.00 sec)

それぞれの一番下の行。
isFinishedがTrueになっていない。
1凸目なのに3凸目になっている。
宣言は拾えているのに、途中ですり替わった?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.