Skip to content

Commit 19f103a

Browse files
committed
combine /search into /chats
1 parent ca9e906 commit 19f103a

File tree

11 files changed

+153
-327
lines changed

11 files changed

+153
-327
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Invite link: [bot.2b2t.vc](https://bot.2b2t.vc)
1010
* `/liveconnections` -> Configures a live join/leave feed channel in your server
1111
* `/queue` -> Shows 2b2t's current queue lengths and ETA
1212
* `/seen` -> When a player was last and first seen on 2b2t
13-
* `/chats` -> Prints a player's chat history
13+
* `/chats` -> Searches chats with filters for player, word, and date
1414
* `/connections` -> Prints a player's join/leave history
1515
* `/deaths` -> Prints a player's death history
1616
* `/deathsmonth` -> Leaderboard for top deaths in the last 30 days
@@ -24,6 +24,5 @@ Invite link: [bot.2b2t.vc](https://bot.2b2t.vc)
2424
* `/priodata` -> Dumps a JSON list of all players who currently have priority queue (probably)
2525
* `/stats` -> Prints a player's stats on 2b2t
2626
* `/wordcount` -> Counts how many times a word has been seen in chat
27-
* `/search` -> Searches for chats containing a specific word
2827
* `/watch` -> DM Notifications on player joins, leaves, deaths, or kills
2928
* `/watch-guild` -> Discord server channel notifications on player joins, leaves, deaths, or kills

openapi/api.2b2t.vc.openapi.json

Lines changed: 39 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -927,12 +927,11 @@
927927
"operationId": "chats",
928928
"parameters": [
929929
{
930-
"name": "uuid",
930+
"name": "word",
931931
"in": "query",
932932
"required": false,
933933
"schema": {
934-
"type": "string",
935-
"format": "uuid"
934+
"type": "string"
936935
}
937936
},
938937
{
@@ -943,6 +942,15 @@
943942
"type": "string"
944943
}
945944
},
945+
{
946+
"name": "uuid",
947+
"in": "query",
948+
"required": false,
949+
"schema": {
950+
"type": "string",
951+
"format": "uuid"
952+
}
953+
},
946954
{
947955
"name": "startDate",
948956
"in": "query",
@@ -961,6 +969,18 @@
961969
"format": "date"
962970
}
963971
},
972+
{
973+
"name": "sort",
974+
"in": "query",
975+
"required": false,
976+
"schema": {
977+
"type": "string",
978+
"enum": [
979+
"asc",
980+
"desc"
981+
]
982+
}
983+
},
964984
{
965985
"name": "pageSize",
966986
"in": "query",
@@ -982,20 +1002,20 @@
9821002
],
9831003
"responses": {
9841004
"200": {
985-
"description": "Chat history for given player",
1005+
"description": "Search for chat messages with optional filters",
9861006
"content": {
9871007
"application/json": {
9881008
"schema": {
989-
"$ref": "#/components/schemas/ChatsResponse"
1009+
"$ref": "#/components/schemas/ChatSearchResponse"
9901010
}
9911011
}
9921012
}
9931013
},
9941014
"204": {
995-
"description": "No data for player"
1015+
"description": "No data"
9961016
},
9971017
"400": {
998-
"description": "Bad request. Either uuid or playerName must be provided."
1018+
"description": "Bad request.\n\nIf word is provided, it must be between 3 and 50 valid chat characters.\n\nIf uuid or playerName is provided, it must be for a valid and existing account.\n\nIf pageSize is provided, it must be between 1 and 100.\n\nIf startDate and endDate are provided, they must be valid dates in ISO 8601 format, example: \"2022-10-31\".\n"
9991019
}
10001020
}
10011021
}
@@ -1109,90 +1129,6 @@
11091129
}
11101130
}
11111131
},
1112-
"/chats/search": {
1113-
"get": {
1114-
"tags": [
1115-
"Chats"
1116-
],
1117-
"operationId": "chatSearch",
1118-
"parameters": [
1119-
{
1120-
"name": "word",
1121-
"in": "query",
1122-
"required": true,
1123-
"schema": {
1124-
"type": "string"
1125-
}
1126-
},
1127-
{
1128-
"name": "startDate",
1129-
"in": "query",
1130-
"required": false,
1131-
"schema": {
1132-
"type": "string",
1133-
"format": "date"
1134-
}
1135-
},
1136-
{
1137-
"name": "endDate",
1138-
"in": "query",
1139-
"required": false,
1140-
"schema": {
1141-
"type": "string",
1142-
"format": "date"
1143-
}
1144-
},
1145-
{
1146-
"name": "sort",
1147-
"in": "query",
1148-
"required": false,
1149-
"schema": {
1150-
"type": "string",
1151-
"enum": [
1152-
"asc",
1153-
"desc"
1154-
]
1155-
}
1156-
},
1157-
{
1158-
"name": "pageSize",
1159-
"in": "query",
1160-
"required": false,
1161-
"schema": {
1162-
"type": "integer",
1163-
"format": "int32"
1164-
}
1165-
},
1166-
{
1167-
"name": "page",
1168-
"in": "query",
1169-
"required": false,
1170-
"schema": {
1171-
"type": "integer",
1172-
"format": "int32"
1173-
}
1174-
}
1175-
],
1176-
"responses": {
1177-
"200": {
1178-
"description": "Find chat messages containing a specific word",
1179-
"content": {
1180-
"application/json": {
1181-
"schema": {
1182-
"$ref": "#/components/schemas/ChatSearchResponse"
1183-
}
1184-
}
1185-
}
1186-
},
1187-
"204": {
1188-
"description": "No data"
1189-
},
1190-
"400": {
1191-
"description": "Bad request."
1192-
}
1193-
}
1194-
}
1195-
},
11961132
"/bots/month": {
11971133
"get": {
11981134
"tags": [
@@ -1748,25 +1684,13 @@
17481684
}
17491685
}
17501686
},
1751-
"Chat": {
1752-
"type": "object",
1753-
"properties": {
1754-
"time": {
1755-
"type": "string",
1756-
"format": "date-time"
1757-
},
1758-
"chat": {
1759-
"type": "string"
1760-
}
1761-
}
1762-
},
1763-
"ChatsResponse": {
1687+
"ChatSearchResponse": {
17641688
"type": "object",
17651689
"properties": {
17661690
"chats": {
17671691
"type": "array",
17681692
"items": {
1769-
"$ref": "#/components/schemas/Chat"
1693+
"$ref": "#/components/schemas/PlayerChat"
17701694
}
17711695
},
17721696
"total": {
@@ -1779,26 +1703,6 @@
17791703
}
17801704
}
17811705
},
1782-
"WordCount": {
1783-
"type": "object",
1784-
"properties": {
1785-
"count": {
1786-
"type": "integer",
1787-
"format": "int32"
1788-
}
1789-
}
1790-
},
1791-
"ChatWindowResponse": {
1792-
"type": "object",
1793-
"properties": {
1794-
"chats": {
1795-
"type": "array",
1796-
"items": {
1797-
"$ref": "#/components/schemas/PlayerChat"
1798-
}
1799-
}
1800-
}
1801-
},
18021706
"PlayerChat": {
18031707
"type": "object",
18041708
"properties": {
@@ -1818,22 +1722,23 @@
18181722
}
18191723
}
18201724
},
1821-
"ChatSearchResponse": {
1725+
"WordCount": {
1726+
"type": "object",
1727+
"properties": {
1728+
"count": {
1729+
"type": "integer",
1730+
"format": "int32"
1731+
}
1732+
}
1733+
},
1734+
"ChatWindowResponse": {
18221735
"type": "object",
18231736
"properties": {
18241737
"chats": {
18251738
"type": "array",
18261739
"items": {
18271740
"$ref": "#/components/schemas/PlayerChat"
18281741
}
1829-
},
1830-
"total": {
1831-
"type": "integer",
1832-
"format": "int32"
1833-
},
1834-
"pageCount": {
1835-
"type": "integer",
1836-
"format": "int32"
18371742
}
18381743
}
18391744
},

0 commit comments

Comments
 (0)