beta0
This commit is contained in:
parent
d8f42c1b25
commit
5230101a8d
70
Cargo.lock
generated
70
Cargo.lock
generated
@ -139,9 +139,9 @@ checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.0.71"
|
version = "1.0.72"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "79c2681d6594606957bbb8631c4b90a7fcaaa72cdb714743a437b156d6a7eedd"
|
checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfg-if"
|
name = "cfg-if"
|
||||||
@ -201,9 +201,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crc"
|
name = "crc"
|
||||||
version = "2.0.0"
|
version = "2.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "10c2722795460108a7872e1cd933a85d6ec38abc4baecad51028f702da28889f"
|
checksum = "49fc9a695bca7f35f5f4c15cddc84415f66a74ea78eef08e90c5024f2b540e23"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"crc-catalog",
|
"crc-catalog",
|
||||||
]
|
]
|
||||||
@ -705,9 +705,9 @@ checksum = "db13adb97ab515a3691f56e4dbab09283d0b86cb45abd991d8634a9d6f501760"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.105"
|
version = "0.2.107"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "869d572136620d55835903746bcb5cdc54cb2851fd0aeec53220b4bb65ef3013"
|
checksum = "fbe5e23404da5b4f555ef85ebed98fb4083e55a00c317800bc2a50ede9f3d219"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libm"
|
name = "libm"
|
||||||
@ -763,9 +763,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "minimal-lexical"
|
name = "minimal-lexical"
|
||||||
version = "0.1.4"
|
version = "0.2.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9c64630dcdd71f1a64c435f54885086a0de5d6a12d104d69b165fb7d5286d677"
|
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "miniz_oxide"
|
name = "miniz_oxide"
|
||||||
@ -819,9 +819,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nom"
|
name = "nom"
|
||||||
version = "7.0.0"
|
version = "7.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7ffd9d26838a953b4af82cbeb9f1592c6798916983959be223a7124e992742c1"
|
checksum = "1b1d11e1ef389c76fe5b81bcaf2ea32cf88b62bc494e19f493d0b30e7a930109"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memchr",
|
"memchr",
|
||||||
"minimal-lexical",
|
"minimal-lexical",
|
||||||
@ -850,9 +850,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-bigint"
|
name = "num-bigint"
|
||||||
version = "0.4.2"
|
version = "0.4.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "74e768dff5fb39a41b3bcd30bb25cf989706c90d028d1ad71971987aa309d535"
|
checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg 1.0.1",
|
"autocfg 1.0.1",
|
||||||
"num-integer",
|
"num-integer",
|
||||||
@ -932,9 +932,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "openssl"
|
name = "openssl"
|
||||||
version = "0.10.36"
|
version = "0.10.38"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8d9facdb76fec0b73c406f125d44d86fdad818d66fef0531eec9233ca425ff4a"
|
checksum = "0c7ae222234c30df141154f159066c5093ff73b63204dcda7121eb082fc56a95"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
@ -952,9 +952,9 @@ checksum = "28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "openssl-sys"
|
name = "openssl-sys"
|
||||||
version = "0.9.67"
|
version = "0.9.70"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "69df2d8dfc6ce3aaf44b40dec6f487d5a886516cf6879c49e98e0710f310a058"
|
checksum = "c6517987b3f8226b5da3661dad65ff7f300cc59fb5ea8333ca191fc65fde3edf"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg 1.0.1",
|
"autocfg 1.0.1",
|
||||||
"cc",
|
"cc",
|
||||||
@ -1187,7 +1187,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "reminder_rs"
|
name = "reminder_rs"
|
||||||
version = "1.5.1"
|
version = "1.6.0-beta0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64",
|
"base64",
|
||||||
"chrono",
|
"chrono",
|
||||||
@ -1407,9 +1407,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_json"
|
name = "serde_json"
|
||||||
version = "1.0.68"
|
version = "1.0.69"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0f690853975602e1bfe1ccbf50504d67174e3bcf340f23b5ea9992e0587a52d8"
|
checksum = "e466864e431129c7e0d3476b92f20458e5879919a0596c6472738d9fa2d342f8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itoa",
|
"itoa",
|
||||||
"ryu",
|
"ryu",
|
||||||
@ -1442,7 +1442,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "serenity"
|
name = "serenity"
|
||||||
version = "0.10.9"
|
version = "0.10.9"
|
||||||
source = "git+https://github.com/serenity-rs/serenity?branch=next#d1f944b0729a83d60925ce49b7d83eeaed83bd73"
|
source = "git+https://github.com/serenity-rs/serenity?branch=next#8d331b33171739ccecdc902faeefbcc7d32aa0eb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"async-tungstenite",
|
"async-tungstenite",
|
||||||
@ -1508,7 +1508,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "8eb4ea60fb301dc81dfc113df680571045d375ab7345d171c5dc7d7e13107a80"
|
checksum = "8eb4ea60fb301dc81dfc113df680571045d375ab7345d171c5dc7d7e13107a80"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"num-bigint 0.4.2",
|
"num-bigint 0.4.3",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
@ -1739,9 +1739,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tinyvec"
|
name = "tinyvec"
|
||||||
version = "1.5.0"
|
version = "1.5.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f83b2a3d4d9091d0abd7eba4dc2710b1718583bd4d8992e2190720ea38f391f7"
|
checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"tinyvec_macros",
|
"tinyvec_macros",
|
||||||
]
|
]
|
||||||
@ -1754,9 +1754,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio"
|
name = "tokio"
|
||||||
version = "1.12.0"
|
version = "1.13.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c2c2416fdedca8443ae44b4527de1ea633af61d8f7169ffa6e72c5b53d24efcc"
|
checksum = "588b2d10a336da58d877567cd8fb8a14b463e2104910f8132cd054b4b96e29ee"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg 1.0.1",
|
"autocfg 1.0.1",
|
||||||
"bytes",
|
"bytes",
|
||||||
@ -1774,9 +1774,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio-macros"
|
name = "tokio-macros"
|
||||||
version = "1.5.0"
|
version = "1.5.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b2dd85aeaba7b68df939bd357c6afb36c87951be9e80bf9c859f2fc3e9fca0fd"
|
checksum = "114383b041aa6212c579467afa0075fbbdd0718de036100bc0ba7961d8cb9095"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@ -1806,9 +1806,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio-stream"
|
name = "tokio-stream"
|
||||||
version = "0.1.7"
|
version = "0.1.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7b2f3f698253f03119ac0102beaa64f67a67e08074d03a22d18784104543727f"
|
checksum = "50145484efff8818b5ccd256697f36863f587da82cf8b409c53adf1e840798e3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
@ -1817,9 +1817,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio-util"
|
name = "tokio-util"
|
||||||
version = "0.6.8"
|
version = "0.6.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "08d3725d3efa29485e87311c5b699de63cde14b00ed4d256b8318aa30ca452cd"
|
checksum = "9e99e1983e5d376cd8eb4b66604d2e99e79f5bd988c3055891dcd8c9e2604cc0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
@ -2114,9 +2114,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "whoami"
|
name = "whoami"
|
||||||
version = "1.1.5"
|
version = "1.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "483a59fee1a93fec90eb08bc2eb4315ef10f4ebc478b3a5fadc969819cb66117"
|
checksum = "c33ac5ee236a4efbf2c98967e12c6cc0c51d93a744159a52957ba206ae6ef5f7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"web-sys",
|
"web-sys",
|
||||||
@ -2173,9 +2173,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zeroize_derive"
|
name = "zeroize_derive"
|
||||||
version = "1.2.0"
|
version = "1.2.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bdff2024a851a322b08f179173ae2ba620445aef1e838f0c196820eade4ae0c7"
|
checksum = "65f1a51723ec88c66d5d1fe80c841f17f63587d6691901d66be9bec6c3b51f73"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "reminder_rs"
|
name = "reminder_rs"
|
||||||
version = "1.5.1"
|
version = "1.6.0-beta0"
|
||||||
authors = ["jellywx <judesouthworth@pm.me>"]
|
authors = ["jellywx <judesouthworth@pm.me>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
@ -33,7 +33,6 @@ __Other Variables__
|
|||||||
* `IGNORE_BOTS` - default `1`, if `1`, Reminder Bot will ignore all other bots
|
* `IGNORE_BOTS` - default `1`, if `1`, Reminder Bot will ignore all other bots
|
||||||
* `PYTHON_LOCATION` - default `venv/bin/python3`. Can be changed if your Python executable is located somewhere else
|
* `PYTHON_LOCATION` - default `venv/bin/python3`. Can be changed if your Python executable is located somewhere else
|
||||||
* `THEME_COLOR` - default `8fb677`. Specifies the hex value of the color to use on info message embeds
|
* `THEME_COLOR` - default `8fb677`. Specifies the hex value of the color to use on info message embeds
|
||||||
* `CASE_INSENSITIVE` - default `1`, if `1`, commands will be treated with case insensitivity (so both `$help` and `$HELP` will work)
|
|
||||||
* `SHARD_COUNT` - default `None`, accepts the number of shards that are being ran
|
* `SHARD_COUNT` - default `None`, accepts the number of shards that are being ran
|
||||||
* `SHARD_RANGE` - default `None`, if `SHARD_COUNT` is specified, specifies what range of shards to start on this process
|
* `SHARD_RANGE` - default `None`, if `SHARD_COUNT` is specified, specifies what range of shards to start on this process
|
||||||
* `DM_ENABLED` - default `1`, if `1`, Reminder Bot will respond to direct messages
|
* `DM_ENABLED` - default `1`, if `1`, Reminder Bot will respond to direct messages
|
||||||
|
@ -22,10 +22,52 @@ fn footer(ctx: &Context) -> impl FnOnce(&mut CreateEmbedFooter) -> &mut CreateEm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[command]
|
||||||
|
#[description("Get an overview of the bot commands")]
|
||||||
|
async fn help(ctx: &Context, invoke: &mut CommandInvoke) {
|
||||||
|
let footer = footer(ctx);
|
||||||
|
|
||||||
|
let _ = invoke
|
||||||
|
.respond(
|
||||||
|
&ctx,
|
||||||
|
CreateGenericResponse::new().embed(|e| {
|
||||||
|
e.title("Help")
|
||||||
|
.color(*THEME_COLOR)
|
||||||
|
.description(
|
||||||
|
"__Info Commands__
|
||||||
|
`/help` `/info` `/donate` `/dashboard` `/clock`
|
||||||
|
*run these commands with no options*
|
||||||
|
|
||||||
|
__Reminder Commands__
|
||||||
|
`/remind` - Create a new reminder that will send a message at a certain time
|
||||||
|
`/timer` - Start a timer from now, that will count time passed. Also used to view and remove timers
|
||||||
|
|
||||||
|
__Reminder Management__
|
||||||
|
`/del` - Delete reminders
|
||||||
|
`/look` - View reminders
|
||||||
|
`/pause` - Pause all reminders on the channel
|
||||||
|
`/offset` - Move all reminders by a certain time
|
||||||
|
`/nudge` - Move all new reminders on this channel by a certain time
|
||||||
|
|
||||||
|
__Todo Commands__
|
||||||
|
`/todo` - Add, view and manage the server, channel or user todo lists
|
||||||
|
|
||||||
|
__Setup Commands__
|
||||||
|
`/timezone` - Set your timezone (necessary for `/remind` to work properly)
|
||||||
|
|
||||||
|
__Advanced Commands__
|
||||||
|
`/macro` - Record and replay command sequences
|
||||||
|
",
|
||||||
|
)
|
||||||
|
.footer(footer)
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
}
|
||||||
|
|
||||||
#[command]
|
#[command]
|
||||||
#[aliases("invite")]
|
#[aliases("invite")]
|
||||||
#[description("Get information about the bot")]
|
#[description("Get information about the bot")]
|
||||||
#[group("Info")]
|
|
||||||
async fn info(ctx: &Context, invoke: &mut CommandInvoke) {
|
async fn info(ctx: &Context, invoke: &mut CommandInvoke) {
|
||||||
let footer = footer(ctx);
|
let footer = footer(ctx);
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ use regex_command_attr::command;
|
|||||||
use serenity::{builder::CreateEmbed, client::Context, model::channel::Channel};
|
use serenity::{builder::CreateEmbed, client::Context, model::channel::Channel};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
check_subscription,
|
check_guild_subscription, check_subscription,
|
||||||
component_models::{
|
component_models::{
|
||||||
pager::{DelPager, LookPager, Pager},
|
pager::{DelPager, LookPager, Pager},
|
||||||
ComponentDataModel, DelSelector,
|
ComponentDataModel, DelSelector,
|
||||||
@ -164,7 +164,7 @@ async fn offset(ctx: &Context, invoke: &mut CommandInvoke, args: CommandOptions)
|
|||||||
UPDATE reminders
|
UPDATE reminders
|
||||||
INNER JOIN
|
INNER JOIN
|
||||||
`channels` ON `channels`.id = reminders.channel_id
|
`channels` ON `channels`.id = reminders.channel_id
|
||||||
SET reminders.`utc_time` = reminders.`utc_time` + ?
|
SET reminders.`utc_time` = DATE_ADD(reminders.`utc_time`, INTERVAL ? SECOND)
|
||||||
WHERE FIND_IN_SET(channels.`channel`, ?)",
|
WHERE FIND_IN_SET(channels.`channel`, ?)",
|
||||||
combined_time,
|
combined_time,
|
||||||
channels
|
channels
|
||||||
@ -647,7 +647,7 @@ DELETE FROM timers WHERE owner = ? AND name = ?
|
|||||||
required = false
|
required = false
|
||||||
)]
|
)]
|
||||||
#[arg(
|
#[arg(
|
||||||
name = "repeat",
|
name = "interval",
|
||||||
description = "(Patreon only) Time to wait before repeating the reminder. Leave blank for one-shot reminder",
|
description = "(Patreon only) Time to wait before repeating the reminder. Leave blank for one-shot reminder",
|
||||||
kind = "String",
|
kind = "String",
|
||||||
required = false
|
required = false
|
||||||
@ -666,11 +666,11 @@ DELETE FROM timers WHERE owner = ? AND name = ?
|
|||||||
)]
|
)]
|
||||||
#[hook(CHECK_GUILD_PERMISSIONS_HOOK)]
|
#[hook(CHECK_GUILD_PERMISSIONS_HOOK)]
|
||||||
async fn remind(ctx: &Context, invoke: &mut CommandInvoke, args: CommandOptions) {
|
async fn remind(ctx: &Context, invoke: &mut CommandInvoke, args: CommandOptions) {
|
||||||
if args.get("repeat").is_none() && args.get("expires").is_some() {
|
if args.get("interval").is_none() && args.get("expires").is_some() {
|
||||||
let _ = invoke
|
let _ = invoke
|
||||||
.respond(
|
.respond(
|
||||||
&ctx,
|
&ctx,
|
||||||
CreateGenericResponse::new().content("`expires` can only be used with `repeat`"),
|
CreateGenericResponse::new().content("`expires` can only be used with `interval`"),
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
@ -704,14 +704,21 @@ async fn remind(ctx: &Context, invoke: &mut CommandInvoke, args: CommandOptions)
|
|||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
|
||||||
if list.is_empty() {
|
if list.is_empty() {
|
||||||
|
if invoke.guild_id().is_some() {
|
||||||
vec![ReminderScope::Channel(invoke.channel_id().0)]
|
vec![ReminderScope::Channel(invoke.channel_id().0)]
|
||||||
|
} else {
|
||||||
|
vec![ReminderScope::User(invoke.author_id().0)]
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
list
|
list
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let (interval, expires) = if let Some(repeat) = args.get("repeat") {
|
let (interval, expires) = if let Some(repeat) = args.get("interval") {
|
||||||
if check_subscription(&ctx, invoke.author_id()).await {
|
if check_subscription(&ctx, invoke.author_id()).await
|
||||||
|
|| (invoke.guild_id().is_some()
|
||||||
|
&& check_guild_subscription(&ctx, invoke.guild_id().unwrap()).await)
|
||||||
|
{
|
||||||
(
|
(
|
||||||
humantime::parse_duration(&repeat.to_string())
|
humantime::parse_duration(&repeat.to_string())
|
||||||
.or_else(|_| {
|
.or_else(|_| {
|
||||||
@ -739,6 +746,25 @@ async fn remind(ctx: &Context, invoke: &mut CommandInvoke, args: CommandOptions)
|
|||||||
(None, None)
|
(None, None)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if interval.is_none() && args.get("interval").is_some() {
|
||||||
|
let _ = invoke
|
||||||
|
.respond(
|
||||||
|
&ctx,
|
||||||
|
CreateGenericResponse::new().content(
|
||||||
|
"Repeat interval could not be processed. Try and format the repetition similar to `1 hour` or `4 days`",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
} else if expires.is_none() && args.get("expires").is_some() {
|
||||||
|
let _ = invoke
|
||||||
|
.respond(
|
||||||
|
&ctx,
|
||||||
|
CreateGenericResponse::new().content(
|
||||||
|
"Expiry time failed to process. Please make it as clear as possible",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
} else {
|
||||||
let mut builder = MultiReminderBuilder::new(ctx, invoke.guild_id())
|
let mut builder = MultiReminderBuilder::new(ctx, invoke.guild_id())
|
||||||
.author(user_data)
|
.author(user_data)
|
||||||
.content(content)
|
.content(content)
|
||||||
@ -762,6 +788,7 @@ async fn remind(ctx: &Context, invoke: &mut CommandInvoke, args: CommandOptions)
|
|||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
None => {
|
None => {
|
||||||
let _ = invoke
|
let _ = invoke
|
||||||
.respond(&ctx, CreateGenericResponse::new().content("Time could not be processed"))
|
.respond(&ctx, CreateGenericResponse::new().content("Time could not be processed"))
|
||||||
|
29
src/main.rs
29
src/main.rs
@ -68,18 +68,6 @@ struct Handler;
|
|||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
impl EventHandler for Handler {
|
impl EventHandler for Handler {
|
||||||
async fn cache_ready(&self, ctx: Context, _: Vec<GuildId>) {
|
|
||||||
let framework = ctx
|
|
||||||
.data
|
|
||||||
.read()
|
|
||||||
.await
|
|
||||||
.get::<RegexFramework>()
|
|
||||||
.cloned()
|
|
||||||
.expect("RegexFramework not found in context");
|
|
||||||
|
|
||||||
framework.build_slash(ctx).await;
|
|
||||||
}
|
|
||||||
|
|
||||||
async fn channel_delete(&self, ctx: Context, channel: &GuildChannel) {
|
async fn channel_delete(&self, ctx: Context, channel: &GuildChannel) {
|
||||||
let pool = ctx
|
let pool = ctx
|
||||||
.data
|
.data
|
||||||
@ -210,7 +198,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
|||||||
}))
|
}))
|
||||||
.dm_enabled(dm_enabled)
|
.dm_enabled(dm_enabled)
|
||||||
// info commands
|
// info commands
|
||||||
//.add_command("help", &info_cmds::HELP_COMMAND)
|
.add_command(&info_cmds::HELP_COMMAND)
|
||||||
.add_command(&info_cmds::INFO_COMMAND)
|
.add_command(&info_cmds::INFO_COMMAND)
|
||||||
.add_command(&info_cmds::DONATE_COMMAND)
|
.add_command(&info_cmds::DONATE_COMMAND)
|
||||||
.add_command(&info_cmds::DASHBOARD_COMMAND)
|
.add_command(&info_cmds::DASHBOARD_COMMAND)
|
||||||
@ -267,6 +255,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
|||||||
data.insert::<RecordingMacros>(Arc::new(RwLock::new(HashMap::new())));
|
data.insert::<RecordingMacros>(Arc::new(RwLock::new(HashMap::new())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
framework_arc.build_slash(&client.cache_and_http.http).await;
|
||||||
|
|
||||||
if let Ok((Some(lower), Some(upper))) = env::var("SHARD_RANGE").map(|sr| {
|
if let Ok((Some(lower), Some(upper))) = env::var("SHARD_RANGE").map(|sr| {
|
||||||
let mut split =
|
let mut split =
|
||||||
sr.split(',').map(|val| val.parse::<u64>().expect("SHARD_RANGE not an integer"));
|
sr.split(',').map(|val| val.parse::<u64>().expect("SHARD_RANGE not an integer"));
|
||||||
@ -316,3 +306,16 @@ pub async fn check_subscription(cache_http: impl CacheHttp, user_id: impl Into<U
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn check_guild_subscription(
|
||||||
|
cache_http: impl CacheHttp,
|
||||||
|
guild_id: impl Into<GuildId>,
|
||||||
|
) -> bool {
|
||||||
|
if let Some(guild) = cache_http.cache().unwrap().guild(guild_id) {
|
||||||
|
let owner = guild.owner_id;
|
||||||
|
|
||||||
|
check_subscription(&cache_http, owner).await
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user