-
-
Save shaunidiot/1e4aab19813f8d836cb20743b9528a93 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const SteamUser = require('steam-user'); | |
const SteamTotp = require('steam-totp'); | |
const SteamCommunity = require('steamcommunity'); | |
const TradeOfferManager = require('steam-tradeoffer-manager'); | |
class SteamBot { | |
constructor(options, clientOptions = {}, communityOptions = {}, managerOptions = {}) { | |
this.options = options; | |
this.client = new SteamUser(clientOptions); | |
this.community = new SteamCommunity(communityOptions); | |
const defaultManagerOptions = { | |
steam: this.client, | |
community: this.community | |
}; | |
managerOptions = Object.assign(defaultManagerOptions, managerOptions); | |
this.manager = new TradeOfferManager(managerOptions); | |
this.SteamTotp = SteamTotp; | |
/* | |
SteamUser Events | |
*/ | |
this.client.on('loggedOn', this.onLoggedOn.bind(this)); | |
this.client.on('steamGuard', this.onSteamGuard.bind(this)); | |
this.client.on('error', this.onError.bind(this)); | |
this.client.on('disconnected', this.onDisconnected.bind(this)); | |
this.client.on('sentry', this.onSentry.bind(this)); | |
this.client.on('webSession', this.onWebSession.bind(this)); | |
this.client.on('loginKey', this.onLoginKey.bind(this)); | |
this.client.on('newItems', this.onNewItems.bind(this)); | |
this.client.on('newComments', this.onNewComments.bind(this)); | |
this.client.on('tradeOffers,', this.onTradeOffers.bind(this)); | |
this.client.on('offlineMessages', this.onOfflineMessages.bind(this)); | |
this.client.on('vanityURL', this.onVanityURL.bind(this)); | |
this.client.on('accountInfo', this.onAccountInfo.bind(this)); | |
this.client.on('emailInfo', this.onEmailInfo.bind(this)); | |
this.client.on('accountLimitations', this.onAccountLimitations.bind(this)); | |
this.client.on('vacBans', this.onVacBans.bind(this)); | |
this.client.on('wallet', this.onWallet.bind(this)); | |
this.client.on('licenses', this.onLicenses.bind(this)); | |
this.client.on('gifts', this.onGifts.bind(this)); | |
this.client.on('appOwnershipCached', this.onAppOwnershipCached.bind(this)); | |
this.client.on('changelist', this.onChangelist.bind(this)); | |
this.client.on('appUpdate', this.onAppUpdate.bind(this)); | |
this.client.on('packageUpdate', this.onPackageUpdate.bind(this)); | |
this.client.on('marketingMessages', this.onMarketingMessages.bind(this)); | |
this.client.on('tradeRequest', this.onTradeRequest.bind(this)); | |
this.client.on('tradeResponse', this.onTradeResponse.bind(this)); | |
this.client.on('tradeStarted', this.onTradeStarted.bind(this)); | |
this.client.on('playingState', this.onPlayingState.bind(this)); | |
this.client.on('user', this.onUser.bind(this)); | |
this.client.on('group', this.onGroup.bind(this)); | |
this.client.on('groupEvent', this.onGroupEvent.bind(this)); | |
this.client.on('groupAnnouncement', this.onGroupAnnouncement.bind(this)); | |
this.client.on('friendRelationship', this.onFriendRelationship.bind(this)); | |
this.client.on('groupRelationship', this.onGroupRelationship.bind(this)); | |
this.client.on('friendsList', this.onFriendsList.bind(this)); | |
this.client.on('friendPersonasLoaded', this.onFriendPersonasLoaded.bind(this)); | |
this.client.on('groupList', this.onGroupList.bind(this)); | |
this.client.on('friendsGroupList', this.onFriendsGroupList.bind(this)); | |
this.client.on('nicknameList', this.onNicknameList.bind(this)); | |
this.client.on('friendOrChatMessage', this.onFriendOrChatMessage.bind(this)); | |
this.client.on('friendMessage', this.onFriendMessage.bind(this)); | |
this.client.on('friendTyping', this.onFriendTyping.bind(this)); | |
this.client.on('friendLeftConversation', this.onFriendLeftConversation.bind(this)); | |
this.client.on('friendMessageEcho', this.onFriendMessageEcho.bind(this)); | |
this.client.on('friendTypingEcho', this.onFriendTypingEcho.bind(this)); | |
this.client.on('chatMessage', this.onChatMessage.bind(this)); | |
this.client.on('chatHistory', this.onChatHistory.bind(this)); | |
this.client.on('chatInvite', this.onChatInvite.bind(this)); | |
this.client.on('chatCreated', this.onChatCreated.bind(this)); | |
this.client.on('chatEnter', this.onChatEnter.bind(this)); | |
this.client.on('chatLeft', this.onChatLeft.bind(this)); | |
this.client.on('chatUserJoined', this.onChatUserJoined.bind(this)); | |
this.client.on('chatUserLeft', this.onChatUserLeft.bind(this)); | |
this.client.on('chatUserDisconnected', this.onChatUserDisconnected.bind(this)); | |
this.client.on('chatUserKicked', this.onChatUserKicked.bind(this)); | |
this.client.on('chatUserBanned', this.onChatUserBanned.bind(this)); | |
this.client.on('chatUserSpeaking', this.onChatUserSpeaking.bind(this)); | |
this.client.on('chatUserDoneSpeaking', this.onChatUserDoneSpeaking.bind(this)); | |
this.client.on('chatSetPublic', this.onChatSetPublic.bind(this)); | |
this.client.on('chatSetPrivate', this.onChatSetPrivate.bind(this)); | |
this.client.on('chatSetOfficersOnly', this.onChatSetOfficersOnly.bind(this)); | |
this.client.on('chatSetPrivate', this.onChatSetPrivate.bind(this)); | |
this.client.on('lobbyInvite', this.onLobbyInvite.bind(this)); | |
/* | |
TradeOfferManager Events | |
*/ | |
this.manager.on('newOffer', this.onNewOffer.bind(this)); | |
this.manager.on('sentOfferChanged', this.onSentOfferChanged.bind(this)); | |
this.manager.on('sentOfferCanceled', this.onSentOfferCanceled.bind(this)); | |
this.manager.on('sentPendingOfferCanceled', this.onSentPendingOfferCanceled.bind(this)); | |
this.manager.on('unknownOfferSent', this.onUnknownOfferSent.bind(this)); | |
this.manager.on('receivedOfferChanged', this.onReceivedOfferChanged.bind(this)); | |
this.manager.on('realTimeTradeConfirmationRequired', this.onRealTimeTradeConfirmationRequired.bind(this)); | |
this.manager.on('realTimeTradeCompleted', this.onRealTimeTradeCompleted.bind(this)); | |
this.manager.on('pollFailure', this.onPollFailure.bind(this)); | |
this.manager.on('pollSuccess', this.onPollSuccess.bind(this)); | |
this.manager.on('pollData', this.onPollData.bind(this)); | |
this.manager.on('offerList', this.onOfferList.bind(this)); | |
/* | |
SteamCommunity Events | |
*/ | |
this.community.on('sessionExpired', this.onSessionExpired.bind(this)); | |
} | |
/* | |
SteamUser | |
*/ | |
onLoggedOn(details, parental) { } | |
onSteamGuard(domain, callback, lastCodeWrong) { } | |
onError(err) { } | |
onDisconnected(eresult, msg) { } | |
onSentry(sentry) { } | |
onWebSession(sessionID, cookies) { } | |
onLoginKey(key) { } | |
onNewItems(count) { } | |
onNewComments(count, myItems, discussions) { } | |
onTradeOffers(count) { } | |
onOfflineMessages(count, friends) { } | |
onVanityURL(url) { } | |
onAccountInfo(name, country, authedMachines, flags, facebookID, facebookName) { } | |
onEmailInfo(address, validated) { } | |
onAccountLimitations(limited, communityBanned, locked, canInviteFriends) { } | |
onVacBans(numBans, appids) { } | |
onWallet(hasWallet, currency, balance) { } | |
onLicenses(licenses) { } | |
onGifts(gifts) { } | |
onAppOwnershipCached() { } | |
onChangelist(changenumber, apps, packages) { } | |
onAppUpdate(appid, data) { } | |
onPackageUpdate(packageid, data) { } | |
onMarketingMessages(timestamp, messages) { } | |
onTradeRequest(steamID, respond) { } | |
onTradeResponse(steamID, response, restrictions) { } | |
onTradeStarted(steamID) { } | |
onPlayingState(blocked, playingApp) { } | |
onUser(sid, user) { } | |
onGroup(sid, group) { } | |
onGroupEvent(sid, headline, date, gid, gameID) { } | |
onGroupAnnouncement(sid, headline, gid) { } | |
onFriendRelationship(sid, relationship) { } | |
onGroupRelationship(sid, relationship) { } | |
onFriendsList() { } | |
onFriendPersonasLoaded() { } | |
onGroupList() { } | |
onFriendsGroupList(groups) { } | |
onNicknameList() { } | |
onFriendOrChatMessage(senderID, message, room) { } | |
onFriendMessage(senderID, message) { } | |
onFriendTyping(senderID) { } | |
onFriendLeftConversation(senderID) { } | |
onFriendMessageEcho(recipientID, message) { } | |
onFriendTypingEcho(recipientID) { } | |
onChatMessage(room, chatter, message) { } | |
onChatHistory(steamID, success, messages) { } | |
onChatInvite(inviterID, chatID, chatName) { } | |
onChatCreated(friendID, eresult, chatID) { } | |
onChatEnter(chatID, response) { } | |
onChatLeft(chatID) { } | |
onChatUserJoined(chatID, userID) { } | |
onChatUserLeft(chatID, userID) { } | |
onChatUserDisconnected(chatID, userID) { } | |
onChatUserKicked(chatID, userID, actor) { } | |
onChatUserBanned(chatID, userID, actor) { } | |
onChatUserSpeaking(chatID, userID) { } | |
onChatUserDoneSpeaking(chatID, userID) { } | |
onChatSetPublic(chatID, actor) { } | |
onChatSetPrivate(chatID, actor) { } | |
onChatSetOfficersOnly(chatID, actor) { } | |
onChatSetPrivate(chatID, actor) { } | |
onLobbyInvite(inviterID, lobbyID) { } | |
/* | |
TradeOfferManager | |
*/ | |
onNewOffer(offer) { } | |
onSentOfferChanged(offer, oldState) { } | |
onSentOfferCanceled(offer, reason) { } | |
onSentPendingOfferCanceled(offer) { } | |
onUnknownOfferSent(offer) { } | |
onReceivedOfferChanged(offer, oldState) { } | |
onRealTimeTradeConfirmationRequired(offer) { } | |
onRealTimeTradeCompleted(offer) { } | |
onPollFailure(err) { } | |
onPollSuccess() { } | |
onPollData(pollData) { } | |
onOfferList(filter, sent, received) { } | |
/* | |
SteamCommunity | |
*/ | |
onSessionExpired(err) { } | |
} | |
module.exports = SteamBot; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment