Giter VIP home page Giter VIP logo

activecollab-discord-bot's People

Contributors

borningstar avatar kalvinpearce avatar rohancruickshank avatar rorydungan avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

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

Forkers

amishakov

activecollab-discord-bot's Issues

ActiveCollabBot keeps typing after sending message

After messaging the bot directly with most commands such as !wallofshame, !timereport or !times, the notification that the bot is typing appears after the message has been posted to the channel and never goes away. We should make sure that it stops "typing" as soon as the message is sent.

Time formatting is incorrect for total hours in time report

Leading zeroes are removed from the minutes value in the time report. To reproduce, log time with the total value for the week having a single digit number of minutes, then message the bot directly with the !timereport command. The field at the bottom will look like this: "Total: 38:0", when it should be this: "Total: 38:00".

Build failing on Node 10.0.0

Build succeeds on current LTS Node.js (8.11.1) and previous stable (9.8.0), but fails on 10.0.0.

https://travis-ci.org/Real-Serious-Games/activecollab-discord-bot/jobs/372847569

Assertion failed: Cannot send without a channel: undefined
Assertion failed: Channels not found for project ID: 1
Assertion failed: Project ID not valid: undefined
Assertion failed: Username not valid: undefined
 FAIL  test/discord.test.ts (10.982s)
  calling sendMessageToChannel
    ✓ should send message to channel when channel is valid (7ms)
    ✕ should error when channel is invalid (89ms)
  calling determineChannels
    ✓ should return channels when given valid project ID (2ms)
    ✓ should return found channels when given valid project ID and log warning  when not all channels found (1ms)
    ✕ should return ID not found error when channels for project ID not found (18ms)
    ✕ should return invalid ID error when project ID not valid (11ms)
    ✓ should return channel not found error when channel not found (1ms)
  calling getUserId
    ✓ should return user ID when input valid and exists in a guild (1ms)
    ✓ should throw error when guilds not found (1ms)
    ✕ should throw error when username invalid (13ms)
    ✓ should throw error when username not found in guild
  client receiving message
    ✓ should send help message when message is "!tasks" (26ms)
    ✓ should send help message when message is "!tasks" with unknown command (2ms)
    ✓ should send message when command is unknown (1ms)
    ✓ should send message when command is unknown task command (2ms)
    ✓ should send list of commands when command is !help (1ms)
    ✓ should send list of commands when command is !commands (2ms)
    ✓ should do nothing when message doesn't start with prefix or message sent with bot (1ms)
    ✓ should do nothing when message is empty and starts with prefix (2ms)
    when message is "!tasks create"
      ✓ should call commandController.createTask when command is sent from project channel (2ms)
      ✓ should call send message when creating task fails (2ms)
      ✓ should send warning message when channel type is not text (1ms)
      ✓ should send error message and log when error getting project ID (2ms)
    when message is "!tasks due"
      ✓ should call commandController.tasksDueThisWeekForProject when command is sent from project channel (6ms)
      ✓ should send warning message when channel type is not text (2ms)
      ✓ should send error message and log when error getting project ID (2ms)
    when command is "!tasks list"
      ✓ should call commandController.listTasksForUser when command all caps (2ms)
      ✓ should call commandController.listTasksForUser and send  message when command is "!tasks list for @user" (2ms)
    when message is "!tasks in <list>"
      ✓ should call commandController.taskInListForProject with list from command and project ID from channel (2ms)
      ✓ should send warning when channel type is not text (1ms)
      ✓ should send warning and log error when error getting project ID (4ms)
  ● calling sendMessageToChannel › should error when channel is invalid
    expect(function).toThrow(string)
    
    Expected the function to throw an error matching:
      "Cannot send without a channel: undefined"
    Instead, it threw:
      TypeError: Cannot read property 'send' of undefined
          117 |                     this.guildNames[channelMap.guildIndex] === textChannel.guild.name
          118 |                 )
        > 119 |             );
          120 | 
          121 |         let unfoundChannels = '';
          122 | 
          
          at DiscordController.sendMessageToChannel (src/controllers/discord.ts:119:9)
          at expect (test/discord.test.ts:29:22)
          at Object.<anonymous> (node_modules/expect/build/to_throw_matchers.js:42:7)
          at Object.throwingMatcher [as toThrow] (node_modules/expect/build/index.js:147:24)
          at Object.it (test/discord.test.ts:30:9)
      28 | 
      29 |         expect(() => discordController.sendMessageToChannel(undefined, undefined))
    > 30 |             .toThrow('Cannot send without a channel: undefined');
      31 |     });
      32 | });
      33 | 
      
      at Object.it (test/discord.test.ts:30:9)
  ● calling determineChannels › should return ID not found error when channels for project ID not found
    expect(function).toThrow(string)
    
    Expected the function to throw an error matching:
      "Channels not found for project ID: 1"
    Instead, it threw:
      TypeError: Cannot read property 'map' of undefined
          110 |             .client
          111 |             .channels
        > 112 |             .findAll('type', 'text')
          113 |             .map(channel => channel as discord.TextChannel)
          114 |             .filter(textChannel => channelMaps
          115 |                 .some(channelMap => 
    m      
          at DiscordController.determineChannels (src/controllers/discord.ts:112:30)
          at expect (test/discord.test.ts:165:40)
          at Object.<anonymous> (node_modules/expect/build/to_throw_matchers.js:42:7)
          at Object.throwingMatcher [as toThrow] (node_modules/expect/build/index.js:147:24)
          at Object.it (test/discord.test.ts:125:9)
      123 |                 name: 'channel',
      124 |                 guild: { name: guildNames[0]}
    > 125 |             } as TextChannel
      126 |         );
      127 | 
      128 |         const clientMock = new DiscordClientMockBuilder()
      
      at Object.it (test/discord.test.ts:125:9)
  ● calling determineChannels › should return invalid ID error when project ID not valid
    expect(function).toThrow(string)
    
    Expected the function to throw an error matching:
      "Project ID not valid: undefined"
    Instead, it threw:
      TypeError: Cannot read property 'map' of undefined
          110 |             .client
          111 |             .channels
        > 112 |             .findAll('type', 'text')
          113 |             .map(channel => channel as discord.TextChannel)
          114 |             .filter(textChannel => channelMaps
          115 |                 .some(channelMap => 
          
          at DiscordController.determineChannels (src/controllers/discord.ts:112:30)
          at expect (test/discord.test.ts:174:40)
          at Object.<anonymous> (node_modules/expect/build/to_throw_matchers.js:42:7)
          at Object.throwingMatcher [as toThrow] (node_modules/expect/build/index.js:147:24)
          at Object.it (test/discord.test.ts:131:9)
      129 |             .withChannels({
      130 |                 findAll: jest.fn().mockReturnValue(clientChannels)
    > 131 |             })
      132 |             .build();
      133 | 
      134 |         const warnMock = jest.fn();
      
      at Object.it (test/discord.test.ts:131:9)
  ● calling getUserId › should throw error when username invalid
    expect(function).toThrow(string)
    
    Expected the function to throw an error matching:
      "Username not valid: undefined"
    Instead, it threw:
      Guilds not found: Guild 1,Guild 2
          145 | 
          146 |         if (guilds.every(guild => guild === undefined)) {
        > 147 |             throw Error(`Guilds not found: ${this.guildNames}`);
          148 |         }
          149 | 
          150 |         const members = guilds
          
          at DiscordController.getUserId (src/controllers/discord.ts:147:19)
          at expect (test/discord.test.ts:267:40)
          at Object.<anonymous> (node_modules/expect/build/to_throw_matchers.js:42:7)
          at Object.throwingMatcher [as toThrow] (node_modules/expect/build/index.js:147:24)
          at Object.it (test/discord.test.ts:200:9)
      198 | 
    �[0m  199 |         const discordController = new DiscordControllerBuilder()
    > 200 |             .withClient(clientMock)
      201 |             .withGuildNames(guildNames)
      202 |             .withMappingController(mappingControllerMock)
      203 |             .build();
      
      at Object.it (test/discord.test.ts:200:9)

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.