Git Product home page Git Product logo

crown-bot's People

Contributors

jakestanger avatar kometh0616 avatar pazuzu156 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

crown-bot's Issues

TypeError: Cannot read property 'id' of undefined

I'm using the newest version of the bot.

 TypeError: Cannot read property 'id' of undefined
data:    index.js:1095 -     at CrownsCommand.run (/home/arcyvilk/crown-bot/src/commands/crowns.js:43:30)
data:    index.js:1095 -     at CrownsCommand.execute (/home/arcyvilk/crown-bot/src/handler/Command.js:14:24)
data:    index.js:1095 -     at module.exports (/home/arcyvilk/crown-bot/src/events/message.js:11:19)
data:    index.js:1095 -     at CrownBot.emit (events.js:160:13)
data:    index.js:1095 -     at MessageCreateHandler.handle (/home/arcyvilk/crown-bot/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34)
data:    index.js:1095 -     at WebSocketPacketManager.handle (/home/arcyvilk/crown-bot/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:105:65)
data:    index.js:1095 -     at WebSocketConnection.onPacket (/home/arcyvilk/crown-bot/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:333:35)
data:    index.js:1095 -     at WebSocketConnection.onMessage (/home/arcyvilk/crown-bot/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:296:17)
data:    index.js:1095 -     at WebSocket.onMessage (/home/arcyvilk/crown-bot/node_modules/ws/lib/event-target.js:120:16)
data:    index.js:1095 -     at WebSocket.emit (events.js:160:13)
data:    index.js:1095 -     at Receiver.receiverOnMessage (/home/arcyvilk/crown-bot/node_modules/ws/lib/websocket.js:789:20)
data:    index.js:1095 -     at Receiver.emit (events.js:160:13)
data:    index.js:1095 -     at Receiver.dataMessage (/home/arcyvilk/crown-bot/node_modules/ws/lib/receiver.js:422:14)
data:    index.js:1095 -     at Receiver.getData (/home/arcyvilk/crown-bot/node_modules/ws/lib/receiver.js:352:17)
data:    index.js:1095 -     at Receiver.startLoop (/home/arcyvilk/crown-bot/node_modules/ws/lib/receiver.js:138:22)
data:    index.js:1095 -     at Receiver._write (/home/arcyvilk/crown-bot/node_modules/ws/lib/receiver.js:74:10)
data:    index.js:1095 -     at doWrite (_stream_writable.js:407:12)
data:    index.js:1095 -     at writeOrBuffer (_stream_writable.js:393:5)
data:    index.js:1095 -     at Receiver.Writable.write (_stream_writable.js:290:11)
data:    index.js:1095 -     at TLSSocket.socketOnData (/home/arcyvilk/crown-bot/node_modules/ws/lib/websocket.js:864:35)
data:    index.js:1095 -     at TLSSocket.emit (events.js:160:13)
data:    index.js:1095 -     at addChunk (_stream_readable.js:269:12)

The related code:

let user
        if (args.length > 0) {
            if (cmds.includes(args[0])) {
                const command = require(`./crowns/${args[0]}`)
                await command.run(client, message, args.slice(1))
                return
            } else {
                user = message.mentions.members.first()
            }
        } else {
            user = message.member
        }
        const crowns = await client.models.crowns.findAll({
            where: {
                guildID: message.guild.id,
                userID: user.id // <= here the bug triggers
            }
        })

TypeError: Cannot read property 'username' of null

I'm using the newest version of the bot.

data:    index.js:1095 - TypeError: Cannot read property 'username' of null
data:    index.js:1095 -     at WhoKnowsCommand.run (/home/arcyvilk/crown-bot/src/commands/whoknows.js:30:28)
data:    index.js:1095 -     at <anonymous>

Looks like there's no error proofing in case where the user cannot be found by ID.

const user = await users.findOne({
            where: {
                userID: message.author.id
            }
        })
        let artistName
        if (args.length === 0) {
            const params = stringify({
                method: 'user.getrecenttracks',
                user: user.username, // <= this bugs out
                api_key: client.apikey,
                format: 'json',
            })

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.