Skip to content

Commit

Permalink
Merge branch 'brainboxdotcc:master' into docs_change
Browse files Browse the repository at this point in the history
  • Loading branch information
wizard7377 authored Jul 12, 2023
2 parents 0057ab7 + e179555 commit a5a1bcb
Show file tree
Hide file tree
Showing 7 changed files with 5,525 additions and 16 deletions.
18 changes: 18 additions & 0 deletions buildtools/emojis.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

echo "-- Autogenrating include/dpp/unicode_emoji.h\n";

$header = "#pragma once\n\nnamespace dpp { namespace unicode_emoji {\n";

/* This JSON is generated originally via the NPM package maintained by Discord themselves at https://www.npmjs.com/package/discord-emoji */
$emojis = json_decode(file_get_contents("https://raw.githubusercontent.com/ArkinSolomon/discord-emoji-converter/master/emojis.json"));
if ($emojis) {
foreach ($emojis as $name=>$code) {
if (preg_match("/^\d+/", $name)) {
$name = "_" . $name;
}
$header .= " constexpr const char[] " .$name . " = \"$code\";\n";
}
$header .= "}\n};\n";
file_put_contents("include/dpp/unicode_emoji.h", $header);
}
33 changes: 17 additions & 16 deletions include/dpp/collector.h
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
/*
* Discord erlpack - tidied up for D++, Craig Edwards 2021.
*
* MessagePack system dependencies modified for erlpack.
*
* Copyright (C) 2008-2010 FURUHASHI Sadayuki
/************************************************************************************
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* D++, A Lightweight C++ library for Discord
*
* http://www.apache.org/licenses/LICENSE-2.0
* Copyright 2021 Craig Edwards and D++ contributors
* (https://github.com/brainboxdotcc/DPP/graphs/contributors)
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
************************************************************************************/
#pragma once

#include <dpp/export.h>
Expand Down
6 changes: 6 additions & 0 deletions include/dpp/message.h
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,12 @@ struct DPP_EXPORT embed {
*/
embed& set_color(uint32_t col);

/** Set embed colour. Returns the embed itself so these method calls may be "chained"
* @param col The colour of the embed
* @return A reference to self
*/
embed& set_colour(uint32_t col);

/** Set embed timestamp. Returns the embed itself so these method calls may be "chained"
* @param tstamp The timestamp to show in the footer, should be in UTC
* @return A reference to self
Expand Down
2 changes: 2 additions & 0 deletions include/dpp/stringops.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ template <int> int from_string(const std::string &s)
template <typename T> std::string to_hex(T i)
{
std::stringstream stream;
stream.imbue(std::locale::classic());
stream << std::setfill('0') << std::setw(sizeof(T)*2) << std::hex << i;
return stream.str();
}
Expand All @@ -205,6 +206,7 @@ template <typename T> std::string to_hex(T i)
template <typename T> std::string leading_zeroes(T i, size_t width)
{
std::stringstream stream;
stream.imbue(std::locale::classic());
stream << std::setfill('0') << std::setw((int)width) << std::dec << i;
return stream.str();
}
Expand Down
Loading

0 comments on commit a5a1bcb

Please sign in to comment.