Every 15 minutes
Save Discord attachments to Google Drive
Every file shared in your Discord channel is copied to a Google Drive folder within 15 minutes, named with the channel, author and date.
- Runs
- Every 15 minutes
- Apps
- Discord, Google Drive
- AI
- Not needed
- Access
- bot Read Message History + Message Content intent; Drive drive.file
Send this to your assistant
Create a ClickRuntime automation: every 15 minutes, copy new attachments posted in my Discord channel into a Google Drive folder.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
A game studio's artists share concept sketches, screenshots and audio clips in a Discord channel throughout the day. Months later, someone needs the version of a character sketch from spring, and it means scrolling back through thousands of messages. Some old links no longer even load, because Discord's file links expire.
Copying each file to Google Drive as soon as it is shared gives the team a searchable, permanent archive, organised by who posted it and when.
What you get out of it
Files that do not disappear
Discord links to attachments can expire. A copy in Drive stays available for as long as you keep it.
Find anything in seconds
Files are named with the channel, author and date. A Drive search finds last spring's sketch instead of an afternoon of scrolling.
One place for shared work
Everything posted in the channel ends up in one folder. It can be shared with clients or colleagues who are not in your Discord.
Nobody has to remember to upload
People keep sharing work the way they already do. The archive builds itself in the background.
Each file copied once
Messages already handled are skipped, so the folder holds no duplicates even though the channel is checked every 15 minutes.
How it works
What happens, step by step
Every 15 minutes, ClickRuntime reads the messages posted in your Discord channel since the last check.
It picks out any message with a file attached, remembering the last message it saw so nothing is copied twice.
It downloads each file straight away, before Discord's link expires.
Each file is saved to your Google Drive folder, named with the channel, author and date.
Before it runs live
- Connect Discord
- Connect Google Drive
What you get
Build your own
Need it to work differently?
Your own rules
Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.
Any number of apps
One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.
AI where it helps
Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.
On a schedule or on each event
Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.
Changes you can ask for
- Act only on the items that match your own rules, and skip the rest
- Add an AI step, for example to summarize, sort or draft a reply
- Add another app, for example also send it to Slack
- Combine it with other Discord and Google Drive steps into one automation
Under the hood
The code that runs this automation
import io
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from googleapiclient.http import MediaIoBaseUpload
from clickruntime import on_trigger, credentials, http, state, report_fetched
CHANNEL_ID = "your-discord-channel-id"
CHANNEL_NAME = "art"
FOLDER_ID = "your-drive-folder-id"
@on_trigger
def run(event):
after = state.get("after") or "0"
msgs = http.get(f"https://discord.com/api/v10/channels/{CHANNEL_ID}/messages", params={"after": after, "limit": 100},
headers={"Authorization": f"Bot {credentials.secret('DISCORD_BOT_TOKEN')}"}).json()
files = [(m, a) for m in msgs for a in m.get("attachments", [])]
report_fetched(len(files))
if not files:
return {"summary": "Nothing new"}
drive = build("drive", "v3", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False)
for m, a in files:
data = http.get(a["url"]).content
name = f"{CHANNEL_NAME}-{m['author']['username']}-{m['timestamp'][:10]}-{a['filename']}"
media = MediaIoBaseUpload(io.BytesIO(data), mimetype=a.get("content_type", "application/octet-stream"))
drive.files().create(body={"name": name, "parents": [FOLDER_ID]}, media_body=media, fields="id").execute()
state.set("after", max(msgs, key=lambda m: int(m["id"]))["id"])
return {"summary": f"{len(files)} files saved"}FAQ
Common questions
What does the bot need in Discord?
How are the files named in Drive?
Are large files supported?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
Announce new Google Drive files in Discord
When someone drops a file into your Drive inbox folder, your Discord channel gets a message with its name, owner and link.
See how it worksBack up your data to Google Drive every night
Every night your data is saved to a dated folder in Google Drive, and Discord tells you whether the backup worked.
See how it worksSee new job listings as they're posted
Jobs that match your keywords show up in a Slack channel, each one only once.
See how it worksKeep exploring
Set up “Save Discord attachments to Google Drive” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.