小编Cha*_*gwu的帖子

PHP:Telegram Bot:在文本消息中插入换行符

"\n"并且"\r\n",在电报机器人发送的短信中进行测试,以创建换行符._使用它们后,将显示下划线,而不是显示换行符.

如何在机器人发送的电报信息中打印换行?

$txt = '?? ???? ?? ????? ???? ?? ??? ???? ???? 10 ?? ?? ?????? ???? ???? ??? ????? ????? ??.';
$txt .= " \n ";
$txt .= 'Thanks for joining, Every day at almost 18:30 GMT an intersting video will be sent';
Run Code Online (Sandbox Code Playgroud)

消息演示 在此输入图像描述

任何帮助将不胜感激.

php linefeed telegram-bot

45
推荐指数
5
解决办法
5万
查看次数

如何下载发送到Telegram bot的文件或照片?

我正在使用电报机器人API,但无论如何我无法下载发送到我的机器人的filé.我得到了该文件的哈希,但不知道如何处理它.有什么办法吗?谢谢.

api telegram-bot

42
推荐指数
4
解决办法
5万
查看次数

我们如何轻松地在灵药中调用函数调用?

怎样才能轻松地时间功能的药剂电话?

IEx中是否有任何隐藏的开关来启用此功能?

function timing elixir

30
推荐指数
2
解决办法
1万
查看次数

如何快速插入SQL Server 2008

我有一个项目涉及将设备中的数据直接记录到sql表中.

在写入sql server之前,我在代码中进行的处理很少(2008年顺便说一下)

通常我使用sqlhelper类的ExecuteNonQuery方法并传入存储的proc名称和SP期望的参数列表.

这非常方便,但我需要更快的方法来做到这一点.

谢谢.

sql-server performance

27
推荐指数
2
解决办法
6万
查看次数

Elixir将struct转换为map

我正在尝试将结构转换为地图,以便能够清除所有的nil值

我目前正在使用此代码

  case Nadia.get_updates  do
    {:ok, results} ->
      Map.from_struct(results)
      |> Enum.filter(fn {_, v} -> v != nil end)
      |> Enum.into(%{})
Run Code Online (Sandbox Code Playgroud)

注意:Nadia.get_updates返回以下结构:https://hexdocs.pm/nadia/Nadia.Model.Update.html#t:t / 0

然而,我总是收到以下错误:Map.from_struct/1中没有匹配的函数子句

struct dictionary elixir telegram-bot

26
推荐指数
3
解决办法
1万
查看次数

通过USSD发送邮件需要什么?

我正在尝试开始使用USSD.我熟悉其他形式的短信.最终,我想将USSD用作实时支付平台的一部分.

谢谢.

payment sms ussd

22
推荐指数
3
解决办法
5万
查看次数

Webhook与Telegram Bot API有问题

为什么我的webhook无法正常工作?我没有从电报bot API获得任何数据.这是我的问题的详细解释:

从StartSSL获得SSL证书,它在我的网站上工作正常(根据GeoCerts SSL检查器),但似乎我的webhook到Telegram Bot API不起作用(尽管它说webhook设置我没有得到任何数据) .

我正在以这种形式在我的网站上制作一个webhook到我的脚本:

https://api.telegram.org/bot<token>/setWebhook?url=https://mywebsite.com/path/to/giveawaysbot.php
Run Code Online (Sandbox Code Playgroud)

我得到这个文本作为回应:

{"ok":true,"result":true,"description":"Webhook was set"}
Run Code Online (Sandbox Code Playgroud)

所以它必须有效,但实际上并非如此.

这是我的脚本代码:

<?php 

ini_set('error_reporting', E_ALL);

$botToken = "<token>";
$website = "https://api.telegram.org/bot".$botToken;

$update = file_get_contents('php://input');
$update = json_decode($update);

print_r($update); // this is made to check if i get any data or not

$chatId = $update["message"]["chat"]["id"];
$message = $update["message"]["text"];


switch ($message) {
    case "/test":
        sendMessage($chatId,"test complete");
        break;
    case "/hi":
        sendMessage($chatId,"hey there");
        break;
    default:
        sendMessage($chatId,"nono i dont understand you");
}


function sendMessage ($chatId, $message) …
Run Code Online (Sandbox Code Playgroud)

api ssl telegram-bot

21
推荐指数
3
解决办法
3万
查看次数

PHP中的Telegram Bot自定义键盘

我正在尝试使用自定义键盘在PHP中创建一个Telgram Bot.邮件已发送,但自定义键盘无法使用.$ keyb = array('keyboard'=> array(array("A","B"))); 也没有成功.

所述的sendMessage方法引荐ReplyKeyboardMarkup为对象.为ReplyKeyboardMarkup创建数组不起作用.还尝试了json_encode($ keyb),但这也不是解决方案.

我在GitHub中搜索了一些示例,但我没有找到使用自定义键盘的地方.电报在iPhone和桌面上运行,都是最新的.

示例代码:

$url = "https://api.telegram.org/bot<token>/sendMessage";

$keyb = array('ReplyKeyboardMarkup' => array('keyboard' => array(array("A", "B"))));
$content = array('chat_id' => <chat_id>, 'reply_markup' => $keyb, 'text' => "Test");

$ch = curl_init();

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);  //fix http://unitstep.net/blog/2009/05/05/using-curl-in-php-to-access-https-ssltls-protected-sites/

// 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)

php telegram-bot

18
推荐指数
2
解决办法
3万
查看次数

如何在不使用Entity Framework的情况下从.Net Core连接到SQL Server?

如何在不使用Entity Framework的情况下从.Net Core连接到SQL Server?

sql-server .net-core

17
推荐指数
3
解决办法
2万
查看次数

电报机器人:秘密聊天可能吗?

电报提供" 秘密聊天 ".机器人是否可能打开秘密聊天并发送消息?我找不到此功能的任何方法或参数.

chat telegram-bot

16
推荐指数
2
解决办法
7699
查看次数