Skip to content

Commit

Permalink
automatic commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Docs Deployment Bot committed Oct 11, 2024
1 parent 472be14 commit 66239f5
Show file tree
Hide file tree
Showing 226 changed files with 7,217 additions and 7,336 deletions.
4 changes: 2 additions & 2 deletions advanced-reference.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ var advanced_reference =
[ "Clusters, Shards, and Guilds", "clusters-shards-guilds.html", null ],
[ "Thread Model", "thread-model.html", null ],
[ "Voice Model", "voice-model.html", [
[ "High Level Summary", "voice-model.html#autotoc_md85", null ],
[ "Flow Diagram", "voice-model.html#autotoc_md86", null ]
[ "High Level Summary", "voice-model.html#autotoc_md84", null ],
[ "Flow Diagram", "voice-model.html#autotoc_md85", null ]
] ],
[ "Coding Style Standards", "coding-standards.html", null ],
[ "Documentation Style Standards", "docs-standards.html", null ],
Expand Down
4 changes: 2 additions & 2 deletions audioframe.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions automating-with-jenkins.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@
</div><!--header-->
<div class="contents">
<div class="textblock"><dl class="section note"><dt>Note</dt><dd>This page does NOT go into explaining how to install Jenkins, nor how to initially setup Jenkins. This is a tutorial for the CMake version with Linux (more specifically Ubuntu 22.04 LTS). If you don't know how to use CMake or you don't use CMake for your bot (and would like to) then please visit <a class="el" href="buildcmake.html">Building a Discord Bot Using CMake (UNIX)</a>. If you wish to automate this tutorial from GitHub pushes then you can simply download the GitHub plugin for Jenkins, set that up and this tutorial will still work as this tutorial will only build what it can see!</dd></dl>
<h2><a class="anchor" id="autotoc_md32"></a>
<h2><a class="anchor" id="autotoc_md31"></a>
Getting started</h2>
<p >First of all, you'll want to create your project. For this, we'll use a "Freestyle project" as we're just going to be calling some bash commands to tell CMake to build. We'll be calling this "DiscordBot" but you can name it whatever you want. I would advise against non-ASCII characters.</p>
<div class="image">
<img src="jenkinsproject.png" alt=""/>
</div>
<p >From here, just hit <code>Ok</code> and now you've created your Jenkins project, Well done! From here you can add a description, change the security policy (if your Jenkins is public), really whatever your heart desires.</p>
<h2><a class="anchor" id="autotoc_md33"></a>
<h2><a class="anchor" id="autotoc_md32"></a>
Automating the Building Process</h2>
<p >Scrolling down, you'll find <code>Build Steps</code>. You can also click <code>Build Steps</code> on the left. Here, you'll want to hit <code>Add build step</code> and hit <code>Execute shell</code>.</p>
<div class="image">
Expand All @@ -130,20 +130,20 @@ <h2><a class="anchor" id="autotoc_md33"></a>
<img src="shelljenkins.png" alt=""/>
</div>
<p >Now you can hit save!</p>
<h2><a class="anchor" id="autotoc_md34"></a>
<h2><a class="anchor" id="autotoc_md33"></a>
Seeing the Builds Work</h2>
<p >Making sure you have your project files in the workspace directory (you can see this by pressing <code>Workspace</code> on the left, the files will automatically be pulled from GitHub if you're using the GitHub plugin), you should be able to hit <code>Build Now</code> and see a new build in the History appear. If everything went well, you should have a green tick!</p>
<dl class="section note"><dt>Note</dt><dd>Building can take a while if you haven't set up your build directory before (doing <code>cmake ..</code>), especially on less-powerful machines, so don't be alarmed!</dd></dl>
<div class="image">
<img src="buildhistoryjenkins.png" alt=""/>
</div>
<h2><a class="anchor" id="autotoc_md35"></a>
<h2><a class="anchor" id="autotoc_md34"></a>
Running the Build</h2>
<p >Running the builds is the same as any other time, but we'll still cover it! However, we won't cover running it in background and whatnot, that part is completely down to you.</p>
<p >First, you need to get into the <code>jenkins</code> user. If you're like me and don't have the Jenkins user password, you can login with your normal login (that has sudo perms) and do <code>sudo su - jenkins</code>. Once logged in, you'll be in <code>/var/lib/jenkins/</code>. From here, you'll want to do <code>cd workspace/DiscordBot/</code> (make sure to replace "DiscordBot" with your bot's name. Remember, you can tab-complete this) and then <code>cd build</code>. Now, you can simply do <code>./DiscordBot</code>!</p>
<dl class="section warning"><dt>Warning</dt><dd>If you are going to be running the bot at the same time as builds, I would heavily advise that you copy the bot (if it's not statically linked, then copy the entire build directory) to a different location. This is so you can pick and choose when the bot gets updated (and even means you can run experimental builds as opposed to stable builds) but also means you avoid any risk of the bot crashing during build (as Jenkins will be overwriting your executable and libraries).</dd></dl>
<p>Once you're happy with everything, then you're good to go! Enjoy your automated builds!</p>
<h2><a class="anchor" id="autotoc_md36"></a>
<h2><a class="anchor" id="autotoc_md35"></a>
Possible Permission Issues</h2>
<p >Sometimes, doing <code>./DiscordBot</code> can end up with an error, saying you don't have permission to execute. If that's the case, simply do <code>chmod +x DiscordBot</code> and now you can re-run <code>./DiscordBot</code>. </p>
</div></div><!-- contents --><script src="https://giscus.app/client.js" data-repo="brainboxdotcc/dpp-comments" data-repo-id="R_kgDOHOY4xg" data-category="General" data-category-id="DIC_kwDOHOY4xs4CRYtj" data-mapping="pathname" data-strict="1" data-reactions-enabled="1" data-emit-metadata="1" data-input-position="top" data-theme="preferred_color_scheme" data-lang="en" data-loading="lazy" crossorigin="anonymous" async></script>
Expand Down
2 changes: 1 addition & 1 deletion build-a-bot-xcode.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
</div>
</li>
</ol>
<h2><a class="anchor" id="autotoc_md174"></a>
<h2><a class="anchor" id="autotoc_md173"></a>
Troubleshooting</h2>
<ul>
<li>Stuck? You can find us on the <a href="https://discord.gg/dpp">official Discord server</a> - ask away! We don't bite! </li>
Expand Down
2 changes: 1 addition & 1 deletion build-a-discord-bot-linux-clion.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
</div><!--header-->
<div class="contents">
<div class="textblock"><dl class="section warning"><dt>Warning</dt><dd><b>This tutorial assumes you are using Ubuntu</b>. You might use other distros if you prefer, but keep in mind the setup process might be different! This tutorial also teaches you how to use DPP with CMake, using the JetBrains IDE <b><a href="https://www.jetbrains.com/clion/">CLion</a></b>. If you have not installed CLion, You can <a href="https://www.jetbrains.com/de-de/clion/download/">download CLion here</a>. If you do not have DPP installed, visit <a class="el" href="buildcmake.html">this page</a> on how to setup the project using a precompiled version of DPP. If you want to use source and haven't set that up, look towards <a class="el" href="buildlinux.html">this page</a> on how to do so. <b>This tutorial will not teach you how to setup CMake and will assume you have already done so</b>.</dd></dl>
<h3><a class="anchor" id="autotoc_md154"></a>
<h3><a class="anchor" id="autotoc_md153"></a>
Add an example program</h3>
<p >Open up CLion and open the folder for your bot. You may notice that CLion will start doing the whole CMake process and it will create a folder called <code>cmake-build-debug</code>, this is normal so don't be alarmed! It is just CLion registering all the CMake stuff so it can build and give you auto-suggestions.</p>
<p >Now, you can open your <code>main.cpp</code> file. If you have code there, then you're one step ahead! If not, copy and paste the following <a class="el" href="firstbot.html">example program</a> in the <code>main.cpp</code> and set your bot token (see <a class="el" href="creating-a-bot-application.html">Creating a Bot Token</a>). Here's how your <code>main.cpp</code> file should look:</p>
Expand Down
8 changes: 4 additions & 4 deletions build-a-discord-bot-windows-visual-studio.html
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,14 @@
<div class="contents">
<div class="textblock"><p >To create a basic bot using <b>Visual Studio 2019</b> or <b>Visual Studio 2022</b>, follow the steps below to create a <em>working skeleton project you can build upon</em>.</p>
<p >If you prefer a video tutorial, you can watch the video below! Otherwise, scroll past and keep reading!</p>
<h2><a class="anchor" id="autotoc_md171"></a>
<h2><a class="anchor" id="autotoc_md170"></a>
Video Tutorial</h2>
<p >

<iframe width="560" height="315" src="https://www.youtube.com/embed/JGqaQ9nH5sk?si=dung8KuYbWvP2_oL" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>

</p>
<h2><a class="anchor" id="autotoc_md172"></a>
<h2><a class="anchor" id="autotoc_md171"></a>
Text Tutorial</h2>
<ol type="1">
<li>Make sure you have Visual Studio 2019 or 2022. Community, Professional or Enterprise work fine. These instructions are not for Visual Studio Code. You can <a href="https://visualstudio.microsoft.com/downloads/">download the correct version here</a>. Note that older versions of Visual Studio will not work as they do not support enough of the C++17 standard.</li>
Expand All @@ -132,7 +132,7 @@ <h2><a class="anchor" id="autotoc_md172"></a>
</div>
</li>
</ol>
<h2><a class="anchor" id="autotoc_md173"></a>
<h2><a class="anchor" id="autotoc_md172"></a>
Troubleshooting</h2>
<ul>
<li>If you get an error that looks like this: <div class="fragment"><div class="line"> 1&gt;MyBot.obj : error LNK2019: unresolved external symbol &quot;__declspec(dllimport) public: class dpp::async&lt;struct dpp::confirmation_callback_t&gt;</div>
Expand All @@ -143,7 +143,7 @@ <h2><a class="anchor" id="autotoc_md173"></a>
<div class="line">1&gt;...\windows-bot-template-main\x64\Debug\MyBot.exe : fatal error LNK1120: 1 unresolved externals</div>
<div class="line">1&gt;Done building project &quot;MyBot.vcxproj&quot; -- FAILED.</div>
</div><!-- fragment --> Make sure your don't have another version of the library installed through vcpkg. The template uses a slightly different version of D++ that has coroutines, while the vcpkg version does not, and the latter overwrites it! Uninstalling the library through vcpkg should fix this issue.</li>
<li>If you get an error that a DLL is missing (e.g. <code>dpp.dll</code> or <code>opus.dll</code>) when starting your bot, then simply copy all DLLs from the <b>bin</b> directory of where you cloned the D++ repository to, into the same directory where your bot's executable is. You only need to do this once. There should be several of these DLL files: <code>dpp.dll</code>, <code>zlib.dll</code>, <code>openssl.dll</code> and <code>libcrypto.dll</code> (or similarly named SSL related files), <code>libsodium.dll</code> and <code>opus.dll</code>. Note the template project does this for you, so you should never encounter this issue.</li>
<li>If you get an error that a DLL is missing (e.g. <code>dpp.dll</code> or <code>opus.dll</code>) when starting your bot, then simply copy all DLLs from the <b>bin</b> directory of where you cloned the D++ repository to, into the same directory where your bot's executable is. You only need to do this once. There should be several of these DLL files: <code>dpp.dll</code>, <code>zlib.dll</code>, <code>openssl.dll</code> and <code>libcrypto.dll</code> (or similarly named SSL related files), and <code>opus.dll</code>. Note the template project does this for you, so you should never encounter this issue.</li>
<li>If you get an error that says "Debug/Release mismatch", <b>you are using the wrong configuration of the D++ dll</b>. Your bot's executable and the dpp.dll file should both be built in the same configuration (Release or Debug), you get this error if they are different. <b>This also means you altered the template in a significant way,</b> we recommend you undo your modifications or reinstall the template.</li>
<li>Stuck? You can find us on the <a href="https://discord.gg/dpp">official Discord server</a> - ask away! We don't bite! </li>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion build-a-discord-bot-windows-wsl.html
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
<li>Now open PowerShell as Administrator and type <code>wsl</code> to start up your subsystem. You may also type <code>ubuntu</code> into your search bar and open it that way.</li>
<li>Head on over to your home directory using <code>cd ~</code>.</li>
<li>Download the latest build for your distro using <code>wget [url here]</code>. In this guide we will use the latest build for 64 bit Ubuntu: <code>wget -O libdpp.deb <a href="https://dl.dpp.dev/latest">https://dl.dpp.dev/latest</a></code>.</li>
<li>Finally install all required dependencies and the library itself using <code>sudo apt-get install libopus0 libopus-dev libsodium-dev &amp;&amp; sudo dpkg -i libdpp.deb &amp;&amp; rm libdpp.deb</code>.</li>
<li>Finally install all required dependencies and the library itself using <code>sudo apt-get install libopus0 libopus-dev &amp;&amp; sudo dpkg -i libdpp.deb &amp;&amp; rm libdpp.deb</code>.</li>
<li>Congratulations, you've successfully installed all dependencies! Now comes the real fun: Setting up the environment! For this tutorial we'll use a as small as possible setup, so you might create a more advanced one for production bots.</li>
<li>Create a new directory, inside your home directory, using <code>mkdir MyBot</code>. Then, you want to open that directory using <code>cd MyBot</code>.</li>
<li>Now that you've a directory to work in, type <code>touch mybot.cxx</code> to create a file you can work in!</li>
Expand Down
8 changes: 4 additions & 4 deletions buildcmake.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,18 @@
</div><!--header-->
<div class="contents">
<div class="textblock"><dl class="section warning"><dt>Warning</dt><dd><b>This tutorial will assume that you have already installed DPP.</b> If you haven't, please head over to <a class="el" href="install-linux-deb.html">this page</a>, or any install page that matches your OS. If you want to use source, then continue your journey over at <a class="el" href="buildlinux.html">this page</a> for a full explanation into using CMake with source.</dd></dl>
<h2><a class="anchor" id="autotoc_md159"></a>
<h2><a class="anchor" id="autotoc_md158"></a>
1. Toolchain</h2>
<p >Before continuing, you will need to install <code>cmake</code> on your system. To be sure that <code>cmake</code> is installed, you can type the following command:</p>
<div class="fragment"><div class="line">$ cmake --version</div>
<div class="line">cmake version 3.22.1</div>
</div><!-- fragment --><p >If your CMake version is not as shown above then don't worry! You can still follow along, even if you're ahead or behind!</p>
<h2><a class="anchor" id="autotoc_md160"></a>
<h2><a class="anchor" id="autotoc_md159"></a>
2. Create a CMake project</h2>
<p >In an empty directory, create the following files and directories:</p>
<div class="dotgraph">
<iframe scrolling="no" frameborder="0" src="dot_inline_dotgraph_4.svg" width="839" height="368"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
<h2><a class="anchor" id="autotoc_md161"></a>
<h2><a class="anchor" id="autotoc_md160"></a>
3. Configure CMake</h2>
<p >You'll need to modify the <code>CMakeLists.txt</code> to tell CMake what it's looking for, and other information.</p>
<p >Here is an example CMake configuration, you can adapt it according to your needs:</p>
Expand Down Expand Up @@ -156,7 +156,7 @@ <h2><a class="anchor" id="autotoc_md161"></a>
<div class="line">include(FindPackageHandleStandardArgs)</div>
<div class="line"> </div>
<div class="line">find_package_handle_standard_args(DPP DEFAULT_MSG DPP_LIBRARIES DPP_INCLUDE_DIR)</div>
</div><!-- fragment --><h2><a class="anchor" id="autotoc_md162"></a>
</div><!-- fragment --><h2><a class="anchor" id="autotoc_md161"></a>
4. Build the bot.</h2>
<p >Now that we have our all our cmake stuff setup and we've got our code in place, we can initalise CMake. You'll want to go inside the <code>build/</code> directory and do <code>cmake ..</code>.</p>
<p >Once that's completed, you'll want to head back to your up-most folder (where all the folders are for your bot) and run <code>cmake --build build/ -j4</code> (replace -j4 with however many threads you want to use). This will start compiling your bot and creating the executable.</p>
Expand Down
19 changes: 8 additions & 11 deletions buildfreebsd.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,33 +102,30 @@
</div><!--header-->
<div class="contents">
<div class="textblock"><dl class="section note"><dt>Note</dt><dd>This page assumes you are the root user. If you are not, start the package install commands with <code>sudo</code>, along with <code>make install</code>. You will need <code>sudo</code> installed if you are not the root user.</dd></dl>
<h2><a class="anchor" id="autotoc_md87"></a>
<h2><a class="anchor" id="autotoc_md86"></a>
1. Toolchain</h2>
<p >Since the project uses <code>CMake</code>, you'll need to install it! If you don't have it, you can do the following:</p>
<div class="fragment"><div class="line">pkg install cmake</div>
</div><!-- fragment --><h2><a class="anchor" id="autotoc_md88"></a>
</div><!-- fragment --><h2><a class="anchor" id="autotoc_md87"></a>
2. Install Voice Dependencies (Optional)</h2>
<p >If you wish to use voice support, you'll need to install opus and libsodium:</p>
<p >First, you need to install opus. </p><div class="fragment"><div class="line">cd /usr/ports/audio/opus</div>
<div class="line">make &amp;&amp; make install</div>
</div><!-- fragment --><p >Then, you need to install libsodium.</p>
<div class="fragment"><div class="line">cd /usr/ports/security/libsodium</div>
<p >If you wish to use voice support, you'll need to install opus:</p>
<div class="fragment"><div class="line">cd /usr/ports/audio/opus</div>
<div class="line">make &amp;&amp; make install</div>
</div><!-- fragment --><h2><a class="anchor" id="autotoc_md89"></a>
</div><!-- fragment --><h2><a class="anchor" id="autotoc_md88"></a>
3. Build Source Code</h2>
<div class="fragment"><div class="line">cmake -B ./build</div>
<div class="line">cmake --build ./build -j8</div>
</div><!-- fragment --><p >Replace the number after <code>-j</code> with a number suitable for your setup, usually the same as the number of cores on your machine. <code>cmake</code> will fetch any dependencies that are required for you and ensure they are compiled alongside the library.</p>
<h2><a class="anchor" id="autotoc_md90"></a>
<h2><a class="anchor" id="autotoc_md89"></a>
4. Install Globally</h2>
<div class="fragment"><div class="line">cd build</div>
<div class="line">make install</div>
</div><!-- fragment --><h2><a class="anchor" id="autotoc_md91"></a>
</div><!-- fragment --><h2><a class="anchor" id="autotoc_md90"></a>
5. Installation to a Different Directory (Optional)</h2>
<p >If you want to install the library, its dependencies and header files to a different directory, specify this directory when running <code>cmake</code>:</p>
<div class="fragment"><div class="line">cmake .. -DCMAKE_INSTALL_PREFIX=/path/to/install</div>
</div><!-- fragment --><p >Then once the build is complete, run <code>sudo make install</code> to install to the location you specified.</p>
<h2><a class="anchor" id="autotoc_md92"></a>
<h2><a class="anchor" id="autotoc_md91"></a>
6. Using the Library</h2>
<p >Once installed, you can make use of the library in standalone programs simply by including it and linking to it:</p>
<div class="fragment"><div class="line">clang++ -std=c++17 -L/usr/local/lib -I/usr/local/include -ldpp bot.cpp -o dppbot</div>
Expand Down
Loading

0 comments on commit 66239f5

Please sign in to comment.