async def sendFile(self, message): await self.tryDelMsg(message) name = ' '.join(message.content.split(' ')[1:]) file = gdfuncs.searchForFileAnywhere(name) f = discord.File( BytesIO(file.GetContentIOBuffer(mimetype=file['mimeType']).read()), filename='{}.{}'.format(file['title'], file['mimeType'].split('/')[-1])) await message.channel.send(file=f)
async def sendFileContentString(self, message): await self.tryDelMsg(message) name = ' '.join(message.content.split(' ')[1:]) file = gdfuncs.searchForFileAnywhere(name) fileContent = file.GetContentString() i = 0 for index in range(math.ceil(len(fileContent) / 1990)): await message.channel.send("{}".format(fileContent[i:i + 1990]) ) #.replace(r"\n", r"\r\n"))) i += 1990
async def getFileInfo(self, message): await self.tryDelMsg(message) name = ' '.join(message.content.split(' ')[1:]) file = gdfuncs.searchForFileAnywhere(name) await message.channel.send(""" ```nim File Name: {} File Type: {} File Size: {} bytes ({} KB) ```""".format(file['title'], file['mimeType'], int(file['fileSize']), round(int(file['fileSize']) / 1024), 2))
async def deleteFile(self, message): await self.tryDelMsg(message) name = ' '.join(message.content.split(' ')[1:]) file = gdfuncs.searchForFileAnywhere(name) file.Delete()