DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Cover image for NoCache
Thomas Bnt for Mr. RobΓΈt

Posted on • Updated on

NoCache

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.

Top comments (0)

🌚 Friends don't let friends browse without dark mode.

Sorry, it's true.