本文整理匯總了TypeScript中hubot.Response.send方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Response.send方法的具體用法?TypeScript Response.send怎麽用?TypeScript Response.send使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類hubot.Response
的用法示例。
在下文中一共展示了Response.send方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: loadState
robot.on('roll', (res: Response, roll: number, max: number) => {
// If someone rolled out of something other than 100, they are
// either not playing sniperino or trying to cheat.
if (max !== 100) {
return;
}
// If there are no active games then this was just an ordinary roll
const state = loadState(robot.brain);
const { name, id } = res.message.user;
const snipe = state.games[id];
if (snipe === undefined) {
return;
}
const {
gamesPlayed = 0,
gamesWon = 0
} = state.stats[id] || {};
// Play game
const event = playGame(roll, snipe);
state.stats[id] = {
gamesPlayed: (event !== GameEvent.Draw ? gamesPlayed + 1 : gamesPlayed),
gamesWon: (event === GameEvent.Win ? gamesWon + 1 : gamesWon),
userId: id,
};
res.send(stringFns[event]({ name, roll }));
delete state.games[id];
});
示例2: affixes
async function affixes(res: Response) {
const resp = await Axios.get<{ title: string }>(`${raiderIOUrl}/mythic-plus/affixes`, {
params: { region: 'us' },
});
res.send(resp.data.title);
}
示例3: ilevelList
async function ilevelList(res: Response) {
res.send(await makeRanking(
getIlvl,
i => i.ilvlEquip,
c => `${c.name}: ${c.ilvlEquip} (${c.ilvl})`,
));
}
示例4: raiderioScore
async function raiderioScore(res: Response) {
res.send(await makeRanking(
getRaiderIO,
i => i.mythic_plus_scores.all,
c => `${c.name}: ${c.mythic_plus_scores.all}`,
));
}
示例5: onResponse
async function onResponse(res: Response): Promise<void> {
const posts = await getCirclejerk(25);
const post = res.random(posts.data.children).data;
const messages = [post.title];
const extraField = post.domain.startsWith('self') ? post.selftext : post.url;
if (extraField !== '') {
messages.push(extraField);
}
res.send(...messages);
}