-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: create_vote #212
feat: create_vote #212
Conversation
from bilibili_api import dynamic, sync, Credential, vote
choices = vote.VoteChoices().add_choice(desc="1 choice").add_choice(desc="2 choice")
print(sync(vote.create_vote(title="title", _type=vote.VoteType.TEXT, choice_cnt=2, duration=604800, choices=choices, credential=c)))
_vote = sync(vote.Vote(vote_id=5322590).get_vote_info()) |
文档明天再写... |
@@ -0,0 +1,26 @@ | |||
{ | |||
"info": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里少了一层,参考 live.json
最外层应该是 info
表示获取信息的接口 operate
表示操作的接口。
这里建议现在的 info
改为 info.vote_info
,create
改为 operate.create_vote
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry,已经改了
顺带问一下你是高中生吗 |
高一呢,有啥问题吗?很乐意聊聊
|
Finished,刚好到明天了 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
辛苦
@Nemo2011 先把这个 merge 了? |
用的web端接口
动态重构完了,文档下午再写 |
@@ -0,0 +1,12942 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个文件是做什么用的?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
看到你有个这样的函数,应该是在动态插入表情用的。但是这里使用 ID 插入的,实际使用的时候没有人会去记表情的数字 ID 吧。我觉得应该是直接用中括号的文字表情作为参数,然后那个文件也不用了。
def add_emoji(self, emoji_id: int) -> "BuildDynmaic":
"""
添加表情
Args:
emoji_id (int): 表情ID
"""
with open(os.path.join(os.path.dirname(__file__), "data/emote.json"), encoding="UTF-8") as f:
emote_info = json.load(f)
if str(emoji_id) not in emote_info:
raise ValueError("不存在此表情")
self.contents.append({
"biz_id": "",
"type": DynmaicContentType.EMOJI.value,
"raw_text": emote_info[str(emoji_id)]
}
)
return self
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
关于表情包其实有个文件了 emoji.py 或许可以在这里建一个类 Emoji
,然后 add_emoji
的参数改成 emoji: Emoji
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
看到你有个这样的函数,应该是在动态插入表情用的。但是这里使用 ID 插入的,实际使用的时候没有人会去记表情的数字 ID 吧。我觉得应该是直接用中括号的文字表情作为参数,然后那个文件也不用了。
def add_emoji(self, emoji_id: int) -> "BuildDynmaic": """ 添加表情 Args: emoji_id (int): 表情ID """ with open(os.path.join(os.path.dirname(__file__), "data/emote.json"), encoding="UTF-8") as f: emote_info = json.load(f) if str(emoji_id) not in emote_info: raise ValueError("不存在此表情") self.contents.append({ "biz_id": "", "type": DynmaicContentType.EMOJI.value, "raw_text": emote_info[str(emoji_id)] } ) return self
是这样的emm,都怪B站.jpg
动态发送的后端都tm不知道谁写的...用中文表情名做根据
我待会和文档一块 pr,现在在体验樱之刻,不想动呜呜呜呜呜呜呜呜
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
关于表情包其实有个文件了 emoji.py 或许可以在这里建一个类
Emoji
,然后add_emoji
的参数改成emoji: Emoji
agree,顺便这个 emoji 类要不你来?谁提出谁干qeq
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不...根本找不到创建 emoji 类的理由,一方面这玩意在哪都是 [emoji_name]
,另一方面也没有任何 operate 可用,纯粹充数的
我无语了,从动态到回复B站用的都是中文名
新建
data/api/vote.json
...