Skip to content

Commit

Permalink
⚡ chore (release 🤖): Stelle v2.5 is out! 🎉
Browse files Browse the repository at this point in the history
v1 -> v2
  • Loading branch information
EvilG-MC committed Jun 24, 2024
2 parents 2f56eaa + 37d9ab0 commit 2a4c338
Show file tree
Hide file tree
Showing 13 changed files with 78 additions and 757 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "stelle-music",
"version": "0.2.4-BLAZER",
"version": "0.2.5-BLAZER",
"description": "A music bot.",
"main": "./dist/index.js",
"type": "module",
Expand Down Expand Up @@ -42,13 +42,14 @@
"kazagumo-spotify": "^2.1.0",
"ms": "^2.1.3",
"seyfert": "github:tiramisulabs/seyfert",
"shoukaku": "github:shipgirlproject/Shoukaku"
"shoukaku": "github:shipgirlproject/Shoukaku",
"yunaforseyfert": "github:SagiriIkeda/yunaforseyfert#dev"
},
"devDependencies": {
"@biomejs/biome": "^1.8.2",
"@types/humanize-duration": "^3.27.4",
"@types/ms": "^0.7.34",
"@types/node": "^20.14.7",
"@types/node": "^20.14.8",
"husky": "^9.0.11",
"lint-staged": "^15.2.7",
"prisma": "^5.15.1",
Expand All @@ -62,7 +63,6 @@
"#stelle/middlwares": "./dist/middlewares/index.js",
"#stelle/errors": "./dist/structures/utils/Errors.js",
"#stelle/decorators": "./dist/structures/utils/Decorators.js",
"#stelle/parser": "./dist/structures/parser/index.js",
"#stelle/index": "./dist/index.js",
"#stelle/data/*": "./dist/structures/utils/data/*",
"#stelle/utils/*": "./dist/structures/utils/*"
Expand Down
42 changes: 29 additions & 13 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 19 additions & 1 deletion src/commands/developer/eval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ import { StelleOptions } from "#stelle/decorators";
import { Configuration } from "#stelle/data/Configuration.js";
import { codeBlock, getDepth, sliceText } from "#stelle/utils/functions/utils.js";

import { DeclareParserConfig, ParserRecommendedConfig, Watch, Yuna } from "yunaforseyfert";
import { SECRETS_MESSAGES, SECRETS_REGEX } from "#stelle/data/Constants.js";

import { DeclareParserConfig, ParserRecommendedConfig } from "#stelle/parser";
import ms from "ms";

const options = {
code: createStringOption({
Expand All @@ -42,6 +43,23 @@ const options = {
@StelleOptions({ onlyDeveloper: true })
@DeclareParserConfig(ParserRecommendedConfig.Eval)
export default class EvalCommand extends Command {
@Watch({
idle: ms("1min"),
beforeCreate(ctx) {
const userWatcher = Yuna.watchers.findInstances(ctx.client, {
userId: ctx.author.id,
command: this,
});
if (!userWatcher) return;

const [watcher] = userWatcher.instances;

watcher?.stopAll("Another instance of command created.");
},
onStop(reason) {
this.ctx?.editOrReply({ content: `Watcher stoped: ${reason}`, embeds: [] });
},
})
async run(ctx: CommandContext<typeof options>): Promise<Message | WebhookMessage | void> {
const { client, options, author, member, channelId } = ctx;

Expand Down
2 changes: 2 additions & 0 deletions src/commands/guild/default/engine.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { type CommandContext, Declare, LocalesT, Options, SubCommand, createStringOption } from "seyfert";
import { Shortcut } from "yunaforseyfert";

const engines: Record<string, string> = {
spotify: "Spotify",
Expand Down Expand Up @@ -37,6 +38,7 @@ const options = {
})
@Options(options)
@LocalesT("locales.default.subcommands.engine.name", "locales.default.subcommands.engine.description")
@Shortcut()
export default class EngineSubcommand extends SubCommand {
async run(ctx: CommandContext<typeof options>) {
const { client, options, guildId } = ctx;
Expand Down
22 changes: 14 additions & 8 deletions src/structures/client/Stelle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Client, LimitedCollection } from "seyfert";
import type { InternalRuntime, InternalStelleRuntime, StelleConfiguration } from "#stelle/types";

import { StelleMiddlewares } from "#stelle/middlwares";
import { YunaParser } from "#stelle/parser";

import { Configuration } from "#stelle/data/Configuration.js";
import { getWatermark } from "#stelle/utils/Logger.js";
Expand All @@ -14,6 +13,8 @@ import { customContext, stelleRC } from "#stelle/utils/functions/utils.js";
import { StelleDatabase } from "./modules/Database.js";
import { StelleManager } from "./modules/Manager.js";

import { HandleCommand } from "seyfert/lib/commands/handle.js";
import { Yuna } from "yunaforseyfert";
import { THINK_MESSAGES } from "#stelle/data/Constants.js";

/**
Expand Down Expand Up @@ -46,23 +47,17 @@ export class Stelle extends Client<true> {
},
},
commands: {
reply: () => true,
prefix: async (message) => {
const guildPrefix = await this.database.getPrefix(message.guildId!);
return [...new Set([guildPrefix, this.config.defaultPrefix, ...this.config.prefixes])];
},
reply: () => true,
defaults: {
onBotPermissionsFail,
onOptionsError,
onPermissionsFail,
onRunError,
},
argsParser: YunaParser({
useUniqueNamedSyntaxAtSameTime: true,
enabled: {
namedOptions: ["-", "--"],
},
}),
deferReplyResponse: ({ client }) => ({
content: `<a:typing:1214253750093488149> **${client.me.username}** ${
THINK_MESSAGES[Math.floor(Math.random() * THINK_MESSAGES.length)]
Expand Down Expand Up @@ -93,6 +88,17 @@ export class Stelle extends Client<true> {

this.setServices({
middlewares: StelleMiddlewares,
handleCommand: class extends HandleCommand {
argsParser = Yuna.parser({
syntax: {
namedOptions: ["-", "--"],
},
});
resolveCommandFromContent = Yuna.resolver({
client: this.client,
afterPrepare: (metadata) => this.client.logger.debug(`Client - Ready to use ${metadata.commands.length} commands.`),
});
},
langs: {
default: this.config.defaultLocale,
aliases: {
Expand Down
5 changes: 0 additions & 5 deletions src/structures/parser/README.md

This file was deleted.

2 changes: 0 additions & 2 deletions src/structures/parser/index.ts

This file was deleted.

47 changes: 0 additions & 47 deletions src/structures/parser/utils/parser/choicesResolver.ts

This file was deleted.

Loading

0 comments on commit 2a4c338

Please sign in to comment.