File size: 579 Bytes
c7dfe8b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from Database.mongodb.db import dbname

collection = dbname["whisper"]


class Whispers:
    @staticmethod
    async def add_whisper(WhisperId, WhisperData):
        whisper = {"WhisperId": WhisperId, "whisperData": WhisperData}
        await collection.insert_one(whisper)

    @staticmethod
    async def del_whisper(WhisperId):
        await collection.delete_one({"WhisperId": WhisperId})

    @staticmethod
    async def get_whisper(WhisperId):
        whisper = await collection.find_one({"WhisperId": WhisperId})
        return whisper["whisperData"] if whisper else None