Compare commits
1 commit
Author | SHA1 | Date | |
---|---|---|---|
9c734b5248 |
|
@ -42,7 +42,8 @@ export async function execute(interaction: ContextMenuCommandInteraction) {
|
||||||
|
|
||||||
if (!dt.getConfessionById(guildId!, targetId)) {
|
if (!dt.getConfessionById(guildId!, targetId)) {
|
||||||
return interaction.reply({
|
return interaction.reply({
|
||||||
content: "Either that confession wasn't found or you aren't allowed to remove it.",
|
content:
|
||||||
|
"Either that confession wasn't found or you aren't allowed to remove it.",
|
||||||
...messageOpts
|
...messageOpts
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,10 +16,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
import { ChatInputCommandInteraction, Events } from "discord.js";
|
||||||
ChatInputCommandInteraction,
|
|
||||||
Events
|
|
||||||
} from "discord.js";
|
|
||||||
import { BotClient, BOT_TOKEN, deployCommands } from "./bot";
|
import { BotClient, BOT_TOKEN, deployCommands } from "./bot";
|
||||||
import { commands } from "./commands";
|
import { commands } from "./commands";
|
||||||
import { StoreMan } from "./storeman";
|
import { StoreMan } from "./storeman";
|
||||||
|
@ -34,6 +31,8 @@ const logger = new Logger("Main");
|
||||||
|
|
||||||
BotClient.once("ready", client => {
|
BotClient.once("ready", client => {
|
||||||
logger.log(`We're ready! Logged in as ${client.user.tag}`);
|
logger.log(`We're ready! Logged in as ${client.user.tag}`);
|
||||||
|
|
||||||
|
dt.sendReleaseNotes();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Deploy the commands for a new guild
|
// Deploy the commands for a new guild
|
||||||
|
|
|
@ -26,8 +26,16 @@ import {
|
||||||
GuildSettings
|
GuildSettings
|
||||||
} from "./types";
|
} from "./types";
|
||||||
import { DATA_DIR } from "./config";
|
import { DATA_DIR } from "./config";
|
||||||
import { CommandInteraction, Message } from "discord.js";
|
import {
|
||||||
|
bold,
|
||||||
|
CommandInteraction,
|
||||||
|
heading,
|
||||||
|
Message,
|
||||||
|
TextChannel,
|
||||||
|
unorderedList
|
||||||
|
} from "discord.js";
|
||||||
import Logger from "../utils/Logger";
|
import Logger from "../utils/Logger";
|
||||||
|
import { BotClient } from "../bot";
|
||||||
|
|
||||||
export class StoreMan {
|
export class StoreMan {
|
||||||
public static readonly fullPath: string =
|
public static readonly fullPath: string =
|
||||||
|
@ -103,7 +111,8 @@ export class StoreMan {
|
||||||
this.data.push({
|
this.data.push({
|
||||||
id: guildId,
|
id: guildId,
|
||||||
confessions: [],
|
confessions: [],
|
||||||
settings: opts
|
settings: opts,
|
||||||
|
versionNote: "v0.1.1"
|
||||||
});
|
});
|
||||||
|
|
||||||
this.saveFile();
|
this.saveFile();
|
||||||
|
@ -127,6 +136,33 @@ export class StoreMan {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public sendReleaseNotes(): void {
|
||||||
|
for (const guild of this.data) {
|
||||||
|
if (!guild.settings.modChannel) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (guild.versionNote !== "v0.1.1") {
|
||||||
|
// TODO: Manual release notes for now
|
||||||
|
const channel = BotClient.channels.cache.get(guild.settings.modChannel);
|
||||||
|
const content =
|
||||||
|
heading("🎉 Release v0.1.1\n") +
|
||||||
|
unorderedList([
|
||||||
|
"No notable changes with this release, just popping in to say hi! :)",
|
||||||
|
"You'll get updates about future releases right here in the mod channel!"
|
||||||
|
]) +
|
||||||
|
"\n\n" +
|
||||||
|
bold("Full Changelog: ") +
|
||||||
|
"https://codeberg.org/powermaker450/confoss/commits/tag/v0.1.1";
|
||||||
|
|
||||||
|
(channel as TextChannel).send(content).catch(StoreMan.logger.log);
|
||||||
|
guild.versionNote = "v0.1.1";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.saveFile();
|
||||||
|
}
|
||||||
|
|
||||||
// Attempts to add a confession. Returns true if the confession is sent, false if otherwise.
|
// Attempts to add a confession. Returns true if the confession is sent, false if otherwise.
|
||||||
public addConfession(
|
public addConfession(
|
||||||
message: Message,
|
message: Message,
|
||||||
|
@ -182,7 +218,10 @@ export class StoreMan {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getConfessionById(guildId: string, messageId: string): Confession | null {
|
public getConfessionById(
|
||||||
|
guildId: string,
|
||||||
|
messageId: string
|
||||||
|
): Confession | null {
|
||||||
for (const guild of this.data) {
|
for (const guild of this.data) {
|
||||||
if (guild.id === guildId) {
|
if (guild.id === guildId) {
|
||||||
for (const confession of guild.confessions) {
|
for (const confession of guild.confessions) {
|
||||||
|
|
|
@ -44,6 +44,7 @@ export interface GuildSettings {
|
||||||
|
|
||||||
export interface GuildData {
|
export interface GuildData {
|
||||||
id: string;
|
id: string;
|
||||||
|
versionNote?: "v0.1.1";
|
||||||
confessions: Confession[];
|
confessions: Confession[];
|
||||||
settings: GuildSettings;
|
settings: GuildSettings;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue