Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Settings Command Issue #841

Closed
1 of 2 tasks
LifeDreamer24 opened this issue Jun 25, 2023 · 9 comments
Closed
1 of 2 tasks

Settings Command Issue #841

LifeDreamer24 opened this issue Jun 25, 2023 · 9 comments
Labels
priority:p2 Issues and PRs: Medium priority status:confirmed Issues and PRs: Confirmed bug, or enhancement is confirmed to be added type:bug Issues and PRs: Related to a bug

Comments

@LifeDreamer24
Copy link

Describe the bug

The settings command is not working on my side...

Severity

Medium

Affected branches

  • Stable
  • Next

Quaver version

6.10.0-next.1

Steps to reproduce

  1. Type /settings

Expected behavior

Settings command should be working but does not. (For me)

Actual behavior

Says that the application didn't respond and it prints an error in the console.

Relevant log output

C:\Users\danle\Desktop\Quaver>npm start

> quaver@6.10.0-next.1 start
> node .

2023-06-25T12:05:20.181Z  INFO  Discord Connected. Logged in as Salidor#5984.
2023-06-25T12:05:20.183Z  INFO  Quaver Running version 6.10.0-next.1. For help, see https://github.com/ZPTXDev/Quaver/issues.
2023-06-25T12:05:20.183Z  WARN  Quaver You are running an unstable version of Quaver. Please report bugs using the link above, and note that features may change or be removed entirely prior to release.
2023-06-25T12:05:20.191Z  INFO  Lavalink Connected.
2023-06-25T12:05:24.389Z  INFO  Quaver [G 908777325875826738 | U 396489255364460547] Processing command settings
2023-06-25T12:05:24.390Z  INFO  Quaver [G 908777325875826738 | U 396489255364460547] Executing command settings
2023-06-25T12:05:24.394Z  ERROR  Quaver Received one or more errors
Error: Received one or more errors
    at UnionValidator.handle (C:\Users\danle\Desktop\Quaver\node_modules\@sapphire\shapeshift\dist\index.js:1099:23)
    at UnionValidator.parse (C:\Users\danle\Desktop\Quaver\node_modules\@sapphire\shapeshift\dist\index.js:207:88)
    at EmbedBuilder.setDescription (C:\Users\danle\Desktop\Quaver\node_modules\@discordjs\builders\dist\index.js:316:26)
    at buildSettingsPage (file:///C:/Users/danle/Desktop/Quaver/dist/lib/util/util.js:398:22)
    at async Object.execute (file:///C:/Users/danle/Desktop/Quaver/dist/commands/settings.js:19:48)
@LifeDreamer24 LifeDreamer24 added the type:bug Issues and PRs: Related to a bug label Jun 25, 2023
@github-actions github-actions bot added priority:p2 Issues and PRs: Medium priority status:proposed Issues and PRs: Pending confirmation labels Jun 25, 2023
@zapteryx
Copy link
Member

Thanks for the bug report! Could you help to verify if the issue persists on stable?

@LifeDreamer24
Copy link
Author

Oki let me check :D

@LifeDreamer24
Copy link
Author

Same thing sadly

Error: Received one or more errors
    at UnionValidator.handle (C:\Users\danle\Desktop\Quaver-6.9.2\node_modules\@sapphire\shapeshift\dist\index.js:1099:23)
    at UnionValidator.parse (C:\Users\danle\Desktop\Quaver-6.9.2\node_modules\@sapphire\shapeshift\dist\index.js:207:88)
    at EmbedBuilder.setDescription (C:\Users\danle\Desktop\Quaver-6.9.2\node_modules\@discordjs\builders\dist\index.js:307:26)
    at buildSettingsPage (file:///C:/Users/danle/Desktop/Quaver-6.9.2/dist/lib/util/util.js:398:22)
    at async Object.execute (file:///C:/Users/danle/Desktop/Quaver-6.9.2/dist/commands/settings.js:19:48)```

@zapteryx
Copy link
Member

That's a little odd, stable is tested to be working. Could you show your settings.json? (blur out any sensitive information like tokens!)

@LifeDreamer24
Copy link
Author

    "token": "X",
    "applicationId": "X",
    "clientSecret": "X",
    "colors": {
        "success": "#fbca18",
        "neutral": "#fbca18",
        "warning": "#fbca18",
        "error": "#fbca18"
    },
    "status": {
        "presence": "dnd",
        "activityType": "",
        "name": "",
        "url": "",
        "showVersion": false
    },
    "defaultLocaleCode": "en",
    "disableAd": true,
    "supportServer": "https://discord.gg/",
    "premiumURL": "https://example.com/premium",
    "managers": [
        "lifedreamer24"
    ],
    "database": {
        "protocol": "sqlite",
        "path": "../database.sqlite"
    },
    "lavalink": {
        "host": "localhost",
        "port": 12345,
        "password": "youshallnotpass",
        "secure": false,
        "reconnect": {
            "delay": 3000,
            "tries": 5
        }
    },
    "features": {
        "autolyrics": {
            "enabled": true,
            "whitelist": false,
            "premium": false
        },
        "stay": {
            "enabled": true,
            "whitelist": false,
            "premium": false
        },
        "smartqueue": {
            "enabled": true,
            "whitelist": false,
            "premium": false
        },
        "spotify": {
            "enabled": true,
            "client_id": "X",
            "client_secret": "X"
        },
        "web": {
            "enabled": false,
            "port": 3000,
            "allowedOrigins": [
                "http://localhost"
            ],
            "encryptionKey": "Type an encryption key here",
            "https": {
                "enabled": false,
                "key": "key.pem",
                "cert": "cert.pem"
            },
            "dashboardURL": "http://example.com"
        }
    }
}

@xayanide
Copy link
Member

xayanide commented Jun 25, 2023

Leaving the premiumURL property empty in settings.json will allow the /settings to command run properly.

As for the bug, i'll just post the relevant code involved as it's still unclear to me.
buildSettingsPage()

export async function buildSettingsPage(
    interaction: Interaction,
    guildLocaleCode: keyof typeof Language,
    option: SettingsPageOptions,
): Promise<SettingsPage> {
    let current: string,
        embeds: EmbedBuilder[] = [];
    const actionRow = new ActionRowBuilder<MessageActionRowComponentBuilder>();
    switch (option) {
        case 'premium': {
            current = '';
            actionRow.addComponents(
                new ButtonBuilder()
                    .setLabel(
                        await getGuildLocaleString(
                            interaction.guildId,
                            'MISC.GET_PREMIUM',
                        ),
                    )
                    .setStyle(ButtonStyle.Link)
                    .setURL(settings.premiumURL),
            );
            const whitelisted = {
                stay: await data.guild.get<number>(
                    interaction.guildId,
                    'features.stay.whitelisted',
                ),
                autolyrics: await data.guild.get<number>(
                    interaction.guildId,
                    'features.autolyrics.whitelisted',
                ),
                smartqueue: await data.guild.get<number>(
                    interaction.guildId,
                    'features.smartqueue.whitelisted',
                ),
            };
            const features = Object.keys(whitelisted)
                .filter(
                    (key: WhitelistedFeatures): boolean =>
                        settings.features[key].enabled &&
                        settings.features[key].whitelist &&
                        settings.features[key].premium,
                )
                .map(
                    (key: WhitelistedFeatures): string =>
                        `**${getLocaleString(
                            guildLocaleCode,
                            `CMD.SETTINGS.MISC.PREMIUM.FEATURES.${key.toUpperCase()}`,
                        )}** ─ ${
                            !whitelisted[key]
                                ? getLocaleString(
                                      guildLocaleCode,
                                      'CMD.SETTINGS.MISC.PREMIUM.DISPLAY.LOCKED.DEFAULT',
                                  )
                                : whitelisted[key] !== -1 &&
                                  Date.now() > whitelisted[key]
                                ? getLocaleString(
                                      guildLocaleCode,
                                      'CMD.SETTINGS.MISC.PREMIUM.DISPLAY.LOCKED.EXPIRED',
                                      Math.floor(
                                          whitelisted[key] / 1000,
                                      ).toString(),
                                  )
                                : whitelisted[key] === -1
                                ? getLocaleString(
                                      guildLocaleCode,
                                      'CMD.SETTINGS.MISC.PREMIUM.DISPLAY.UNLOCKED.PERMANENT',
                                  )
                                : getLocaleString(
                                      guildLocaleCode,
                                      'CMD.SETTINGS.MISC.PREMIUM.DISPLAY.UNLOCKED.TEMPORARY',
                                      Math.floor(
                                          whitelisted[key] / 1000,
                                      ).toString(),
                                  )
                        }`,
                );
             // features = []
            embeds = [
                new EmbedBuilder()
                    .setDescription(features.join('\n'))
                    .setColor(settings.colors.neutral),
            ];
            break;
        }

constants.js

export const settingsOptions = [
    ...(settings.premiumURL ? ['premium'] : []), // <--
    'language',
    'format',
    'dj',
    'autolyrics',
    'smartqueue',
];

@LifeDreamer24
Copy link
Author

Thanks alot!!

@zapteryx
Copy link
Member

    "managers": [
        "lifedreamer24"
    ],

@LifeDreamer24 I'd like to mention that managers here should be an array of IDs, so it'd look more like

    "managers": [
        "191739936871809024"
    ],

As for the issue, I'll take a closer look.

@zapteryx
Copy link
Member

Hi @LifeDreamer24, I've confirmed that the bug is related to the managers field. Try doing the step that I showed above and let me know if the bug still occurs. You can get your user ID here: https://support.discord.com/hc/en-us/articles/206346498-Where-can-I-find-my-User-Server-Message-ID-

@xayanide xayanide added status:confirmed Issues and PRs: Confirmed bug, or enhancement is confirmed to be added and removed status:proposed Issues and PRs: Pending confirmation labels Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority:p2 Issues and PRs: Medium priority status:confirmed Issues and PRs: Confirmed bug, or enhancement is confirmed to be added type:bug Issues and PRs: Related to a bug
Development

No branches or pull requests

3 participants