Skip to main content

Pub bot

Change LED color and play sound by sequence of word.

from time import sleep
import discord
from discord.ext import commands

TOKEN = "MTE4MDg5MjYzNzM5ODU4NTM2NQ.G1ugfV.4y2Q_gNlw535Ly-dYaJpJW4iDedrFc-QaYcj3E"
CHANNEL_ID = "818503283916144692"

client = commands.Bot(command_prefix="!", intents=discord.Intents.all())
color_dict = {
  "R": "red",
  "G": "green",
  "B": "blue"
}

frequency_dict = {
  "R": 10000,
  "G": 15000,
  "B": 20000
}

@client.event
async def on_ready():
    print("Ready to be DJ?")


@client.command()
async def yo(ctx, letters):
    for letter in letters:
        try:
            # call light api
            print(color_dict[letter])
            # call sound api
            print(frequency_dict[letter])
        except:
            print("Failed to call IOT API!")
    await ctx.send("Let's them cook")

# put token here naja
client.run(TOKEN)