mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Download all Poe bots.
This commit is contained in:
@@ -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 = [];
|
||||
|
90
src/poe_graphql/BotSwitcherModalQuery.graphql
Normal file
90
src/poe_graphql/BotSwitcherModalQuery.graphql
Normal 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
|
||||
}
|
Reference in New Issue
Block a user