Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alias csids_save { ; by westor
- if ($1) && (c isin $1) { var %output = .msg $2 ( $+ $3 $+ ): }
- if (!$1) { var %output = echo -a }
- var %v = csid_ $+ $ticks
- var %u = http://api.steampowered.com/ISteamApps/GetAppList/v0001/
- JSONOpen -ud %v %u
- if (%JSONError) {
- %output Error: There was an connection error while trying to save the game ids database! - (Error details: %JSONError $+ )
- unset %updatelistrun
- JSONClose %v
- return
- }
- var %tot
- var %f = games-ids.txt
- var %t = $JSON(%v,applist,apps,app,length)
- var %i = $lines(%f)
- if (!%i) { var %i = 0 }
- while (%i <= %t) {
- var %id = $json(%v,applist,apps,app,%i,appid)
- var %desc = $json(%v,applist,apps,app,%i,name)
- if (%id) && (%desc) { write $qt(%f) %id %desc | inc %tot 1 }
- inc %i
- }
- %output The Game IDs database has been updated. - (Total Saved: $+ $iif(%tot,$v1,0) $+ )
- unset %updatelistrun
- JSONClose %v
- }
- ON !*:TEXT:*:#: { ; by westor
- tokenize 32 $strip($1-)
- if ($1 == !gameid) {
- if (!$2) { .msg $chan ( $+ $nick $+ ): Error, Please specify an number! | return }
- if ($2 !isnum) { .msg $chan ( $+ $nick $+ ): Error, Please specify only numbers! | return }
- if ($2 isnum) && ($2 !isalnum) { .msg $chan ( $+ $nick $+ ): Error, Please specify only digital numbers! | return }
- var %f = games-ids.txt
- if (!$isfile(%f)) { .msg $chan ( $+ $nick $+ ): Error, There is NOT any games-ids database available! | return }
- if (!$lines(%f)) { .msg $chan ( $+ $nick $+ ): Error, The games-ids database is currently empty! | return }
- var %r = $read(%f,nw,$2 $+ *)
- var %game = $gettok(%r,2-,32)
- if (!%game) { .msg $chan ( $+ $nick $+ ): The $qt($2) ID does NOT exist on the database! }
- elseif (%game) { .msg $chan ( $+ $nick $+ ): The $qt($2) ID is $qt(%game) game. }
- }
- if ($1 == !gamename) || ($1 == !gamedesc) {
- if (!$2) { .msg $chan ( $+ $nick $+ ): Error, Please specify a game name! | return }
- var %f = games-ids.txt
- if (!$isfile(%f)) { .msg $chan ( $+ $nick $+ ): Error, There is NOT any games-ids database available! | return }
- if (!$lines(%f)) { .msg $chan ( $+ $nick $+ ): Error, The games-ids database is currently empty! | return }
- var %r = $read(%f,nw,* $+ $2- $+ *)
- if ($gettok(%r,2-,32) !== $2-) { .msg $chan ( $+ $nick $+ ): Error, The $qt($2-) Game does NOT match with the given try again and check your typo! | return }
- var %id = $gettok(%r,1,32)
- if (!%id) { .msg $chan ( $+ $nick $+ ): The $qt($2-) Game ID does NOT exist on the database! }
- elseif (%id) { .msg $chan ( $+ $nick $+ ): The $qt($2-) Game ID is $qt(%id) id. }
- }
- if ($1 == !updategamelist) {
- if (%updatelistrun) { return }
- set -e %updatelistrun $ctime
- .msg $chan ( $+ $nick $+ ): Updating the Games IDs database, This progress may take some minutes to complete, Please wait...
- .timer[CSIDS] 1 1 csids_save -c $chan $nick
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement