oberknecht-api
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -32,3 +32,3 @@ import { jsonsplitter } from "@jubewe/jsonsplitter"; | ||
clearChat: (broadcaster_id: string, customtoken?: string) => Promise<void>; | ||
getUsers: (logins: string | string[], ids: string | string[], noautofilterids: boolean, customtoken?: string) => Promise<import("../types/endpoints/_getUsers").getUsersResolveType>; | ||
getUsers: (logins: string | string[], ids?: string | string[], noautofilterids?: boolean, customtoken?: string) => Promise<import("../types/endpoints/_getUsers").getUsersResolveType>; | ||
shoutout: (from_broadcaster_id: string, to_broadcaster_id: string, customtoken?: string) => Promise<void>; | ||
@@ -35,0 +35,0 @@ timeout: (broadcaster_id: string, target_user_id: string, duration: string, reason?: string, customtoken?: string) => Promise<import("../types/endpoints/ban").banResponse>; |
@@ -19,3 +19,3 @@ "use strict"; | ||
ids_ = [...ids_, ...idsinlogins]; | ||
idsinlogins.forEach((a) => logins_.splice(logins_.indexOf(a))); | ||
logins_ = logins_.filter(a => !__1.i.regex.numregex().test(a)); | ||
} | ||
@@ -22,0 +22,0 @@ } |
@@ -15,5 +15,3 @@ "use strict"; | ||
let logins_ = (0, oberknecht_utils_1.convertToArray)(logins, false).map((a) => (0, oberknecht_utils_1.cleanChannelName)(a)); | ||
let ids_ = (0, oberknecht_utils_1.convertToArray)(ids, false) | ||
.map((a) => String(a)?.toLowerCase()) | ||
.filter((a) => oberknecht_utils_1.regex.numregex().test(a)); | ||
let ids_ = (0, oberknecht_utils_1.convertToArray)(ids, false).filter((a) => typeof a === "number" || oberknecht_utils_1.regex.numregex().test(a.toString())); | ||
if (customtoken ?? undefined) { | ||
@@ -47,8 +45,10 @@ await (0, _validatetoken_1._validatetoken)(undefined, customtoken) | ||
let urlPath = ["twitch", "users"]; | ||
let url = `${urls_1.urls._url(...urlPath)}${(0, oberknecht_utils_1.joinUrlQuery)("login", chunkLogins, true)}${(0, oberknecht_utils_1.joinUrlQuery)("id", chunkIDs, chunkLogins.length == 0 ? true : false)}`; | ||
if (__1.i.apiclientData[sym]._options?.use3rdparty?.getUsers) | ||
let url = `${urls_1.urls._url(...urlPath)}${(0, oberknecht_utils_1.joinUrlQuery)(["login", "id"], [chunkLogins, chunkIDs], true)}`; | ||
if (__1.i.apiclientData[sym]._options?.use3rdparty?.getUsers) { | ||
urlPath = ["ivrfitwitch", "users"]; | ||
url = `${urls_1.urls._url(...urlPath)}${chunkLogins.length > 0 ? `?login=${chunkLogins}` : ""}${chunkIDs.length > 0 | ||
? `${chunkLogins.length > 0 ? "&" : "?"}id=${chunkIDs}` | ||
: ""}`; | ||
url = `${urls_1.urls._url(...urlPath)}${chunkLogins.length > 0 ? `?login=${chunkLogins}` : ""}${chunkIDs.length > 0 | ||
? `${chunkLogins.length > 0 ? "&" : "?"}id=${chunkIDs}` | ||
: ""}`; | ||
} | ||
console.log(url); | ||
(0, oberknecht_request_1.request)(url, { | ||
@@ -55,0 +55,0 @@ method: urls_1.urls._method(...urlPath), |
@@ -209,4 +209,4 @@ import { i } from "../index"; | ||
logins: string | string[], | ||
ids: string | string[], | ||
noautofilterids: boolean, | ||
ids?: string | string[], | ||
noautofilterids?: boolean, | ||
customtoken?: string | ||
@@ -213,0 +213,0 @@ ) => { |
@@ -31,3 +31,3 @@ import { | ||
ids_ = [...ids_, ...idsinlogins]; | ||
idsinlogins.forEach((a) => logins_.splice(logins_.indexOf(a))); | ||
logins_ = logins_.filter(a => !i.regex.numregex().test(a)); | ||
} | ||
@@ -34,0 +34,0 @@ } |
@@ -29,5 +29,5 @@ import { request } from "oberknecht-request"; | ||
let logins_ = convertToArray(logins, false).map((a) => cleanChannelName(a)); | ||
let ids_ = convertToArray(ids, false) | ||
.map((a) => String(a)?.toLowerCase()) | ||
.filter((a) => regex.numregex().test(a)); | ||
let ids_ = convertToArray(ids, false).filter( | ||
(a) => typeof a === "number" || regex.numregex().test(a.toString()) | ||
); | ||
@@ -73,20 +73,19 @@ if (customtoken ?? undefined) { | ||
let url = `${urls._url(...urlPath)}${joinUrlQuery( | ||
"login", | ||
chunkLogins, | ||
["login", "id"], | ||
[chunkLogins, chunkIDs], | ||
true | ||
)}${joinUrlQuery( | ||
"id", | ||
chunkIDs, | ||
chunkLogins.length == 0 ? true : false | ||
)}`; | ||
if (i.apiclientData[sym]._options?.use3rdparty?.getUsers) | ||
if (i.apiclientData[sym]._options?.use3rdparty?.getUsers) { | ||
urlPath = ["ivrfitwitch", "users"]; | ||
url = `${urls._url(...urlPath)}${ | ||
chunkLogins.length > 0 ? `?login=${chunkLogins}` : "" | ||
}${ | ||
chunkIDs.length > 0 | ||
? `${chunkLogins.length > 0 ? "&" : "?"}id=${chunkIDs}` | ||
: "" | ||
}`; | ||
url = `${urls._url(...urlPath)}${ | ||
chunkLogins.length > 0 ? `?login=${chunkLogins}` : "" | ||
}${ | ||
chunkIDs.length > 0 | ||
? `${chunkLogins.length > 0 ? "&" : "?"}id=${chunkIDs}` | ||
: "" | ||
}`; | ||
} | ||
console.log(url); | ||
request( | ||
@@ -93,0 +92,0 @@ url, |
{ | ||
"name": "oberknecht-api", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "A client for easy usage of the Twitch API (Helix)", | ||
@@ -29,3 +29,3 @@ "main": "./export", | ||
"oberknecht-request": ">=0.0.1", | ||
"oberknecht-utils": ">=1.1.5" | ||
"oberknecht-utils": ">=1.1.9" | ||
}, | ||
@@ -32,0 +32,0 @@ "devDependencies": { |
442472
10077
Updatedoberknecht-utils@>=1.1.9