Download all Poe bots.

This commit is contained in:
Cohee
2023-07-09 23:07:54 +03:00
parent e883a37953
commit d35ed21f48
2 changed files with 106 additions and 2 deletions

View File

@@ -428,13 +428,13 @@ class Client {
};
this.session.defaults.headers.common = this.headers;
[this.next_data, this.channel] = await Promise.all([this.get_next_data(), this.get_channel_data()]);
this.bots = await this.get_bots();
this.bot_names = this.get_bot_names();
this.gql_headers = {
"poe-formkey": this.formkey,
"poe-tchannel": this.channel["channel"],
...this.headers,
};
this.bots = await this.get_bots();
this.bot_names = this.get_bot_names();
if (this.device_id === null) {
this.device_id = this.get_device_id();
}
@@ -519,6 +519,20 @@ class Client {
throw new Error('Invalid token.');
}
const botList = viewer.availableBotsConnection.edges.map(x => x.node);
try {
const botsQuery = await this.send_query('BotSwitcherModalQuery', {});
botsQuery.data.viewer.availableBotsConnection.edges.forEach(edge => {
const bot = edge.node;
if (botList.findIndex(x => x.id === bot.id) === -1) {
botList.push(bot);
}
});
} catch (e) {
console.log(e);
}
const retries = 2;
const bots = {};
const promises = [];

View File

@@ -0,0 +1,90 @@
query BotSwitcherModalQuery {
viewer {
...BotSwitcherModalInner_viewer
id
}
}
fragment BotHeader_bot on Bot {
displayName
isLimitedAccess
...BotImage_bot
...BotLink_bot
...IdAnnotation_node
...botHelpers_useViewerCanAccessPrivateBot
...botHelpers_useDeletion_bot
}
fragment BotHeader_viewer on Viewer {
hasActiveSubscription
}
fragment BotImage_bot on Bot {
displayName
...botHelpers_useDeletion_bot
...BotImage_useProfileImage_bot
}
fragment BotImage_useProfileImage_bot on Bot {
image {
__typename
... on LocalBotImage {
localName
}
... on UrlBotImage {
url
}
}
...botHelpers_useDeletion_bot
}
fragment BotLink_bot on Bot {
handle
}
fragment BotNavItem_bot on Bot {
botId
handle
id
...BotHeader_bot
}
fragment BotNavItem_viewer on Viewer {
...BotHeader_viewer
}
fragment BotSwitcherModalInner_viewer on Viewer {
...BotNavItem_viewer
availableBotsConnection(first: 11) {
edges {
node {
id
handle
...BotNavItem_bot
__typename
}
cursor
id
}
pageInfo {
endCursor
hasNextPage
}
id
}
}
fragment IdAnnotation_node on Node {
__isNode: __typename
id
}
fragment botHelpers_useDeletion_bot on Bot {
deletionState
}
fragment botHelpers_useViewerCanAccessPrivateBot on Bot {
isPrivateBot
viewerIsCreator
isSystemBot
}