MCPcopy Create free account
hub / github.com/ArrowM/Queue-Bot / insertQueue

Method insertQueue

src/db/store.ts:181–197  ·  view source on GitHub ↗
(newQueue: NewQueue)

Source from the content-addressed store, hash-verified

179
180 // throws error on conflict
181 insertQueue(newQueue: NewQueue) {
182 try {
183 return db.transaction(() => {
184 this.incrementGuildStat("queuesAdded");
185 this.dbQueues.clear();
186 return db
187 .insert(QUEUE_TABLE)
188 .values(omitBy(newQueue, isNil) as NewQueue)
189 .returning().get();
190 });
191 }
192 catch (e) {
193 if ((e as Error).message.includes("UNIQUE constraint failed")) {
194 throw new QueueAlreadyExistsError();
195 }
196 }
197 }
198
199 // replace on conflict
200 insertVoice(newVoice: NewVoice) {

Callers 2

insertQueueFunction · 0.80
queues_addMethod · 0.80

Calls 3

incrementGuildStatMethod · 0.95
clearMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected