the family sending a picture and maybe a text to a specific e-mailadress to display it on a rapsi powered frame.
To make the experience fit your profile, pick a username and tell us what interests you.
We found and based on your interests.
Create an account to leave a comment. Already have an account? Log In.
something like this should display the pics marked with @gram:
import discord
import os
import requests
from PIL import Image
from io import BytesIO
TOKEN = 'YOUR_DISCORD_BOT_TOKEN'
GUILD = 'YOUR_GUILD_NAME'
CHANNEL = 'YOUR_CHANNEL_NAME'
IMAGE_DIR = '/path/to/save/images/'
client = discord.Client()
async def download_and_save_image(url, filename):
try:
response = requests.get(url)
img = Image.open(BytesIO(response.content))
img.save(os.path.join(IMAGE_DIR, filename))
os.system('feh --bg-center ' + os.path.join(IMAGE_DIR, filename))
except Exception as e:
print('Could not download or save image due to:', e)
@client.event
async def on_message(message):
if message.author == client.user:
return
if '@gram' in message.content:
if len(message.attachments) > 0:
for attachment in message.attachments:
await download_and_save_image(attachment.url, attachment.filename)
@client.event
async def on_ready():
for guild in client.guilds:
if guild.name == GUILD:
break
print(
f'{client.user} is connected to the following guild:\n'
f'{guild.name}(id:
{guild.id})'
)
client.run(TOKEN)
Become a member to follow this project and never miss any updates
About Us Contact Hackaday.io Give Feedback Terms of Use Privacy Policy Hackaday API Do not sell or share my personal information
Something like this but linked to our family Discord would be fantastic for my mom! We share pix all the time, but Gram gets left out because -- well, Discord and 81-year-olds don't mix. Looking forward to more.