Skip to content

Instantly share code, notes, and snippets.

@rakinishraq
Last active December 7, 2023 11:26
Show Gist options
  • Save rakinishraq/ca6cb6d850295229582caa5c5ef82c86 to your computer and use it in GitHub Desktop.
Save rakinishraq/ca6cb6d850295229582caa5c5ef82c86 to your computer and use it in GitHub Desktop.
Quickly save an idea/reminder to a Discord channel optionally using a keyboard shortcut.
"""
Ex. You get an idea out of nowhere, click Alt+S, type it in the input popup,
it's sent into your Discord channel so you don't forget it
Use this tool to send a message to a pretermined Discord text channel quickly.
You can remove the autodetect and sound to reduce dependancies
which are: chime and darkdetect (tkinter is built-in)
Set URL to a Discord Webhook link, heres how to get one:
1. Right-click Channel > Edit Channel
2. Integrations > Create Webhook
3. Set Name/Profile Picture (optional)
By itself, this script will show a popup when you launch it.
If you want it to open when you press a shortcut:
0. Install Autohotkey then restart
1. Win+R to open Run dialog, enter shell:startup, press Enter
2. Right-click empty area > New > AutoHotkey script > enter any name > click Edit
3. Add this line to the file:
!s::Run "pythonw D:\Path\To\Your\Stash.py"
4. Save the file, close your text editor, run the file
- `!w` = Alt+W
- `+a` = Shift+A
- `^s` = Ctrl+S
- `;d` = Win+D
"""
url = "https://discord.com/api/webhooks/blablabla"
from tkinter import Tk, simpledialog
# play sound (removable)
from chime import theme, info
theme('material') # sets sound theme
info() # plays sound
# initiate tkinter
root = Tk()
root.withdraw()
root.attributes('-topmost', True)
# dark mode
dark = True
# remove the next two lines if you don't want it to
# autodetect system setting and remove a dependancy
from darkdetect import isDark
dark = isDark()
# popup
if dark: root.tk_setPalette(background='#2b2b2b', foreground='#b1b1b1')
idea = simpledialog.askstring("Stash", "Enter your idea/reminder:", parent=root)
# post to webhook
from requests import post
post(url, json={"content": idea})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment