小编Mik*_*ike的帖子

heroku 电报机器人,BadRequest:Bad webhook:ip 地址 0.0.0.0 被保留

我创建了一个简单的电报机器人:

import logging
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
import os
PORT = int(os.environ.get('PORT', 8443))

# Enable logging
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
                    level=logging.INFO)

logger = logging.getLogger(__name__)
TOKEN = 'YOURTELEGRAMBOTTOKEN'

# Define a few command handlers. These usually take the two arguments update and
# context. Error handlers also receive the raised TelegramError object in error.
def start(update, context):
    """Send a message when the command /start is issued."""
    update.message.reply_text('Hi!')

def help(update, context):
    """Send a message when the …
Run Code Online (Sandbox Code Playgroud)

python heroku telegram

5
推荐指数
1
解决办法
975
查看次数

模板默认初始化,如果类中没有默认构造函数

我对 C++ 很陌生。我编写了一个函数模板来对向量中的所有元素求和,如下所示:

template<typename T>
inline T sumator(const std::vector<T> &sequence) {
    T init = T{};
    return accumulate(sequence.begin(), sequence.end(), init);
}
Run Code Online (Sandbox Code Playgroud)

一切正常,直到默认构造函数没有声明,而是从例如 2 个参数声明构造函数。像这样:

class A {
    private:
        int a;
        int b;
    public:
//        A() = default;
        A(int aa, int bb) : a(aa),b(bb){};
        A operator+(const A &right) const {
            return {a + right.a, b + right.b};
        }
        bool operator==(const A &right) const {
            return (a == right.a && b == right.b);
        }

    };
    vector<A> bc = {{3,5},{5,5}};
    A res = Adder::sumator(works); …
Run Code Online (Sandbox Code Playgroud)

c++ c++11 c++17

0
推荐指数
1
解决办法
167
查看次数

标签 统计

c++ ×1

c++11 ×1

c++17 ×1

heroku ×1

python ×1

telegram ×1