Skip to content

Commit

Permalink
add guild whitelisting, simplify database queries
Browse files Browse the repository at this point in the history
  • Loading branch information
slatinsky committed Oct 28, 2023
1 parent a5ffe52 commit c8e20b4
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 162 deletions.
8 changes: 2 additions & 6 deletions backend/fastapi/Autocomplete.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ def autocomplete_categories(guild_id: str, partial_category: str, limit: int):
"$regex": partial_category,
"$options": "i"
},
"guildId": guild_id,
"type": {
"$nin": [
"GuildPublicThread",
Expand Down Expand Up @@ -67,8 +66,7 @@ def autocomplete_channels(guild_id: str, partial_channel: str, limit: int):
query = {
"name": {
"$regex": partial_channel, "$options": "i"
},
"guildId": guild_id
}
}
cursor = collection_channels.find(query, {
"name": 1,
Expand Down Expand Up @@ -99,8 +97,7 @@ def autocomplete_reactions(guild_id: str, partial_reaction: str, limit: int):
"name": {
"$regex": partial_reaction,
"$options": "i"
},
"guildIds": guild_id
}
}
cursor = collection_emojis.find(query, {
"name": 1,
Expand Down Expand Up @@ -169,7 +166,6 @@ def autocomplete_users(guild_id: str, partial_user_name: str, limit: int):
print("collection_authors", collection_authors)

query = {
"guildIds": guild_id,
"names": {
"$regex": partial_user_name, "$options": "i"
}
Expand Down
Loading

0 comments on commit c8e20b4

Please sign in to comment.