(All script titles are hyperlinked to my repositories)
Signal Messenger AI With MQTT
Signal AI is a flexible and customizable chatbot project that leverages MQTT and signal-cli to provide a secure messaging platform for a highly personalized AI assistant. With these scripts, users can tailor the bot’s personality, identity, and behavior to their liking, effectively creating a unique experience with each individual bot instance. The design emphasizes scalability and customization, allowing users to shape the bot into whatever they envision, ensuring that no two bots are identical unless intentionally replicated.
Note: I am unable to add a code-sample of both scripts here so please check out my repository if your interested in the code.
Spotbot
SpotBot is a powerful tool for downloading music from Spotify. Using the SpotDL library, it allows users to batch download albums, songs, and playlists by specifying links in a “SpotList.txt” file. The bot organizes downloaded music into separate folders for easy access. Requirements include Python 3.8+, FFMPEG, SpotDL, and a Spotify subscription. Users can specify the desired bitrate for downloads.
#!/usr/bin/env python3.8
import re
import os
spotify_list = open('/home/USER/Music/SpotList.txt', 'r')
bitrate = str(input('Enter the bitrate you want to download the music at (128k, 256k, 320k): '))
os.chdir('/home/USER/Music')
music = []
for line in spotify_list:
if line.startswith('Album: ') or line.startswith('album: '):
music.append(line[7:-1].rstrip())
continue
elif line.startswith('Playlist: ') or line.startswith('playlist: '):
music.append(line[10:-1].rstrip())
continue
elif line.startswith('Song: ') or line.startswith('song: '):
music.append(line[6:-1].rstrip())
continue
else:
continue
spotify_links = []
with open("/home/USER/Music/SpotList.txt", 'r') as file:
for line in file:
albums = re.findall('https://open.spotify.com/album/.*', line)
playlists = re.findall('https://open.spotify.com/playlist/.*', line)
songs = re.findall('https://open.spotify.com/track/.*', line)
for url in albums:
spotify_links.append(url)
continue
for url in playlists:
spotify_links.append(url)
continue
for url in songs:
spotify_links.append(url)
continue
continue
for i in range(len(music)):
os.mkdir(music[i])
for i in range(len(music)):
os.chdir(music[i])
print('Downloading ' + music[i] + '...' + '\n')
os.system('spotdl ' + spotify_links[i] + ' --bitrate ' + bitrate)
os.chdir('..')
os.system('clear')
spotify_list.close()
MIdGPT
MidGPT automates the generation of /imagine
prompts for the Midjourney Art Generator on Discord using ChatGPT. Built with discord.py
, OpenAI’s GPT models, python-dotenv
, and pyautogui
, it simplifies the process of creating and submitting prompts. After setting up a Discord bot and configuring environment variables for the Discord token and OpenAI API key, users can run the bot to streamline Midjourney art creation directly within their Discord server.
import time
import discord
import openai
from discord.ext import commands
from dotenv import load_dotenv
import pyautogui as pg
# Load environment variables
load_dotenv()
# Fetch tokens from .env
discord_token = os.getenv("DISCORD_TOKEN")
openai_key = os.getenv("OPENAI_API_KEY")
def MidGPT():
"""
Function to get a response from GPT-3 with a specific prompt.
"""
openai.api_key = openai_key
completion = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[
{"role": "user", "content": "give me an /imagine prompt, in this case, /imagine will be used for an AI art generator, imagine something for the ai to generate in 10 words or less with medium detail (note: you can't used inappropriate words, or else the ai will not generate anything)"},
]
)
MidGPT_Response = completion.choices[0].message.content
return MidGPT_Response
client = commands.Bot(command_prefix="*", intents=discord.Intents.all())
# Flag to control the automation
automation = False
@client.event
async def on_ready():
"""
Event triggered when the bot is ready.
"""
print("Bot connected")
@client.event
async def on_message(message):
"""
Event triggered when a message is received.
"""
global automation
msg = message.content
print(message)
# Start Automation by typing "automation" in the discord channel
start_commands = ['automation', 'auto', 'start']
if msg.lower() in start_commands:
automation = True
# Stop Automation by typing "stop" in the discord channel
stop_commands = ['stop', 'end', 'end automation', 'stop automation']
if msg.lower() in stop_commands:
automation = False
if automation:
prompts = str(MidGPT()) # get the AI generated prompt
time.sleep(3)
pg.press('tab')
time.sleep(3)
pg.write('/imagine')
time.sleep(5)
pg.press('tab')
pg.write(prompts)
time.sleep(3)
pg.press('enter')
time.sleep(5)
# Continue Automation as soon Midjourney bot sends a message with attachment.
for attachment in message.attachments:
prompts = str(MidGPT()) # get the AI generated prompt
time.sleep(3)
pg.write('/imagine')
time.sleep(5)
pg.press('tab')
pg.write(prompts)
time.sleep(3)
pg.press('enter')
time.sleep(5)
# Wait for 90 seconds before starting the next job
time.sleep(90)
# Run the bot
client.run(discord_token)