pub struct Line {
pub config: LineConfig,
client: Client,
pub image_buffer: HashMap<String, Vec<InputContent>>,
pub chat_history: Option<ChatHistory>,
pub history_timeout: Option<Instant>,
pub func_table: Option<FunctionTable<FunctionContext>>,
}
Expand description
LINE システムモジュール。
Option は遅延初期化。
Fields§
§config: LineConfig
設定データ。
client: Client
HTTP クライアント。
image_buffer: HashMap<String, Vec<InputContent>>
§chat_history: Option<ChatHistory>
ai コマンドの会話履歴。
history_timeout: Option<Instant>
§func_table: Option<FunctionTable<FunctionContext>>
OpenAI function 機能テーブル
Implementations§
Source§impl Line
impl Line
async fn init_openai(&mut self, ctrl: &Control)
pub async fn chat_history(&mut self, ctrl: &Control) -> &ChatHistory
pub async fn chat_history_mut(&mut self, ctrl: &Control) -> &mut ChatHistory
pub async fn func_table( &mut self, ctrl: &Control, ) -> &FunctionTable<FunctionContext>
Source§impl Line
impl Line
pub async fn get_profile(&self, user_id: &str) -> Result<ProfileResp>
pub async fn get_group_profile( &self, group_id: &str, user_id: &str, ) -> Result<ProfileResp>
Sourcepub async fn get_content(&self, message_id: &str) -> Result<Vec<u8>>
pub async fn get_content(&self, message_id: &str) -> Result<Vec<u8>>
コンテンツを取得する。
https://developers.line.biz/ja/reference/messaging-api/#get-content
Webhookで受信したメッセージIDを使って、ユーザーが送信した画像、動画、音声、 およびファイルを取得するエンドポイントです。 このエンドポイントは、Webhookイベントオブジェクトの contentProvider.typeプロパティがlineの場合にのみ利用できます。 ユーザーからデータサイズが大きい動画または音声が送られた場合に、 コンテンツのバイナリデータを取得できるようになるまで時間がかかるときがあります。 バイナリデータの準備中にコンテンツを取得しようとすると、 ステータスコード202が返されバイナリデータは取得できません。 バイナリデータが取得できるかどうかは、 動画または音声の取得準備の状況を確認するエンドポイントで確認できます。 なお、ユーザーが送信したコンテンツは、 縮小などの変換が内部的に行われる場合があります。
pub fn postpone_timeout(&mut self)
Sourcepub async fn check_history_timeout(&mut self, ctrl: &Control)
pub async fn check_history_timeout(&mut self, ctrl: &Control)
Self::image_buffer Self::chat_history にタイムアウトを適用する。
Sourcepub async fn reply(&self, reply_token: &str, text: &str) -> Result<ReplyResp>
pub async fn reply(&self, reply_token: &str, text: &str) -> Result<ReplyResp>
Self::reply_multi のシンプル版。 文字列が長すぎるならば分割して送信する。
Sourcepub async fn reply_multi(
&self,
reply_token: &str,
texts: &[&str],
) -> Result<ReplyResp>
pub async fn reply_multi( &self, reply_token: &str, texts: &[&str], ) -> Result<ReplyResp>
https://developers.line.biz/ja/reference/messaging-api/#send-reply-message
https://developers.line.biz/ja/docs/messaging-api/text-character-count/
texts
のそれぞれについて、長すぎるならば分割し、
文字列メッセージ配列として送信する。
配列の最大サイズは 5。
Sourceasync fn check_resp_json<'a, T>(resp: Response) -> Result<T>where
T: for<'de> Deserialize<'de>,
async fn check_resp_json<'a, T>(resp: Response) -> Result<T>where
T: for<'de> Deserialize<'de>,
async fn get_auth_json<'a, T>(&self, url: &str) -> Result<T>where
T: for<'de> Deserialize<'de>,
async fn post_auth_json<T, R>(&self, url: &str, body: &T) -> Result<R>
async fn get_auth_bin(&self, url: &str) -> Result<(StatusCode, Vec<u8>)>
Trait Implementations§
Source§impl SystemModule for Line
impl SystemModule for Line
Source§fn on_start(&mut self, _ctrl: &Control)
fn on_start(&mut self, _ctrl: &Control)
Auto Trait Implementations§
impl Freeze for Line
impl !RefUnwindSafe for Line
impl Send for Line
impl Sync for Line
impl Unpin for Line
impl !UnwindSafe for Line
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more