The reasoning for making this bot was quite simple; I wanted a discord bot for TORN that I could modify and add features to. The main reason for starting this bot is in the name; WarStalk.
The original purpose was for faction members to be able to "stalk" their enemy faction members for a set period of time. With this stalking, users could tell when enemy sleep schedules were, what times they were online and flew, etc.
This quickly went onto the backburner as I started implementing simpler (and quicker-to-implement) commands, such as checking which faction members aren't in an Organized Crime, checking the status of all members of a given faction, etc.
Commands
Member-tied commands
get_faction_members → gets a list of faction members of a provided faction ID / faction NAME. If this target parameter is not provided, then it will get the user's faction.If this ID is -1, it gets the faction you're warring against.
faction_id: Target faction ID
link_members: Whether to hyperlink members of the faction that are printed. This might split the message up into multiple messages due to Discord's Embed and Message limits.
sort_by: What variable to sort members by, including:
Last Action (default)
UID
Level
Energy Items Usage (slow, takes API calls)
Playtime (slow, takes API calls)
FF Score (integration with ffscouter.com)
get_hospital_faction_members → lists the faction members of a specific faction who are in the hospital, with release time(s).
faction_id: Target faction ID. If left blank, uses your own faction.
link_members: Whether or not to hyperlink the members of the faction.
check_oc → lists members that are not a part (or a part) of any organized crimes in your faction.
is_in_oc: Whether to filter by if they ARE vs NOT in an OC. Default: false.
link_members: Whether or not to hyperlink the members of the faction.
Utility Commands
checkkey → gives you the API key you registered with the bot.
setapikey → (DMs ONLY) sets the api key tied to your discord account.
checkffscouterkey → checks your FF scouter API key that you've provided
setffscouterkey → sets your FF Scouter API key for the sorting method. This is not required for other functionality, thus it does not check for validity.
unregister → unregisters your API key from the bot.
ping → pings the bot to see if it's alive.
Stalking Commands (Coming Soon!)
The core stalking features are currently under development. Here's what's planned:
stalk: Begin stalking a user (or their entire faction, if they're in one).
get_stalk_report: Generate a report of a target's activity, including online times, travel history, and more.
If multiple people choose to stalk one person, or different people but they're in the same faction, API keys will be chosen at round-robin to lessen strain on users.
Other Planned Features
Integration with BSP
Whatever the community requests!
"Premium" module -- but not sure what to include in it
Table of Data Usage:
Data Storage:
Your API key, discord ID, and torn ID, and FF Scouter API Key will be stored until you unregister (Persistent until account deletion)
Stalking data will be stored for the forseeable future, until I run out of data (Persistent, forever)
Data Sharing:
Stalking data - upon request, everybody that registers and requests stalking data (this might change in the future with more 'premium' features planned, but that's in the future)
Anything you request in a discord server ("Guild") will be visible to those who have access to the channel.
Purpose of Use:
Non-malicious statistical analysis & Competitive Advantage (Knowing when other players' patterns of flight, online/offline activites, etc.)
Personal gain (hope to use this on my resume)
Key Storage & Sharing
Stored - only used for automation. Nobody except for myself will see your API keys, unless a breach happens, in which case I'll make an announcement in the development discord and using the bot.
Key Access Level
Limited
Future integrations with Fair Fight calculator are planned, and users will have to register on that website as well before using their API keys to request data from it.
I've noticed one (or two, depending on what you define as issues) issues with the /user/selections endpoint.
Number one is that the STRIPTAGS argument is completely disregarded for some reason, as setting it to either true or false doesn't affect the formatting of the response.
Here is a selection of userID [1980883], as an example.
STRIPTAGS set to TRUE, STRIPTAGS set to FALSE, it doesn't matter, it still shows;
status: { description: 'In hospital for 2 hrs 43 mins ', details: 'Hospitalized by OP81', state: 'Hospital', color: 'red', until: 1755862071 },
The second issue is a bit weirder, might just be a way to 'ease in' to the new API v2, but doing:
provides the exact same result, even though on the official 'try it' page of the v2 api, it uses the second as the 'example', which leads me to believe this is the 'correct' one. If the first one, with the slash, is meant to be there, then disregard this point completely.
I have seen that in getting armory news or anything that pertains to a 'backlog' of news, usually you would modify the 'to' parameter so that it would give you more news.
Sorry if this has been asked before; but is it impossible for more than 100 events to happen inside of a faction every second? Since the API uses unix timings, and sometimes if I'm lagging I manage to get two events in the same timeframe because I clicked the button twice to use an item from the armory, I was thinking—could a faction of 100 people (maxed out) all spam using items from the armory and get more than 100 actions per second, thereby freezing news API collection, or at least leaving some 'news' unlogged? Or is there a 100 limit?
I use the notes app extensively for documenting my crimes data, but one thing that annoys me is that:
When I scroll down, it never scrolls down to the end; there's always another line at the bottom that I have to down-arrow to. Usable on PC, although annoying, but SUPER annoying on mobile.
Video link is here (click) (leads to an external hosting provider, catbox.moe; didn't want to use a gif as those take time to process and are huge, at least for me)
Hello splent, thank you for the response! Regarding:
Could you provide a little bit more information about the specific selection..?
Yes, I was using the PROFILEselection here, the full URL beinghttps://api.torn.com/v2/user&selections=profile&id=$userId&striptags=true×tamp=$unixTimestamp
Until it's refactored I guess I'll have to use my own striptags algo in my code If you can let me know when the striptags arg works again so I can remove it, I'd greatly appreciate it! :)
edit: apparently the forums don't like the angle brackets (lessthan/greater than) I tried to escape them, that's why it looks weird.
The reasoning for making this bot was quite simple; I wanted a discord bot for TORN that I could modify and add features to. The main reason for starting this bot is in the name; WarStalk.
The original purpose was for faction members to be able to "stalk" their enemy faction members for a set period of time. With this stalking, users could tell when enemy sleep schedules were, what times they were online and flew, etc.
This quickly went onto the backburner as I started implementing simpler (and quicker-to-implement) commands, such as checking which faction members aren't in an Organized Crime, checking the status of all members of a given faction, etc.
Commands
Member-tied commands
get_faction_members → gets a list of faction members of a provided faction ID / faction NAME. If this target parameter is not provided, then it will get the user's faction.If this ID is -1, it gets the faction you're warring against.
faction_id: Target faction ID
link_members: Whether to hyperlink members of the faction that are printed. This might split the message up into multiple messages due to Discord's Embed and Message limits.
sort_by: What variable to sort members by, including:
Last Action (default)
UID
Level
Energy Items Usage (slow, takes API calls)
Playtime (slow, takes API calls)
FF Score (integration with ffscouter.com)
get_hospital_faction_members → lists the faction members of a specific faction who are in the hospital, with release time(s).
faction_id: Target faction ID. If left blank, uses your own faction.
link_members: Whether or not to hyperlink the members of the faction.
check_oc → lists members that are not a part (or a part) of any organized crimes in your faction.
is_in_oc: Whether to filter by if they ARE vs NOT in an OC. Default: false.
link_members: Whether or not to hyperlink the members of the faction.
Utility Commands
checkkey → gives you the API key you registered with the bot.
setapikey → (DMs ONLY) sets the api key tied to your discord account.
checkffscouterkey → checks your FF scouter API key that you've provided
setffscouterkey → sets your FF Scouter API key for the sorting method. This is not required for other functionality, thus it does not check for validity.
unregister → unregisters your API key from the bot.
ping → pings the bot to see if it's alive.
Stalking Commands (Coming Soon!)
The core stalking features are currently under development. Here's what's planned:
stalk: Begin stalking a user (or their entire faction, if they're in one).
get_stalk_report: Generate a report of a target's activity, including online times, travel history, and more.
If multiple people choose to stalk one person, or different people but they're in the same faction, API keys will be chosen at round-robin to lessen strain on users.
Other Planned Features
Integration with BSP
Whatever the community requests!
"Premium" module -- but not sure what to include in it
Table of Data Usage:
Data Storage:
Your API key, discord ID, and torn ID, and FF Scouter API Key will be stored until you unregister (Persistent until account deletion)
Stalking data will be stored for the forseeable future, until I run out of data (Persistent, forever)
Data Sharing:
Stalking data - upon request, everybody that registers and requests stalking data (this might change in the future with more 'premium' features planned, but that's in the future)
Anything you request in a discord server ("Guild") will be visible to those who have access to the channel.
Purpose of Use:
Non-malicious statistical analysis & Competitive Advantage (Knowing when other players' patterns of flight, online/offline activites, etc.)
Personal gain (hope to use this on my resume)
Key Storage & Sharing
Stored - only used for automation. Nobody except for myself will see your API keys, unless a breach happens, in which case I'll make an announcement in the development discord and using the bot.
Key Access Level
Limited
Future integrations with Fair Fight calculator are planned, and users will have to register on that website as well before using their API keys to request data from it.
note: it appears that because torn forums accept source code, the "Hospitalized by" appears as a link. As I do not know how to make 'block-comments', I'll just inform here that it is, infact, an HREF link.
I've noticed one (or two, depending on what you define as issues) issues with the /user/selections endpoint.
Number one is that the STRIPTAGS argument is completely disregarded for some reason, as setting it to either true or false doesn't affect the formatting of the response.
Here is a selection of userID [1980883], as an example.
STRIPTAGS set to TRUE, STRIPTAGS set to FALSE, it doesn't matter, it still shows;
status: { description: 'In hospital for 2 hrs 43 mins ', details: 'Hospitalized by OP81', state: 'Hospital', color: 'red', until: 1755862071 },
The second issue is a bit weirder, might just be a way to 'ease in' to the new API v2, but doing:
provides the exact same result, even though on the official 'try it' page of the v2 api, it uses the second as the 'example', which leads me to believe this is the 'correct' one. If the first one, with the slash, is meant to be there, then disregard this point completely.
I have seen that in getting armory news or anything that pertains to a 'backlog' of news, usually you would modify the 'to' parameter so that it would give you more news.
Sorry if this has been asked before; but is it impossible for more than 100 events to happen inside of a faction every second? Since the API uses unix timings, and sometimes if I'm lagging I manage to get two events in the same timeframe because I clicked the button twice to use an item from the armory, I was thinking—could a faction of 100 people (maxed out) all spam using items from the armory and get more than 100 actions per second, thereby freezing news API collection, or at least leaving some 'news' unlogged? Or is there a 100 limit?
follow-up question to this; is [scriptags] available for all API v2 selections, not just /faction/members? If so, that would be an absolute boon for my filtering as I: 1) wouldn't have to store so many strings in RAM
2) woudln't have to use godawful regex to extract names
I use the notes app extensively for documenting my crimes data, but one thing that annoys me is that:
When I scroll down, it never scrolls down to the end; there's always another line at the bottom that I have to down-arrow to. Usable on PC, although annoying, but SUPER annoying on mobile.
Video link is here (click) (leads to an external hosting provider, catbox.moe; didn't want to use a gif as those take time to process and are huge, at least for me)