Music bot fix

This commit is contained in:
WolverinDEV 2020-04-04 11:59:32 +02:00
parent e1e946ca35
commit 9063e17efb
3 changed files with 20 additions and 2 deletions

View File

@ -145,7 +145,7 @@ const std::vector<ErrorType> ts::avariableErrors = {
{0x0F00, "token_invalid_id" , "invalid privilege key" },
{0x1001, "web_handshake_invalid" , "Invalid handshake" },
{0x1000, "web_handshake_invalid" , "Invalid handshake" },
{0x1001, "web_handshake_unsupported" , "Handshake intention unsupported" },
{0x1002, "web_handshake_identity_unsupported" , "Handshake identity unsupported" },
{0x1003, "web_handshake_identity_proof_failed" , "Identity proof failed" },

View File

@ -147,7 +147,7 @@ namespace ts {
server_connect_banned = 0xd01,
ban_flooding = 0xd03,
token_invalid_id = 0xf00,
web_handshake_invalid = 0x1001,
web_handshake_invalid = 0x1000,
web_handshake_unsupported = 0x1001,
web_handshake_identity_unsupported = 0x1002,
web_handshake_identity_proof_failed = 0x1003,

View File

@ -160,6 +160,10 @@ namespace ts {
template <typename vector_t>
friend class command_builder_impl;
public:
inline void reserve(size_t length, bool accumulative = true) {
this->bulk.reserve(length + (accumulative ? this->bulk.size() : 0));
}
inline void put(const std::string_view& key, const std::string_view& value) {
size_t begin, end;
if(impl::value_raw_impl(this->bulk, key, begin, &end)) {
@ -272,6 +276,20 @@ namespace ts {
inline void put_unchecked(size_t index, const std::string_view& key, const T& value) {
this->bulk(index).put_unchecked(key, value);
}
[[nodiscard]] inline size_t current_size() const {
if(this->bulks.empty()) return 0;
size_t result{0};
for(const auto& entry : this->bulks)
result += entry.length() + 2;
return result;
}
inline void reset() {
for(auto& bulk : this->bulks)
bulk = " ";
}
private:
command_builder_impl(size_t expected, std::string identifier, typename vector_t::iterator begin, typename vector_t::iterator end) : expected_bulk_size{expected}, _identifier{std::move(identifier)}, bulks{begin, end} {}