Compare commits
7 Commits
6ae1096d79
...
jude/fix-d
Author | SHA1 | Date | |
---|---|---|---|
9a6b65f3a3 | |||
b6ff149d51 | |||
748e33566b | |||
d7e90614c8 | |||
b5dbfe336d | |||
218be2f0b1 | |||
d7515f3611 |
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -2431,7 +2431,7 @@ checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "reminder-rs"
|
name = "reminder-rs"
|
||||||
version = "1.7.22"
|
version = "1.7.26"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
"chrono",
|
"chrono",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "reminder-rs"
|
name = "reminder-rs"
|
||||||
version = "1.7.22"
|
version = "1.7.27"
|
||||||
authors = ["Jude Southworth <judesouthworth@pm.me>"]
|
authors = ["Jude Southworth <judesouthworth@pm.me>"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "AGPL-3.0 only"
|
license = "AGPL-3.0 only"
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
import { ChannelSelector } from "./ChannelSelector";
|
import { ChannelSelector } from "./ChannelSelector";
|
||||||
import { DateTime } from "luxon";
|
|
||||||
import { IntervalSelector } from "./IntervalSelector";
|
import { IntervalSelector } from "./IntervalSelector";
|
||||||
import { useQuery } from "react-query";
|
import { useQuery } from "react-query";
|
||||||
import { fetchUserInfo } from "../../api";
|
import { fetchGuildInfo, fetchUserInfo } from "../../api";
|
||||||
import { useReminder } from "./ReminderContext";
|
import { useReminder } from "./ReminderContext";
|
||||||
import { Attachment } from "./Attachment";
|
import { Attachment } from "./Attachment";
|
||||||
import { TTS } from "./TTS";
|
import { TTS } from "./TTS";
|
||||||
@ -11,11 +10,12 @@ import { useGuild } from "../App/useGuild";
|
|||||||
|
|
||||||
export const Settings = () => {
|
export const Settings = () => {
|
||||||
const guild = useGuild();
|
const guild = useGuild();
|
||||||
const { isSuccess: userFetched, data: userInfo } = useQuery(fetchUserInfo());
|
const { isSuccess: userFetched, data: userInfo } = useQuery({ ...fetchUserInfo() });
|
||||||
|
const { isSuccess: guildFetched, data: guildInfo } = useQuery({ ...fetchGuildInfo(guild) });
|
||||||
|
|
||||||
const [reminder, setReminder] = useReminder();
|
const [reminder, setReminder] = useReminder();
|
||||||
|
|
||||||
if (!userFetched) {
|
if (!userFetched || !guildFetched) {
|
||||||
return <></>;
|
return <></>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +59,13 @@ export const Settings = () => {
|
|||||||
|
|
||||||
<div class="collapses split-controls">
|
<div class="collapses split-controls">
|
||||||
<div>
|
<div>
|
||||||
<div class={userInfo.patreon ? "patreon-only" : "patreon-only is-locked"}>
|
<div
|
||||||
|
class={
|
||||||
|
userInfo.patreon || guildInfo.patreon
|
||||||
|
? "patreon-only"
|
||||||
|
: "patreon-only is-locked"
|
||||||
|
}
|
||||||
|
>
|
||||||
<div class="patreon-invert foreground">
|
<div class="patreon-invert foreground">
|
||||||
Intervals available on <a href="https://patreon.com/jellywx">Patreon</a>{" "}
|
Intervals available on <a href="https://patreon.com/jellywx">Patreon</a>{" "}
|
||||||
or{" "}
|
or{" "}
|
||||||
|
@ -20,7 +20,7 @@ pub async fn delete_macro(
|
|||||||
SELECT m.id
|
SELECT m.id
|
||||||
FROM command_macro m
|
FROM command_macro m
|
||||||
INNER JOIN guilds
|
INNER JOIN guilds
|
||||||
ON guilds.guild = m.guild_id
|
ON guilds.id = m.guild_id
|
||||||
WHERE guild = ?
|
WHERE guild = ?
|
||||||
AND m.name = ?
|
AND m.name = ?
|
||||||
",
|
",
|
||||||
|
@ -13,9 +13,6 @@ pub async fn listener(
|
|||||||
data: &Data,
|
data: &Data,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
match event {
|
match event {
|
||||||
FullEvent::Ready { .. } => {
|
|
||||||
ctx.set_activity(Some(ActivityData::watching("for /remind")));
|
|
||||||
}
|
|
||||||
FullEvent::ChannelDelete { channel, .. } => {
|
FullEvent::ChannelDelete { channel, .. } => {
|
||||||
sqlx::query!("DELETE FROM channels WHERE channel = ?", channel.id.get())
|
sqlx::query!("DELETE FROM channels WHERE channel = ?", channel.id.get())
|
||||||
.execute(&data.database)
|
.execute(&data.database)
|
||||||
@ -58,9 +55,11 @@ To stay up to date on the latest features and fixes, join our [Discord](https://
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
FullEvent::GuildDelete { incomplete, .. } => {
|
FullEvent::GuildDelete { incomplete, .. } => {
|
||||||
let _ = sqlx::query!("DELETE FROM guilds WHERE guild = ?", incomplete.id.get())
|
if !incomplete.unavailable {
|
||||||
.execute(&data.database)
|
let _ = sqlx::query!("DELETE FROM guilds WHERE guild = ?", incomplete.id.get())
|
||||||
.await;
|
.execute(&data.database)
|
||||||
|
.await;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
FullEvent::InteractionCreate { interaction } => {
|
FullEvent::InteractionCreate { interaction } => {
|
||||||
if let Some(component) = interaction.clone().message_component() {
|
if let Some(component) = interaction.clone().message_component() {
|
||||||
|
@ -73,7 +73,6 @@ async fn check_self_permissions(ctx: Context<'_>) -> bool {
|
|||||||
if let Some(permissions) = app_permissions {
|
if let Some(permissions) = app_permissions {
|
||||||
return if permissions.send_messages()
|
return if permissions.send_messages()
|
||||||
&& permissions.embed_links()
|
&& permissions.embed_links()
|
||||||
&& permissions.view_channel()
|
|
||||||
&& manage_webhooks
|
&& manage_webhooks
|
||||||
{
|
{
|
||||||
true
|
true
|
||||||
@ -82,14 +81,12 @@ async fn check_self_permissions(ctx: Context<'_>) -> bool {
|
|||||||
.send(CreateReply::default().content(format!(
|
.send(CreateReply::default().content(format!(
|
||||||
"The bot appears to be missing some permissions:
|
"The bot appears to be missing some permissions:
|
||||||
|
|
||||||
{} **View Channel**
|
|
||||||
{} **Send Message**
|
{} **Send Message**
|
||||||
{} **Embed Links**
|
{} **Embed Links**
|
||||||
{} **Manage Webhooks**
|
{} **Manage Webhooks**
|
||||||
|
|
||||||
Please check the bot's roles, and any channel overrides. Alternatively, giving the bot
|
Please check the bot's roles, and any channel overrides. Alternatively, giving the bot
|
||||||
\"Administrator\" will bypass permission checks",
|
\"Administrator\" will bypass permission checks",
|
||||||
if permissions.view_channel() { "✅" } else { "❌" },
|
|
||||||
if permissions.send_messages() { "✅" } else { "❌" },
|
if permissions.send_messages() { "✅" } else { "❌" },
|
||||||
if permissions.embed_links() { "✅" } else { "❌" },
|
if permissions.embed_links() { "✅" } else { "❌" },
|
||||||
if manage_webhooks { "✅" } else { "❌" },
|
if manage_webhooks { "✅" } else { "❌" },
|
||||||
|
@ -39,6 +39,7 @@ use poise::serenity_prelude::{
|
|||||||
},
|
},
|
||||||
ClientBuilder,
|
ClientBuilder,
|
||||||
};
|
};
|
||||||
|
use serenity::all::ActivityData;
|
||||||
use sqlx::{MySql, Pool};
|
use sqlx::{MySql, Pool};
|
||||||
use tokio::sync::{broadcast, broadcast::Sender, RwLock};
|
use tokio::sync::{broadcast, broadcast::Sender, RwLock};
|
||||||
|
|
||||||
@ -283,8 +284,10 @@ async fn _main(tx: Sender<()>) -> Result<(), Box<dyn StdError + Send + Sync>> {
|
|||||||
.options(options)
|
.options(options)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let mut client =
|
let mut client = ClientBuilder::new(&discord_token, GatewayIntents::GUILDS)
|
||||||
ClientBuilder::new(&discord_token, GatewayIntents::GUILDS).framework(framework).await?;
|
.framework(framework)
|
||||||
|
.activity(ActivityData::watching("for /remind"))
|
||||||
|
.await?;
|
||||||
|
|
||||||
client.start_autosharded().await?;
|
client.start_autosharded().await?;
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ impl Data {
|
|||||||
guild_id: GuildId,
|
guild_id: GuildId,
|
||||||
) -> Result<Vec<CommandMacro>, Error> {
|
) -> Result<Vec<CommandMacro>, Error> {
|
||||||
let rows = sqlx::query!(
|
let rows = sqlx::query!(
|
||||||
"SELECT name, description, commands FROM macro WHERE guild_id = (SELECT id FROM guilds WHERE guild = ?)",
|
"SELECT name, description, commands FROM command_macro WHERE guild_id = (SELECT id FROM guilds WHERE guild = ?)",
|
||||||
guild_id.get()
|
guild_id.get()
|
||||||
)
|
)
|
||||||
.fetch_all(&self.database)
|
.fetch_all(&self.database)
|
||||||
@ -76,7 +76,7 @@ impl Data {
|
|||||||
guild_id,
|
guild_id,
|
||||||
name: row.name.clone(),
|
name: row.name.clone(),
|
||||||
description: row.description.clone(),
|
description: row.description.clone(),
|
||||||
commands: serde_json::from_str(&row.commands).unwrap(),
|
commands: serde_json::from_str(&row.commands.to_string()).unwrap(),
|
||||||
}).collect();
|
}).collect();
|
||||||
|
|
||||||
Ok(rows)
|
Ok(rows)
|
||||||
|
Reference in New Issue
Block a user