有没有办法在telegram API中编辑消息?我在https://core.telegram.org/methods中找不到解决方案。
请问如何使用TimeSpan将像"00047"这样的简单持续时间字符串解析为秒?
TimeSpan.ParseExact("00047", "hmmss", Nothing).TotalSeconds
Run Code Online (Sandbox Code Playgroud)
上面给出了错误:"输入字符串的格式不正确."
我正在从通话记录中解析持续时间
070615 1815 00047 9 9 806 00000000000 6103 807 80212 15 17 0 0
070615 1815 00155 7 9 806 00000000000 2206 41784 22 0 0
070615 1816 00249 7 9 806 00000000000 2206 41784 24 0 0
Run Code Online (Sandbox Code Playgroud)
这是TimeSpan.ParseExact的问题吗?
如果允许我们指定格式,例如hmmss,我们传递一个直接映射到该格式的字符串00047 ...
如果您不尊重有效格式,请问我们格式有什么意义?
我有一个通用功能,可以通过电报机器人发送菜单(如下所示),但是我不知道如何在这些菜单上添加图标(mypokerbot的方式,检查图像)。有什么提示吗?
function SendGenericMenu ($chatid) {
$lista=array("A", "B", "C");
$text="Choose:";
global $bottoken;
$replyMarkup = array(
'keyboard' => $lista,
);
$encodedMarkup = json_encode($replyMarkup);
$content = array(
'chat_id' => $chatid,
'reply_markup' => $encodedMarkup,
'text' => "$text"
);
$ch = curl_init();
$url="https://api.telegram.org/bot$bottoken/SendMessage";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($content));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
// receive server response ...
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec ($ch);
curl_close ($ch);
var_dump($server_output);
}
Run Code Online (Sandbox Code Playgroud)
给定项目列表,我们如何过滤特定结构?
例:
我们只需%TL.DocumentAttributeFilename{}要从列表中的项目
lst1 = [%TL.DocumentAttributeImageSize{h: 1280, w: 960}, %TL.DocumentAttributeFilename{file_name: "422305695_81769.jpg"}]
lst2 = [%TL.DocumentAttributeVideo{duration: 7, h: 224, w: 264}, %TL.DocumentAttributeFilename{file_name: "animation.gif.mp4"}, %TL.DocumentAttributeAnimated{}]
Run Code Online (Sandbox Code Playgroud) 我正在尝试将外键详细信息作为查询的一部分。
我怎样才能使用EF.coreLEFT JOINs而不是INNER JOINs?
public class Offence
{
[Key]
public Int32 offence_id { get; set; }
public Int32 guard_id { get; set; }
public Int32 penalty_id { get; set; }
public DateTime? dt_recorded { get; set; }
public Int32 salary_id { get; set; }
public Decimal? amount { get; set; }
public String status { get; set; }
public Int32 site_id { get; set; }
public Guard Guard { get; set; }
public Salary Salary …Run Code Online (Sandbox Code Playgroud) 并String.to_atom("some-known-string")创建一个新的原子的原子表中的每个时间?
如果没有,那又有什么意义String.to_existing_atom/1呢?
如果是,那么为什么?因为String.to_atom("some-known-string")总会得到相同的结果......并且atom-table 永远不会被垃圾收集
如何to_ascii在Elixir(或Erlang)中实现高效的功能?
扫描字符串的每个字符并调用String.printable?似乎是一个非常糟糕的选择
def to_ascii(s) do
case String.printable?(s) do
true -> s
false -> _to_ascii(String.codepoints(s), "")
end
end
defp _to_ascii([], acc), do: acc
defp _to_ascii([c | rest], acc) when ?c in 32..127, do: _to_ascii(rest, acc <> c)
defp _to_ascii([_ | rest], acc), do: _to_ascii(rest, acc)
Run Code Online (Sandbox Code Playgroud)
例:
s_in = <<"hello", 150, " ", 180, "world", 160>>
s_out = "hello world" # valid ascii only i.e 32 .. 127
Run Code Online (Sandbox Code Playgroud) 我们如何将 1px 边框应用于这些气泡?
这篇类似的 SO 文章在这里不起作用,因为我们使用不同的方法来生成语音气泡
.chat-messages {
width: calc(100%);
padding-bottom: 5px;
background-color: #f3f3f4;
}
.sb-time {
font-size: 10pt;
font-weight: 400;
margin: 7px -5px 0px 10px;
float: right;
}
.sb {
font-size: 13pt;
font-weight: 500;
border-radius: 6px;
display: block;
padding: 10px 15px 5px 15px;
position: relative;
vertical-align: top;
clear: both;
}
.sb::before {
content: "\00a0";
display: block;
height: 15px;
position: absolute;
top: 10px;
-moz-transform: rotate(30deg) skew(-35deg);
-ms-transform: rotate(30deg) skew(-35deg);
-o-transform: rotate(30deg) skew(-35deg);
-webkit-transform: rotate(30deg) skew(-35deg);
transform: rotate(30deg) skew(-35deg); …Run Code Online (Sandbox Code Playgroud)到目前为止,我的机器人正在工作,但问题是它只能发送文本。我已经在Bot API中看到了发送照片,视频的功能...但是我无法正常工作。有人实现了吗?我正在使用yukuku / telebot的 python源代码
elif text == '/image':
img = Image.new('RGB', (512, 512))
base = random.randint(0, 16777216)
pixels = [base+i*j for i in range(512) for j in range(512)] # generate sample image
img.putdata(pixels)
output = StringIO.StringIO()
img.save(output, 'JPEG')
reply(img=output.getvalue())
Run Code Online (Sandbox Code Playgroud)
当我更改代码时,什么也没发生。
img = Image.open('image.png')
img.show()
Run Code Online (Sandbox Code Playgroud)
请帮我。我需要正确的代码。对不起,我的英语不好。
elixir ×3
erlang ×2
telegram-bot ×2
ascii ×1
css ×1
css-shapes ×1
ef-core-2.0 ×1
left-join ×1
list ×1
parsing ×1
php ×1
python ×1
telegram ×1
timespan ×1
vb.net ×1