(text: string, offset: number)
| 2144 | for (const threadjson of res.threads) { |
| 2145 | if (this.localuser.channels.has(threadjson.id)) continue; |
| 2146 | const thread = new Channel(threadjson, this.guild); |
| 2147 | this.localuser.channels.set(threadjson.id, thread); |
| 2148 | thread.resolveparent(); |
| 2149 | } |
| 2150 | for (const message of res.messages) { |
| 2151 | const thread = this.localuser.channels.get(message.channel_id); |
| 2152 | if (!thread) continue; |
| 2153 | const m = this.localuser.messages.get(message.id); |
| 2154 | if (!m) this.localuser.messages.set(message.id, new Message(message, thread)); |
| 2155 | } |
| 2156 | for (const member of res.members) { |
| 2157 | Member.new(member, this.guild); |
| 2158 | } |
| 2159 | if (res.has_more) { |
| 2160 | const lastid = res.threads.at(-1)?.id as string; |
| 2161 | if (text) { |
| 2162 | const arr = this.search.find(([id]) => id === uid); |
| 2163 | if (arr) { |
| 2164 | arr[1] = offset + 25; |
| 2165 | arr[2] = lastid; |
| 2166 | } else { |
| 2167 | this.search.push([uid, offset + 25, lastid]); |
| 2168 | if (this.search.length > 200) { |
| 2169 | this.search.shift(); |
| 2170 | } |
| 2171 | } |
| 2172 | } else { |
| 2173 | this.umap.set(uid, [offset + 25, lastid]); |
| 2174 | } |
| 2175 | } else { |
| 2176 | if (text) { |
| 2177 | const arr = this.search.find(([id]) => id === uid); |
| 2178 | if (arr) { |
| 2179 | arr[1] = offset + 25; |
| 2180 | arr[2] = "-1"; |
| 2181 | } else { |
| 2182 | this.search.push([uid, offset + 25, "-1"]); |
| 2183 | if (this.search.length > 200) { |
| 2184 | this.search.shift(); |
| 2185 | } |
| 2186 | } |
| 2187 | } else { |
| 2188 | this.umap.clear(); |
| 2189 | this.search = []; |
| 2190 | this.hasAllThreads = true; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | genCurSort(text: string, offset: number) { |
| 2196 | const filters = this.forumFilters; |
| 2197 | text = text.toLowerCase(); |
| 2198 | let match = this.children.filter((thread) => thread.name.toLowerCase().includes(text)); |
| 2199 | const tagSet = new Set(filters.tags); |
| 2200 | if (tagSet.size) |
| 2201 | match = match.filter((thread) => { |
| 2202 | const tags = new Set(thread.appliedTags); |
| 2203 | if (filters.tagMatchAll) { |
no test coverage detected