Skip to content

Commit

Permalink
Merge pull request #40 from ictsc/integration-with-rstate
Browse files Browse the repository at this point in the history
rstateとの連携を実装した
  • Loading branch information
proelbtn authored Nov 16, 2023
2 parents 272a07c + cf0eba3 commit 70879f9
Show file tree
Hide file tree
Showing 11 changed files with 477 additions and 97 deletions.
75 changes: 71 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ edition = "2021"
anyhow = "1.0.53"
async-trait = "0.1.52"
base64 = "0.13.0"
chrono = { version = "0.4.31", features = ["serde"] }
clap = { version = "4.4.2", features = ["derive"] }
derive_builder = "0.12.0"
reqwest = { version = "0.11.9", features = ["json"] }
serde = "1.0.131"
serde_derive = "1.0.131"
serde_json = "1.0.108"
serde_yaml = "0.8.21"
serenity = { version = "0.11.6", default-features = false, features = ["client", "collector", "gateway", "rustls_backend", "model", "unstable_discord_api"] }
thiserror = "1.0.30"
Expand Down
17 changes: 13 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ NAME ?= ictsc-discord-bot
IMAGE_TAG ?= latest
IMAGE ?= ghcr.io/ictsc/ictsc-discord-bot:$(IMAGE_TAG)

DOCKER_ARGS ?= --name $(NAME) -v "$(shell pwd)/bot.yaml:/bot.yaml"
DOCKER_ARGS ?= -v "$(shell pwd)/bot.yaml:/bot.yaml" --net host --env RUST_LOG=info,bot=debug

all:

Expand All @@ -13,8 +13,17 @@ build:

.PHONY: start
start:
DOCKER_BUILDKIT=1 docker run -d $(DOCKER_ARGS) $(IMAGE) -f /bot.yaml start
docker run -d --name $(NAME) $(DOCKER_ARGS) $(IMAGE) -f /bot.yaml start

.PHONY: start
.PHONY: sync-channels sync-roles
sync-channels sync-roles:
docker run -it $(DOCKER_ARGS) $(IMAGE) -f /bot.yaml $@

.PHONY: stop
stop:
DOCKER_BUILDKIT=1 docker rm -f $(NAME)
docker rm -f $(NAME)

.PHONY: logs
logs:
docker logs -f $(NAME)

4 changes: 3 additions & 1 deletion src/bot/commands/ask.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ impl Bot {
_ => return Err(AskCommandError::InvalidChannelTypeError),
};

let title = self.get_option_as_str(interaction, "title").unwrap();
let title = self
.get_option_as_str(&interaction.data.options, "title")
.unwrap();

// 可読性や識別性から、質問タイトルは32文字以内に制限している。
if title.chars().count() > 32 {
Expand Down
2 changes: 1 addition & 1 deletion src/bot/commands/join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl Bot {
}

let invitation_code = self
.get_option_as_str(interaction, "invitation_code")
.get_option_as_str(&interaction.data.options, "invitation_code")
.unwrap();

self.find_role_name_by_invitation_code(invitation_code)
Expand Down
Loading

0 comments on commit 70879f9

Please sign in to comment.