/** * Fetch this message. * @param {boolean} [force=false] Whether to skip the cache check and request the API * @returns {Promise<Message>} */ fetch(force = false) { return this.channel.messages.fetch(this.id, true, force); }
/** * The Message object of the last message in the channel, if one was sent * @type {?Message} * @readonly */ get lastMessage() { return this.messages.cache.get(this.lastMessageID) || null; }
test('webpack import resolver is used if webpack.config.js is found', async t => { const cwd = 'fixtures/webpack/with-config/'; const {results} = await fn.lintFiles(path.resolve(cwd, 'file1.js'), { cwd, rules: { 'import/no-unresolved': 2 } }); t.is(results[0].errorCount, 1); const errorMessage = results[0].messages[0].message; t.truthy(/Unable to resolve path to module 'inexistent'/.exec(errorMessage)); });
const hasRule = (results, filePath, ruleId) => { const result = results.find(x => x.filePath === filePath); return result ? result.messages.some(x => x.ruleId === ruleId) : false; }
describe('response with mixed formats (0.10 MessageSet + 0.11 RecordBatch)', () => { test('decode only the 0.10 messages, 0.11 should be decoded on the next request', async () => { const data = await decode(Buffer.from(require('../fixtures/v4_response_mixed_formats.json'))) const messagesMagicBytes = data.responses[0].partitions[0].messages.map(m => m.magicByte) // the fixture is too big, jest deepCheck matcher takes too long to compare the object, // and the purpose of the test is to check if the decoder can skip the 0.11 on this request expect(new Set(messagesMagicBytes)).toEqual(new Set([1])) }) })
/** * Removes all users from this reaction. * @returns {Promise<MessageReaction>} */ async remove() { await this.client.api .channels(this.message.channel.id) .messages(this.message.id) .reactions(this._emoji.identifier) .delete(); return this; }
mailgun.messages().send(removeUndefined(msg), function(err) { if (err) { reject(err); } else { resolve(); } });
async _fetchId(messageID, cache, force) { if (!force) { const existing = this.cache.get(messageID); if (existing && !existing.partial) return existing; } const data = await this.client.api.channels[this.channel.id].messages[messageID].get(); return this.add(data, cache); }
/** * The Message object of the last message sent by the user, if one was sent * @type {?Message} * @readonly */ get lastMessage() { const channel = this.client.channels.cache.get(this.lastMessageChannelID); return (channel && channel.messages.cache.get(this.lastMessageID)) || null; }
async _fetchMany(options = {}, cache) { const data = await this.client.api.channels[this.channel.id].messages.get({ query: options }); const messages = new Collection(); for (const message of data) messages.set(message.id, this.add(message, cache)); return messages; }
isEmpty() { return this.messages.length === 0 }
/** * The Message object of the last message sent by the member in their guild, if one was sent * @type {?Message} * @readonly */ get lastMessage() { const channel = this.guild.channels.cache.get(this.lastMessageChannelID); return (channel && channel.messages.cache.get(this.lastMessageID)) || null; }
mailgun.messages().send(removeUndefined(msg), function(err) { if (err) { reject(err); } else { resolve(); } });