本文整理汇总了TypeScript中steam.SteamClient类的典型用法代码示例。如果您正苦于以下问题:TypeScript SteamClient类的具体用法?TypeScript SteamClient怎么用?TypeScript SteamClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SteamClient类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
Collections.Tips.findOne({"recipient.id": chatterID, "unregisteredUser": true}, function(err: Error, tip: any) {
if (err) {
bot.sendMessage(chatterID, reportError(err, "Retrieving tip in +accept"));
return;
}
if (!tip) {
bot.sendMessage(chatterID, "There are no pending tips involving you");
return;
}
async.parallel([
function(callback) {
Collections.Tips.update({"_id": tip["_id"]}, {$set: {accepted: true}}, {multi: true}, callback);
},
function(callback) {
// Delete the autoregistered attribute because that user is now fully registered
Collections.Users.update({"id": chatterID}, {$unset: {"autoregistered": ""}}, callback);
}
], function(err: Error) {
if (err) {
bot.sendMessage(chatterID, reportError(err, "async.parallel in +accept"));
}
bot.sendMessage(chatterID, "Congrats, your tip of " + tip.amount + " Gamerscoins from " + tip.sender.name + " was accepted! Welcome to Gamerscoin next generation Trade community");
bot.sendMessage(chatterID, "You can open up the group chat and double click on my name in the sidebar (with the gold star) to send me commands in the future.");
bot.sendMessage(chatterID, "Send '+help' to see all of the available commands.");
bot.sendMessage(chatterID, "If you have any questions or suggestions, please start a discussion within the group. RazeTheRoof <petschekr@gmail.com> is this bot's author so send any hate/love mail his way.");
});
});
示例2: function
bot.on('loggedOn', function ()
{
console.log("Success Fully logged on!");
bot.setPersonaState(Steam.EPersonaState.Online); // to display your bot's status as "Online"
bot.setPersonaName(STEAMNAME); // to change its nickname
});
示例3:
setTimeout(function(): void {
bot.sendMessage(steamID, "Go to the GamersTradeBase Tip group to message me. I can't accept friend requests.");
bot.sendMessage(steamID, "Removing friend...");
setTimeout(function(): void {
bot.removeFriend(steamID);
}, 2000);
}, 2000);
示例4: stringifyAndEscape
gamerscoin.move(giveawayInfo.account, chatterID, amountToGive, 1, stringifyAndEscape(tipComment), function(err: any, success: boolean) {
if (err) {
bot.sendMessage(chatterID, reportError(err, "Moving balance for a giveaway"));
return;
}
bot.sendMessage(chatterID, "As part of the current giveaway, you've been given " + amountToGive + " Gamerscoin! You can use that Gamerscoins to tip others on Steam and help spread the word!");
});
示例5: if
gamerscoin.sendFrom(chatterID, donationAddress, donationAmount, function(err: any, txid: string) {
if (err) {
if (err.code === -4) {
// Wallet probably doesn't have enough funds
reportError({message: "Insufficient server funds to complete donation request", id: chatterID, address: donationAddress, amount: donationAmount}, "Donating funds");
bot.sendMessage(chatterID, "Sorry, the server doesn't have enough funds currently to complete that request. Most of the server's funds are kept offline in cold wallets to increase security. This bot's maintainer (RazeTheRoof) has been notified of the server's insufficient balance. He will fix this shortly. If this problem persists, please don't hesitate to email him at <petschekr@gmail.com>.");
}
else if (err.code === -6) {
bot.sendMessage(chatterID, "You have insufficient funds to donate " + donationAmount + " Gamerscoins");
bot.sendMessage(chatterID, "Your current balance is: " + balance + " Gamerscoins");
}
else {
bot.sendMessage(chatterID, reportError({code: err.code, id: chatterID, address: donationAddress, amount: donationAmount}, "Donating funds"));
}
return;
}
bot.sendMessage(chatterID, "Your donation of " + donationAmount + " Gamerscoins was successfully donated. (Donation address: " + donationAddress + ")\nTxID for this donation is: " + txid + "\nThank you very much for your support of this project.");
// Record the donation in the database
Collections.Donations.insert({
"sender": {
"name": user.name,
"id": chatterID
},
"amount": donationAmount,
"USD": donationAmount * prices["GMC/USD"],
"timestamp": Date.now(),
"time": new Date().toString(),
"groupID": GamersTipGroupID,
}, {w:1}, function(err): void {
if (err) {
err.txid = txid;
bot.sendMessage(chatterID, reportError(err, "Inserting donation into the database"));
return;
}
});
// Reimburse the user for their transaction fee
gamerscoin.getTransaction(txid, function(err: any, txInfo: any) {
if (err) {
bot.sendMessage(chatterID, reportError(err, "Retrieving tx info in +donate"));
return;
}
var fee: number = Math.abs(txInfo.fee);
if (fee === 0) {
bot.sendMessage(chatterID, "The transaction fee was 0 Gamerscoins");
return;
}
gamerscoin.move("FeePool", chatterID, fee, function(err: any, success: boolean) {
if (err) {
bot.sendMessage(chatterID, reportError(err, "Reimbursing the user for their transaction fee"));
return;
}
bot.sendMessage(chatterID, "The transaction fee of " + fee + " Gamerscoins has been reimbursed");
});
});
});