DEV Community

loading...
Cover image for NoCache
Mr. Robøt

NoCache

Thomas Bnt
French web developer maintly but touches everything, servers, bots, community management, events, social networks and moore. I learn VueJs at this moment and MySQL. — Addict to Cappuccino and Music
Updated on ・1 min read

New project Open Source on GitHub !

TLDR : Generate randomly a string for clear cache from CloudFlare or other CDN. Using on Mr. Robøt.

This file is used on the bot for no cache files from CDNs. Discord uses CloudFlare for caching management which can be problematic when you change an image and display it on the platform. Even after a change on your side, Discord can still keep the old version in its cache.

FolderIcons = 'https://mrrobot.app/Folder/Of/Icons'

function getFolderIcons(File, Log) {
    const GenNumberCache = Math.round(Math.random() * 0xFFFFFFFFFF).toString(30)
    if (Log) console.log (`Out : ${FolderIcons}/${File}?NoCache=${GenNumberCache}`)
    return `${FolderIcons}/${File}?NoCache=${GenNumberCache}`
}
Enter fullscreen mode Exit fullscreen mode

GitHub logo Mist3r-Robot / NoCache

Generate randomly a string for clear cache from CloudFlare or other CDN. Using on Mr. Robøt.

Discussion (0)