Giter VIP home page Giter VIP logo

serverless-discord-bot's People

Contributors

dependabot[bot] avatar ytausch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

serverless-discord-bot's Issues

CreateCommandsInvoker update hangs when stack is in state UPDATE_ROLLBACK_COMPLETE

I've noticed that sam deploy hangs in this specific situation:

I do an unsuccessful deploy which has to be rolled back due to an error, which then puts the stack in state UPDATE_ROLLBACK_COMPLETE.

When I subsequently correct the error and call sam deploy again it hangs in this stage:

image

This is what I see in the stack:

image

Even deleting the stack becomes impossible after this because there's no way to stop the custom resource (at least I didn't find one), so I just have to wait for it to time out and delete it.

Any clue on how to fix this?

Stuck at "Sending Command..."

Hi thanks for this repo I'm trying to get it working.

After I've run sam deploy --guided, I can see the new command /hello shows up in my Discord with the correct description. When I hit enter it just stucks at "Sending Command...".

I can see the request actually gets sent to Lambda and the CloudWatch log shows:

Running command: hello (1049129300865065071, guild 740092388915019796)

Do you know why is it just stuck at "Sending Command..."?

Thanks!

Redis client is hanging deployment?

I'm attempting a very basic Redis integration in the file getBeastCommand.js. I replaced the original helloCommand.js file with it. The original hello deployment worked great, but when I changed the file to this and renamed it, the deployment hung on the step where it creates the 'Custom:CreateCommandsInvoker' resource, pictured here:
image

When I abort, it leaves me with an incomplete set of resources that interfere with further deployments, so I have to keep deleting them manually in all the different AWS services in order to try again, but it keeps failing at the same step. What am I doing wrong here?

const {SlashCommand, CommandOptionType} = require('slash-create');
const {createClient} = require('redis')

const host = 'MY_CLOUD_HOST'
const port = PORT_NUMBER
const username = 'MY_USERNAME'
const password = 'MY_DB_PASSWORD'

const client = createClient({
    url: `redis://${username}:${password}@${host}:${port}`
})

module.exports = class GetBeastCommand extends SlashCommand {
    constructor(creator) {
        super(creator, {
            name: 'get_beast',
            description: 'Grab a beast!',
            guildIDs: ['1054498243100295170'],
            options: [
                {
                    name: 'name',
                    description: 'The name of the beast you want to get.',
                    type: CommandOptionType.STRING
                }
            ]
        });
        this.filePath = __filename;
    }

    async run(ctx) {
        
        let name = ctx.options.name;
        const dbReply = await client.sendCommand('JSON.GET', 'beasts', '$.beasts')
        const beastList = JSON.parse(dbReply.value()?.valueOf())[0]
        const beast = beastList.map((beast)=>{ 
            if(beast['Name']==name){
                console.log('Found a match!')
                return beast
            }
        })[0]
        if(beast){
            ctx.send(`Here is the data for ${name}`, {
                embeds: [
                    {
                        title: beast['Name'],
                        fields: [
                            {name: 'Description', value: beast['Description']},
                            {name: 'Rarity', value: beast['Rarity']},
                            {name: 'Biome', value: beast['Biome']},
                            {name: 'HP', value: beast['HP'].toString()},
                            {name: 'DEF', value: beast['DEF'].toString()},
                            {name: 'SPD', value: beast['SPD'].toString()},
                            {name: 'Ability', value: beast['Ability']['Name']},
                            {name: 'Ability Power', value: beast['Ability']['Power'].toString()}
                        ],
                        image: {
                            url: beast['Image'],
                            height: 200,
                            width: 200
                        }
                    }
                ]
            })
        } else return "Sorry, I couldn't find that beast."
    }
};

No slash commands available

I'm trying to deploy initially and am trying to get helloCommand to work. I've placed all 3 secrets to /dev/serverless_discord_bot/discord, installed command_layer/nodejs packages, built then deployed. Also used my guildID in guildIDs string[] in the command file.

Slash commands aren't being created. The /event interaction endpoint is valid and verified but I can't see any slash commands in my server/guild. For OAuth I've selected bot and application.commands as scopes.

Application Commands permission enabled for everyone and bot roles:
image

Integration settings for bot in my server:
image
Permissions:
image

Interestingly, if I tried to do a slash command in a direct message, I can see there are commands associated with the bot in the UI but I don't have permissions to see them:
image
As oppose to in my server, where I do have the permissions but it shows there app has no commands.

Also CloudWatch logs for CreateCommandsFunction:
image

CreateCommandsInvoker stuck in CREATE_IN_PROGRESS

After running sam build and then sam deploy --guided my stack creation gets stuck in CREATE_IN_PROGRESS.

In the stack resources everything succeeds to create, except CreateCommandsInvoker, which is stuck. I have no idea how to debug this, any suggestions?

Edit:

Upon closer inspection figured that the lambda CreateCommands isn't finding the slash-create dependency but still haven't managed to solve it. Here's what I see in CloudWatch:

{
    "errorType": "Runtime.ImportModuleError",
    "errorMessage": "Error: Cannot find module 'slash-create'\nRequire stack:\n- /var/task/index.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js",
    "stack": [
        "Runtime.ImportModuleError: Error: Cannot find module 'slash-create'",
        "Require stack:",
        "- /var/task/index.js",
        "- /var/runtime/UserFunction.js",
        "- /var/runtime/index.js",
        "    at _loadUserApp (/var/runtime/UserFunction.js:100:13)",
        "    at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)",
        "    at Object.<anonymous> (/var/runtime/index.js:43:30)",
        "    at Module._compile (internal/modules/cjs/loader.js:1072:14)",
        "    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)",
        "    at Module.load (internal/modules/cjs/loader.js:937:32)",
        "    at Function.Module._load (internal/modules/cjs/loader.js:778:12)",
        "    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)",
        "    at internal/main/run_main_module.js:17:47"
    ]
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.