Skip to content

Instantly share code, notes, and snippets.

@midknightmare666
Created August 21, 2020 02:48
Show Gist options
  • Save midknightmare666/b264196362dc9b825b38ffa3d381b6f0 to your computer and use it in GitHub Desktop.
Save midknightmare666/b264196362dc9b825b38ffa3d381b6f0 to your computer and use it in GitHub Desktop.
const exampleImages = [
'example_0.jpg',
'example_1.jpg',
'example_2.jpg'
]
let currentIndex = -1;
/**
* @function setBanner
* @description sets discord guild banner every minute
*
* @param {<Discord<Client>} client discord client
* @param {String} guildID discord guild id
* @param {Array<String>} images images to be displayed
*/
const setBanner = (client, guildID, images) => {
currentIndex += 1;
if (currentIndex >= images.length) {
currentIndex = 0;
};
client.guilds.find(guild => guild.id === guildID).setBanner(images[currentIndex]);
};
setInterval(setBanner, 60000, client, guildID, images);
// example
/**
* setInterval(setBanner, 60000, soa, '388542852096983040', exampleImages)
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment