feat: initial prototype (#3)
Node.js CI / Lint and Test (push) Successful in 42s

### Explanation

_No response_

### Issue

_No response_

### Attestations

- [ ] I have read and agree to the [Code of Conduct](https://docs.nhcarrigan.com/community/coc/)
- [ ] I have read and agree to the [Community Guidelines](https://docs.nhcarrigan.com/community/guide/).
- [ ] My contribution complies with the [Contributor Covenant](https://docs.nhcarrigan.com/dev/covenant/).

### Dependencies

- [ ] I have pinned the dependencies to a specific patch version.

### Style

- [ ] I have run the linter and resolved any errors.
- [ ] My pull request uses an appropriate title, matching the conventional commit standards.
- [ ] My scope of feat/fix/chore/etc. correctly matches the nature of changes in my pull request.

### Tests

- [ ] My contribution adds new code, and I have added tests to cover it.
- [ ] My contribution modifies existing code, and I have updated the tests to reflect these changes.
- [ ] All new and existing tests pass locally with my changes.
- [ ] Code coverage remains at or above the configured threshold.

### Documentation

_No response_

### Versioning

_No response_

Reviewed-on: #3
Co-authored-by: Naomi Carrigan <commits@nhcarrigan.com>
Co-committed-by: Naomi Carrigan <commits@nhcarrigan.com>
This commit was merged in pull request #3.
This commit is contained in:
2025-08-14 23:14:08 -07:00
committed by Naomi Carrigan
parent f67291b8da
commit c9ec681471
35 changed files with 6265 additions and 0 deletions
+52
View File
@@ -0,0 +1,52 @@
/**
* @copyright NHCarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { errorHandler } from "../utils/errorHandler.js";
import { isTheme } from "../utils/typeguards.js";
import type { Command } from "../interfaces/command.js";
/**
* Handles the `/config` command.
* @param pavelle - Pavelle's instance.
* @param interaction - The interaction payload from Discord.
*/
export const config: Command = async(pavelle, interaction) => {
try {
const theme = interaction.options.getString("theme");
const spoiler = interaction.options.getBoolean("spoiler");
const query: { theme?: string; spoiler?: boolean } = {};
if (theme !== null && isTheme(theme)) {
query.theme = theme;
}
if (spoiler !== null) {
query.spoiler = spoiler;
}
const result = await pavelle.db.servers.upsert({
create: {
serverId: interaction.guild.id,
spoiler: spoiler ?? false,
theme: theme !== null && isTheme(theme)
? theme
: "cake",
},
update: query,
where: {
serverId: interaction.guild.id,
},
});
await interaction.editReply({
content: `Your settings have been updated! Your new settings are now:\nTheme: ${result.theme}\nSpoiler GIFs: ${result.spoiler.toString()}\n-# Omitted settings were not updated. If ${String(theme)} was not a valid theme, that setting has not been updated.`,
});
} catch (error) {
const id = await errorHandler(error, "config command");
await interaction.editReply({
content:
`An error occurred while processing your request. Please try again later, or join our support server and provide this ID: ${id}`,
});
}
};