1
0
mirror of https://github.com/Decicus/DecAPI-Docs.git synced 2024-11-25 22:02:32 +01:00

[Bots] Auto-replacing bot variables should only occur on Twitch-related APIs

This commit is contained in:
Alex Thomassen 2021-03-04 18:37:36 +01:00
parent 08064ead7d
commit 1f79ebd68b
Signed by: Alex
GPG Key ID: 10BD786B5F6FF5DE
2 changed files with 11 additions and 3 deletions

View File

@ -255,10 +255,18 @@ const botVariables = {
/**
* Replaces colon-prefixed variables with the correct bot variables.
*/
const twitchPaths = ['/bttv', '/ffz', '/twitch'];
function replaceBotVariables(bot, input) {
const replacements = botVariables[bot];
if (!replacements) {
/**
* Verify that the replacements for the bot exists.
*
* Also verify that the APIs are Twitch-related, as we don't want to replace
* `:user` and similar variables for Twitter APIs, for instance.
*/
const { path } = this.$route;
if (!replacements || !twitchPaths.includes(path)) {
return input;
}

View File

@ -250,7 +250,7 @@
<br>
<div class="card" id="toc" v-if="baseEndpoints.length > 0">
<div class="card" id="toc">
<a href="#toc">
<h5 class="card-header bg-primary text-white"><i class="fas fa-table"></i> Table of contents:</h5>
</a>
@ -260,7 +260,7 @@
<br>
However, you can click the path/header for the endpoint and it will allow you to directly link to that section.
</p>
<div class="list-group">
<div class="list-group" v-if="baseEndpoints.length > 0">
<router-link v-for="base in baseEndpoints" v-bind:to="base.name" v-bind:key="base.name" class="list-group-item">
<i class="fa-fw" v-bind:class="'fa-' + (base.icon ? base.icon : 'info fas')"></i> {{ base.title }}
</router-link>