start 0x0. implementation
This commit is contained in:
parent
80846d5c73
commit
31718549d9
2 changed files with 20 additions and 4 deletions
|
|
@ -13,5 +13,6 @@ dead simple last.fm bot
|
||||||
- add collage generation
|
- add collage generation
|
||||||
- fix attachment generation and upload
|
- fix attachment generation and upload
|
||||||
- ~~**temporary fix**: upload and link to catbox urls~~ the asynchronous catbox library does not accept byte arrays
|
- ~~**temporary fix**: upload and link to catbox urls~~ the asynchronous catbox library does not accept byte arrays
|
||||||
- **temporary fix**: construct the attachment object from scratch and upload manually(?)
|
- ~~**temporary fix**: construct the attachment object from scratch and upload manually(?)~~ its still broken
|
||||||
|
- **temporary fix:** use 0x0.st
|
||||||
- **permanent fix**: fork and update nerimity library
|
- **permanent fix**: fork and update nerimity library
|
||||||
|
|
|
||||||
21
utils.py
21
utils.py
|
|
@ -1,9 +1,10 @@
|
||||||
|
# import io
|
||||||
# import requests
|
# import requests
|
||||||
# import mimetypes
|
# import mimetypes
|
||||||
|
|
||||||
import nerimity
|
import nerimity
|
||||||
|
|
||||||
# def construct_attachment_from_url(url: str = None):
|
# def construct_attachment_from_url(url: str = None) -> nerimity.Attachment | None:
|
||||||
# if not url: return None
|
# if not url: return None
|
||||||
# content = requests.get(url).content
|
# content = requests.get(url).content
|
||||||
|
|
||||||
|
|
@ -17,8 +18,22 @@ import nerimity
|
||||||
|
|
||||||
# return attachment
|
# return attachment
|
||||||
|
|
||||||
def error_msg(message: str):
|
# def construct_attachment_from_bytes(filename: str = "file", bytes_arr: io.BytesIO = None, file_type: str = None) -> nerimity.Attachment | None:
|
||||||
|
# if not bytes_arr: return None
|
||||||
|
# if not file_type: return None
|
||||||
|
|
||||||
|
# attachment = nerimity.Attachment()
|
||||||
|
# attachment.internal_type = nerimity.AttachmentTypes.OUTGOING
|
||||||
|
|
||||||
|
# attachment.data = bytes_arr.read()
|
||||||
|
# attachment.data_type = file_type
|
||||||
|
# attachment.size = len(attachment.data)
|
||||||
|
# attachment.name = filename
|
||||||
|
|
||||||
|
# return attachment
|
||||||
|
|
||||||
|
def error_msg(message: str) -> str:
|
||||||
return f"[#e5323b][Error] [#reset]{message}"
|
return f"[#e5323b][Error] [#reset]{message}"
|
||||||
|
|
||||||
def good_msg(message: str):
|
def good_msg(message: str) -> str:
|
||||||
return f"[#52ff54][Success] [#reset]{message}"
|
return f"[#52ff54][Success] [#reset]{message}"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue