mirror of
https://github.com/mii443/ncb-tts-r2.git
synced 2025-08-22 16:15:29 +00:00
thread tts
This commit is contained in:
10
Dockerfile
10
Dockerfile
@ -1,18 +1,18 @@
|
||||
FROM ubuntu:22.04
|
||||
WORKDIR /usr/src/ncb-tts-r2
|
||||
COPY Cargo.toml .
|
||||
COPY src src
|
||||
ENV PATH $PATH:/root/.cargo/bin/
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y ffmpeg libssl-dev pkg-config libopus-dev wget curl gcc \
|
||||
&& apt-get -y clean \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable \
|
||||
&& rustup install stable \
|
||||
&& cargo build --release \
|
||||
&& rustup install stable
|
||||
COPY Cargo.toml .
|
||||
COPY src src
|
||||
RUN cargo build --release \
|
||||
&& cp /usr/src/ncb-tts-r2/target/release/ncb-tts-r2 /usr/bin/ncb-tts-r2 \
|
||||
&& mkdir -p /ncb-tts-r2/audio \
|
||||
&& apt-get purge -y pkg-config wget curl gcc \
|
||||
&& rustup self uninstall -y
|
||||
WORKDIR /ncb-tts-r2
|
||||
CMD ["ncb-tts-r2"]
|
||||
CMD ["ncb-tts-r2"]
|
||||
|
@ -70,7 +70,7 @@ pub async fn setup_command(
|
||||
.clone()
|
||||
};
|
||||
|
||||
{
|
||||
let thread_id = {
|
||||
let mut storage = storage_lock.write().await;
|
||||
if storage.contains_key(&guild.id) {
|
||||
command
|
||||
@ -84,28 +84,43 @@ pub async fn setup_command(
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let message = command
|
||||
.channel_id
|
||||
.send_message(&ctx.http, |f| f.content("TTS thread"))
|
||||
.await
|
||||
.unwrap();
|
||||
let thread_id = command
|
||||
.channel_id
|
||||
.create_public_thread(&ctx.http, message, |f| {
|
||||
f.name("TTS").auto_archive_duration(60)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
storage.insert(
|
||||
guild.id,
|
||||
TTSInstance {
|
||||
before_message: None,
|
||||
guild: guild.id,
|
||||
text_channel: command.channel_id,
|
||||
text_channel: thread_id.id,
|
||||
voice_channel: channel_id,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
thread_id
|
||||
};
|
||||
|
||||
let _handler = manager.join(guild.id.0, channel_id.0).await;
|
||||
command
|
||||
.create_interaction_response(&ctx.http, |f| {
|
||||
f.interaction_response_data(|d| d.content("."))
|
||||
})
|
||||
.await?;
|
||||
|
||||
command.create_interaction_response(&ctx.http, |f| {
|
||||
f.interaction_response_data(|d| {
|
||||
d.embed(|e| {
|
||||
e.title("読み上げ (Serenity)")
|
||||
thread_id.send_message(&ctx.http, |f| f.embed(|e| e.title("読み上げ (Serenity)")
|
||||
.field("クレジット", "```\n四国めたん ずんだもん\n春日部つむぎ 雨晴はう\n波音リツ 玄野武宏\n白上虎太郎 青山龍星\n冥鳴ひまり 九州そら\nモチノ・キョウコ```", false)
|
||||
.field("設定コマンド", "`/config`", false)
|
||||
})
|
||||
})
|
||||
}).await?;
|
||||
)).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -7,10 +7,10 @@ pub async fn ready(ctx: Context, ready: Ready) {
|
||||
println!("{} is connected!", ready.user.name);
|
||||
|
||||
let _ = Command::set_global_application_commands(&ctx.http, |commands| {
|
||||
commands.create_application_command(|command| command.name("stop").description("Stop tts"));
|
||||
commands
|
||||
.create_application_command(|command| command.name("setup").description("Setup tts"));
|
||||
commands.create_application_command(|command| command.name("config").description("Config"))
|
||||
.create_application_command(|command| command.name("stop").description("Stop tts"))
|
||||
.create_application_command(|command| command.name("setup").description("Setup tts"))
|
||||
.create_application_command(|command| command.name("config").description("Config"))
|
||||
})
|
||||
.await;
|
||||
}
|
||||
|
Reference in New Issue
Block a user