Skip to content

Commit 09828f9

Browse files
jaredledvinabelak
authored andcommitted
[remind] Initial plugin (#82)
1 parent 8cd11aa commit 09828f9

10 files changed

Lines changed: 509 additions & 1 deletion

.sqlx/query-06d5062612c9cd9d4fe8126309e46d8f86c372f456221e320fc2937b0fc41faa.json

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.sqlx/query-221d70d937071d759a780e34c95dfccd170403511163dbea806d586ee126b988.json

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.sqlx/query-4f517de5fd07c14dd531c2f0fcec416947f8185b0e96519b5a1f80e55cb49ecf.json

Lines changed: 56 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.sqlx/query-d8869f1838ef2ea7490e88049378456f92821df1bad842c8d97ec4360fd0b143.json

Lines changed: 56 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.sqlx/query-fe22b047b068e08543e039bf77f7d0158a0bf55f88412504217efdab4a07eff2.json

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

migrations/7_remind.sql

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
CREATE TABLE IF NOT EXISTS reminders (
2+
id INTEGER PRIMARY KEY AUTOINCREMENT,
3+
channel_id TEXT NOT NULL,
4+
target_user TEXT NOT NULL,
5+
message TEXT NOT NULL,
6+
remind_at INTEGER NOT NULL,
7+
created_at INTEGER NOT NULL,
8+
created_by TEXT NOT NULL
9+
);
10+
11+
CREATE INDEX IF NOT EXISTS idx_reminders_remind_at ON reminders(remind_at);

src/client.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,10 @@ impl Client {
262262
},
263263
);
264264
}
265+
266+
pub fn get_db(&self) -> sqlx::SqlitePool {
267+
self.db_pool.clone()
268+
}
265269
}
266270

267271
#[derive(Clone, Debug)]
@@ -535,7 +539,7 @@ impl Context {
535539
}
536540

537541
pub fn get_db(&self) -> sqlx::SqlitePool {
538-
self.client.db_pool.clone()
542+
self.client.get_db()
539543
}
540544
}
541545

src/plugin.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ pub async fn load(bot: Arc<Client>) -> Result<Vec<PluginMetadata>> {
5454
"net_tools",
5555
"noaa",
5656
"quotes",
57+
"remind",
5758
"riddle",
5859
"scryfall",
5960
"introspection",
@@ -163,5 +164,9 @@ pub async fn load(bot: Arc<Client>) -> Result<Vec<PluginMetadata>> {
163164
ret.push(start_plugin::<plugins::HelpPlugin>(&bot)?);
164165
}
165166

167+
if config.plugin_enabled("remind") {
168+
ret.push(start_plugin::<plugins::RemindPlugin>(&bot)?);
169+
}
170+
166171
Ok(ret)
167172
}

src/plugins/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,6 @@ pub use self::quotes::QuotesPlugin;
3939

4040
mod help;
4141
pub use self::help::HelpPlugin;
42+
43+
mod remind;
44+
pub use self::remind::RemindPlugin;

0 commit comments

Comments
 (0)