autocode.com
Open in
urlscan Pro
2606:4700::6812:bc
Public Scan
Submitted URL: http://discord-diffusion.com/
Effective URL: https://autocode.com/stabilityai/templates/discord-diffusion/
Submission Tags: phish.gg anti.fish automated Search All
Submission: On November 16 via api from DE — Scanned from DE
Effective URL: https://autocode.com/stabilityai/templates/discord-diffusion/
Submission Tags: phish.gg anti.fish automated Search All
Submission: On November 16 via api from DE — Scanned from DE
Form analysis
0 forms found in the DOMText Content
DISCORD DIFFUSION: BOT FOR IMAGE GENERATION VIA STABLE DIFFUSION Stability AI — stabilityai Published from stabilityai/discord-diffusion DISCORD DIFFUSION: BOT FOR IMAGE GENERATION VIA STABLE DIFFUSION Discord Diffusion is a fully customizable and easy-to-install Discord bot that brings image generation via Stable Diffusion right to your Discord server. It responds to @Bot your image prompt to generate an image. Drive engagement, have fun with your community members, and see what you can create! Discord Diffusion is fully open source and leverages Autocode's API integration and serverless hosting platform to make it really easy to customize your bot. When installing, you'll be asked to link both your Discord bot credentials and your Stability AI credentials. Note that you'll need to enable Privileged Intents on your bot to allow it to respond to mentions. Once properly deployed, your bot is editable via Autocode's web editor. GETTING STARTED To install Discord Diffusion to your Discord server, click on the Install button above on this page. If you don't have an Autocode account yet you'll be asked to create one and walked through Autocode onboarding. Next, you'll be asked to link your Discord and Stability AI API credentials. Once those accounts are linked it will take only a few seconds to deploy your bot! MY BOT ISN'T RESPONDING TO MENTIONS, HELP? You'll need to enable Privileged Intents, specifically the Message Content intent to get your bot to work out-of-the-box. Once enabled, your bot will respond to mentions. HOW DOES THIS WORK? The bot makes use of Autocode's built-in Discord event routing to route bot_mention events to the file functions/events/discord/bot_mention.js. This file first parses necessary information from the Discord event: let event = context.params.event; let mentions = event.mentions; let botMention = mentions.find(mention => mention.bot); let content = event.content; let author = event.author; let message = content.replace(/<@(\d+)>/gi, ($0, $1) => { let mention = mentions.find(mention => mention.id === $1); if (mention) { return `<@${mention.username}>`; } else { return `<@:unknown>`; } }); message = message.trim(); let botName = `<@${botMention.username}>`; let prompt = message; // Get rid of the bot name if it's at the start of the message if (message.startsWith(botName)) { prompt = message.slice(botName.length).trim(); } Then sends a placeholder message to Discord using the Discord API on Autocode... let messageResponse = await lib.discord.channels['@0.3.3'].messages.create({ channel_id: context.params.event.channel_id, content: `Generating **${prompt}**, give me a moment...`, tts: false, message_reference: { message_id: context.params.event.id, fail_if_not_exists: false } }); Then speaks to Stability AI's API to ask it to generate an image using some default parameters and the prompt the user entered... let imageResult = await lib.stabilityai.api['@0.1.2'].generation.txt2img({ model: 'stable-diffusion-v1-5', prompts: [ { 'text': prompt, 'weight': 1 } ], images: 1, steps: 30, cfg: 7.5, width: 512, height: 512, sampler: 'AUTO', guidance: true }); And finally, updates the Discord message with the attached image once generated. let editMessageResponse = await lib.discord.channels['@0.3.3'].messages.update({ message_id: messageResponse.id, channel_id: context.params.event.channel_id, content: `Here's your image of **${prompt}**!`, attachments: [{ file: imageResult.artifacts[0].image, filename: `${filename}.png`, description: prompt }] }); HOW CAN I IMPROVE THE BOT? Improving images Playing around with different prompts and models via the Stability AI API is the best place to get started. We'll make sure we work on preparing more prompt guidance content in the future! Improving bot functionality Autocode is specialized at connecting different APIs together. We encourage you to play with the OpenAI API to generate completions that can then be used as prompts. You can also try connecting the Stability AI API to other apps -- Twitter, Slack, Email. Have fun! HOW CAN I GET MORE HELP? Your best bet for help is to visit Autocode's official Discord server at discord.gg/autocode. You can also e-mail Autocode directly at contact@autocode.com. To see what other people in the Stable Diffusion community are building, join Stable Diffusion on Discord at discord.gg/stablediffusion. Happy hacking! Home Docs Pricing Resources Resource Center Guides fn APIs Snippets Templates Videos Community Announcements Case Studies Social Discord Support Reach us on Twitter Devtools on Github Resources Resource Center Guides fn APIs Templates Snippets Videos Pricing Docs Login Sign up Not Signed In Click to Sign In Loading... AP: ... Dashboard Account -------------------------------------------------------------------------------- My Profile -------------------------------------------------------------------------------- fn My APIs My Snippets My Templates -------------------------------------------------------------------------------- Sign out No new notifications Show more Loading... undefined stabilityai read-only undefined Empty Empty * Threads Latest Updates (0) * Template Community Templates (1) * Code Snippet Community Snippets (1) APIs (1) * Standard Library API api 0.1.2 Templates (1) * Template Discord Diffusion: Bot for image generation via Stable Diffusion Snippets (1) * Code Snippet Generate images in Discord with Stable Diffusion Edit Profile Stability AI Organization Pay me STABILITYAI · stability.ai/ Resources / Stability AI / Templates / Discord Diffusion: Bot for image generation via Stable Diffusion 5.0 Team Autocode Rating Discord Diffusion: Bot for image generation via Stable Diffusion Stability AI Discord Autocode Generate the images of your dreams right inside of Discord Stability AI Verified Partner · updated Jan 24, 2023 · 28.6k · 1.9k Install 1.9k View Source 28.6k View Gallery (/readme/gallery/) DISCORD DIFFUSION: BOT FOR IMAGE GENERATION VIA STABLE DIFFUSION Discord Diffusion is a fully customizable and easy-to-install Discord bot that brings image generation via Stable Diffusion right to your Discord server. It responds to @Bot your image prompt to generate an image. Drive engagement, have fun with your community members, and see what you can create! Discord Diffusion is fully open source and leverages Autocode's API integration and serverless hosting platform to make it really easy to customize your bot. When installing, you'll be asked to link both your Discord bot credentials and your Stability AI credentials. Note that you'll need to enable Privileged Intents on your bot to allow it to respond to mentions. Once properly deployed, your bot is editable via Autocode's web editor. GETTING STARTED To install Discord Diffusion to your Discord server, click on the Install button above on this page. If you don't have an Autocode account yet you'll be asked to create one and walked through Autocode onboarding. Next, you'll be asked to link your Discord and Stability AI API credentials. Once those accounts are linked it will take only a few seconds to deploy your bot! MY BOT ISN'T RESPONDING TO MENTIONS, HELP? You'll need to enable Privileged Intents, specifically the Message Content intent to get your bot to work out-of-the-box. Once enabled, your bot will respond to mentions. HOW DOES THIS WORK? The bot makes use of Autocode's built-in Discord event routing to route bot_mention events to the file functions/events/discord/bot_mention.js. This file first parses necessary information from the Discord event: 0 / 0 Replace Replace All read only javascript 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 let event = context.params.event; let mentions = event.mentions; let botMention = mentions.find(mention => mention.bot); let content = event.content; let author = event.author; let message = content.replace(/<@(\d+)>/gi, ($0, $1) => { ··let mention = mentions.find(mention => mention.id === $1); ··if (mention) { ····return `<@${mention.username}>`; ··} else { ····return `<@:unknown>`; ··} }); message = message.trim(); let botName = `<@${botMention.username}>`; let prompt = message; // Get rid of the bot name if it's at the start of the message if (message.startsWith(botName)) { ··prompt = message.slice(botName.length).trim(); } x WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW Please select a file. Loading... This file type is not supported. Some errors tab ( { [ ` $ ' " ! ? | & = : < > / * % \ + - _ ) } ] ^ ~ # @ untab // undo redo Then sends a placeholder message to Discord using the Discord API on Autocode... 0 / 0 Replace Replace All read only javascript 1 2 3 4 5 6 7 8 9 10 let messageResponse = await lib.discord.channels['@0.3.3'].messages.create({ ··channel_id: context.params.event.channel_id, ··content: `Generating **${prompt}**, give me a moment...`, ··tts: false, ··message_reference: { ····message_id: context.params.event.id, ····fail_if_not_exists: false ··} }); x WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW Please select a file. Loading... This file type is not supported. Some errors tab ( { [ ` $ ' " ! ? | & = : < > / * % \ + - _ ) } ] ^ ~ # @ untab // undo redo Then speaks to Stability AI's API to ask it to generate an image using some default parameters and the prompt the user entered... 0 / 0 Replace Replace All read only javascript 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 let imageResult = await lib.stabilityai.api['@0.1.2'].generation.txt2img({ ··model: 'stable-diffusion-v1-5', ··prompts: [ ····{ ······'text': prompt, ······'weight': 1 ····} ··], ··images: 1, ··steps: 30, ··cfg: 7.5, ··width: 512, ··height: 512, ··sampler: 'AUTO', ··guidance: true }); x WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW Please select a file. Loading... This file type is not supported. Some errors tab ( { [ ` $ ' " ! ? | & = : < > / * % \ + - _ ) } ] ^ ~ # @ untab // undo redo And finally, updates the Discord message with the attached image once generated. 0 / 0 Replace Replace All read only javascript 1 2 3 4 5 6 7 8 9 10 11 let editMessageResponse = await lib.discord.channels['@0.3.3'].messages.update({ ··message_id: messageResponse.id, ··channel_id: context.params.event.channel_id, ··content: `Here's your image of **${prompt}**!`, ··attachments: [{ ····file: imageResult.artifacts[0].image, ····filename: `${filename}.png`, ····description: prompt ··}] }); x WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW Please select a file. Loading... This file type is not supported. Some errors tab ( { [ ` $ ' " ! ? | & = : < > / * % \ + - _ ) } ] ^ ~ # @ untab // undo redo HOW CAN I IMPROVE THE BOT? Improving images Playing around with different prompts and models via the Stability AI API is the best place to get started. We'll make sure we work on preparing more prompt guidance content in the future! Improving bot functionality Autocode is specialized at connecting different APIs together. We encourage you to play with the OpenAI API to generate completions that can then be used as prompts. You can also try connecting the Stability AI API to other apps -- Twitter, Slack, Email. Have fun! HOW CAN I GET MORE HELP? Your best bet for help is to visit Autocode's official Discord server at discord.gg/autocode. You can also e-mail Autocode directly at contact@autocode.com. To see what other people in the Stable Diffusion community are building, join Stable Diffusion on Discord at discord.gg/stablediffusion. Happy hacking! Web Project 2 Endpoints — Available once deployed Scripted Endpoint .../self/deployed/ .../self/deployed.js /events/autocode/self/deployed/ from file functions/events/autocode/self/deployed.js will trigger → discord/guilds/list discord/guilds/channels/list discord/users/me/list Scripted Endpoint .../discord/bot_mention/ .../discord/bot_mention.js /events/discord/bot_mention/ from file functions/events/discord/bot_mention.js will trigger → discord/channels/messages/create stabilityai/api/generation/txt2img discord/channels/messages/update + 1 more Directory / — Directory Explorer Endpoint Directory functions/events — — Directory readme — — Autocode Project Config stdlib.json application/json 295 B Autocode README README.md text/markdown 5 kB File: application/octet-stream .gitignore application/octet-stream 46 B File: application/json package.json application/json 121 B File: application/json payloads.json application/json 2 B BRING YOUR NEXT GREAT IDEA TO LIFE WITH AUTOCODE BUILD AND HOST NODE.JS ENDPOINTS IN SECONDS. CONNECT TO YOUR FAVORITE APIS LIKE AIRTABLE, DISCORD, NOTION, SLACK, WEBFLOW AND MORE. Try for free Join us on Discord Company Home About us Pricing Careers Contact Us Resources Resource Center Guides APIs Templates Snippets Videos Documentation Community Announcements Case Studies Discord Twitter GitHub Solutions Guide: How to make a Discord bot Custom ChatGPT Plugins DiscordGPT: AI Chatbot Discord bots 24/7 Discord bot hosting Discord Slash Command Builder Discord Embed Builder Twitch bots Slack bots Policies Terms Privacy Security DPA San Francisco · Toronto © 2023 Polybit Inc.