pub struct Discord {
config: DiscordConfig,
wakeup_list: Vec<NaiveTime>,
ctx: Option<Context>,
postponed_msgs: Vec<String>,
auto_del_config: BTreeMap<ChannelId, AutoDeleteConfig>,
chat_history: Option<ChatHistory>,
chat_timeout: Option<Instant>,
func_table: Option<FunctionTable<()>>,
}
Expand description
Discord システムモジュール。
Option は遅延初期化。
Fields§
§config: DiscordConfig
設定データ。
wakeup_list: Vec<NaiveTime>
定期実行の時刻リスト。
ctx: Option<Context>
現在有効な Discord Client コンテキスト。
起動直後は None で、event_handler イベントの度に置き換わる。
postponed_msgs: Vec<String>
Self::ctx が None の間に発言しようとしたメッセージのキュー。
Some になるタイミングで全て送信する。
auto_del_config: BTreeMap<ChannelId, AutoDeleteConfig>
自動削除機能の設定データ。
chat_history: Option<ChatHistory>
ai コマンドの会話履歴。
chat_timeout: Option<Instant>
Self::chat_history の有効期限。
func_table: Option<FunctionTable<()>>
OpenAI function 機能テーブル
Implementations§
Source§impl Discord
impl Discord
Sourcepub fn new(wakeup_list: Vec<NaiveTime>) -> Result<Self>
pub fn new(wakeup_list: Vec<NaiveTime>) -> Result<Self>
コンストラクタ。
設定データの読み込みのみ行い、実際の初期化は async が有効になる discord_main で行う。
async fn init_openai(&mut self, ctrl: &Control)
fn chat_history(&mut self) -> &ChatHistory
fn chat_history_mut(&mut self) -> &mut ChatHistory
fn func_table(&self) -> &FunctionTable<()>
Sourcefn check_history_timeout(&mut self)
fn check_history_timeout(&mut self)
Self::chat_history にタイムアウトを適用する。
Trait Implementations§
Source§impl SystemModule for Discord
impl SystemModule for Discord
Source§fn on_start(&mut self, ctrl: &Control)
fn on_start(&mut self, ctrl: &Control)
async 使用可能になってからの初期化。
設定有効ならば discord_main を spawn する。
Auto Trait Implementations§
impl Freeze for Discord
impl !RefUnwindSafe for Discord
impl Send for Discord
impl Sync for Discord
impl Unpin for Discord
impl !UnwindSafe for Discord
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
Mutably borrows from an owned value. Read more
§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>
Converts
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>
Converts
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