Open
discord で読み上げ bot をつくる
get started はここから
こっちにする
これ使う
example 作れたけど、これはどうやったら動かせるんだ?
local serve して、/ping
投げても帰ってこない
動かしてるのはこれ
さっき動かなかったのは、コマンドが違った説
.configure(|c| c.prefix("~")) // set the bot's prefix to "~"
これで設定してた。
ので、コマンドは ~ping
voice 再生系の機能もあるっぽい
start
で読み取り開始して voice に入室。
それ以降はメッセージの追加を検知して読み取る必要がある。
できるかな、
webhook とか設定してないけど、どうやって動いてるのか…
このライブラリだと、ボイスチャット系に対応してないかも?
そのようなライブラリの1つがSerenityです。これは、オプションを利用できるようにしながら、心配する必要のないものを抽象化するライブラリです。これはDiscordAPIをラップアラウンドし、音声サポートとすべての作業を備えた、ほとんど機能が完全です。
気づいてないだけかも
こっちかな
m1 でビルドできない
error: failed to run custom build command for `audiopus_sys v0.1.8`
Caused by:
process didn't exit successfully: `/app/target/debug/build/audiopus_sys-688f2c42484975a9/build-script-build` (exit code: 101)
ここで同じことで悩んでる人がいた
error:
is_x86_feature_detected can only be used on x86 and x86_64 targets.
You can prevent it from being used in other architectures by
guarding it behind a cfg(target_arch) as follows:
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] {
if is_x86_feature_detected(...) { ... }
}
--> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/opusic-sys-0.3.4/build.rs:74:13
|
74 | if !std::is_x86_feature_detected!("sse") {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 8 previous errors
For more information about this error, try `rustc --explain E0658`.
error: could not compile `opusic-sys`
To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
それでもだめだった
m1 にはまだ早いのか、、、
これを clone してきて build しても同じエラーだったので、厳しそう
intel mac に切り替えて作業することにする
intel
error: failed to run custom build command for `audiopus_sys v0.1.8`
Caused by:
process didn't exit successfully: `/app/target/debug/build/audiopus_sys-e2d1122e6f3b14ab/build-script-build` (exit code: 101)
--- stdout
cargo:info=No feature or environment variable found, linking by default.
cargo:rerun-if-env-changed=OPUS_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-musl
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_musl
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-musl
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_musl
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-musl
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_musl
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
cargo:info=`pkg_config` could not find `Opus`.
cargo:info=Opus source path: "/usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/audiopus_sys-0.1.8/opus".
cargo:info=Opus will be built as static-library.
Updating build configuration files, please wait....
--- stderr
autogen.sh: line 14: autoreconf: not found
thread 'main' panicked at 'Failed to autogen Opus.', /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/audiopus_sys-0.1.8/build.rs:102:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed
依存してる何かが入ってない?
alpine でできるかは不明
/app # apk add libopus-dev
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz
ERROR: unsatisfiable constraints:
libopus-dev (missing):
required by: world[libopus-dev]
どういうこっちゃ
apk add opus
したらビルドが通った
/app # cargo run
Compiling app v0.1.0 (/app)
Finished dev [unoptimized + debuginfo] target(s) in 15.70s
Running `target/debug/app`
speach is connected!
Segmentation fault
~join
したら落ちた。まだいろいろいるのかも
RUN apk update && \
apk upgrade && \
apk add --update --no-cache alpine-sdk git opus-dev build-base autoconf automake libtool m4 ffmpeg
これだけ入れてもだめっぽい
alpine だとダメかもなので ubuntu のイメージ引っ張ってくる
FROM rust:alpine3.12
WORKDIR /app
RUN apk update && \
apk upgrade && \
apk add --update --no-cache alpine-sdk git opus-dev build-base autoconf automake libtool m4 ffmpeg
ENV FFMPEG_CORE="bash \
tzdata \
libass \
libstdc++ \
libpng \
libjpeg \
xvidcore \
x264-libs \
x265 \
libvpx \
libvorbis \
opus \
lame \
fdk-aac \
freetype \
libavc1394 \
yasm"
ENV RUNTIME_DEPS="coreutils \
make \
cmake \
gcc \
g++ \
clang \
linux-headers \
git \
curl"
ENV BUILD_DEPS="fdk-aac-dev \
freetype-dev \
x264-dev \
x265-dev \
yasm-dev \
libogg-dev \
libvorbis-dev \
opus-dev \
libvpx-dev \
lame-dev \
xvidcore-dev \
libass-dev \
openssl-dev \
musl-dev \
build-base \
libjpeg-turbo-dev \
libpng-dev \
libavc1394-dev \
libavc1394-dev \
clang-dev"
ENV FFMPEG_VERSION=4.0
# FFMPEG
RUN apk update && \
apk add --no-cache apk-tools && \
echo http://nl.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories && \
apk update && \
apk add --no-cache --virtual .runtime-deps ${RUNTIME_DEPS} && \
apk add --no-cache ${FFMPEG_CORE} && \
apk add --no-cache --virtual .build-deps ${BUILD_DEPS}
COPY Cargo.lock Cargo.lock
COPY Cargo.toml Cargo.toml
COPY . .
CMD [ "/bin/sh", "-c", "cargo run" ]
これでもだめだった
あきらめて ubuntu
うごいた
Voiceのとこが動かんかったので、次は再生のexampleそのままとってきてちゃれんじ
ログインするとコメントできます