Skip to content

Commit

Permalink
convert from firebase to supabase
Browse files Browse the repository at this point in the history
  • Loading branch information
CNDRD committed Apr 1, 2023
1 parent bd46597 commit e89566d
Show file tree
Hide file tree
Showing 36 changed files with 216 additions and 1,912 deletions.
1 change: 0 additions & 1 deletion Procfile

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<a href="https://diskito.eu/discord">
<img src="https://img.shields.io/discord/402356550133350411?label=discord&style=for-the-badge&logo=discord&color=5865F2&logoColor=white" />
</a>
<img src="https://img.shields.io/github/deployments/CNDRD/Bruce/bruce-discord?label=Deployment&logo=heroku&style=for-the-badge&color=5865F2&logoColor=white" />
<img src="https://img.shields.io/static/v1?style=for-the-badge&message=Supabase&color=3ECF8E&logo=Supabase&logoColor=3ECF8E&label=Powered%20By" />
<br />
<img src="https://img.shields.io/badge/python-3.10-blue.svg?logo=python&style=for-the-badge&logoColor=white&color=yellow" />
<img src="https://img.shields.io/github/repo-size/CNDRD/bruce?style=for-the-badge&logoColor=white&color=yellow" />
Expand Down
46 changes: 23 additions & 23 deletions bot.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
import disnake
from disnake.ext import commands
import yaml
import os
from dotenv import load_dotenv
load_dotenv()


config = yaml.safe_load(open('config.yml'))
prefix = str(config.get('prefix'))
slash_guilds = config.get('slash_guilds')
token = os.getenv('TOKEN')


client = commands.Bot(
intents=disnake.Intents.all(),
reload=True,
# command_prefix=prefix,
# test_guilds=slash_guilds
)

import disnake
import os

for filename in os.listdir('./cogs'):
if filename.endswith('.py'):
client.load_extension(f'cogs.{filename[:-3]}')
load_dotenv()
client = commands.Bot(intents=disnake.Intents.all(), reload=True)

cogs = [
'in_n_out',
'on_message',
'on_raw_reaction',
'on_user_update',
'on_voice_state_update',
'message_commands',
'quote',
'status',
'cicina',
'user',
'admin',
]

for filename in cogs:
client.load_extension(f'cogs.{filename}')


@client.event
async def on_ready():
print(f"\nHere comes {client.user.name}!")

client.run(token)

client.run(os.getenv('TOKEN'))
53 changes: 3 additions & 50 deletions cogs/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,63 +2,16 @@
from disnake.ext.commands import Param
from disnake.ext import commands

from PIL import Image
import colorsys
import requests
import math
import yaml
import io

import os
from dotenv import load_dotenv
load_dotenv()
LED_URL = os.getenv("LED_URL")

# Config Load
config = yaml.safe_load(open('config.yml'))
slash_guilds = config.get('slash_guilds')
server_id = config.get('server_id')
owner_role_id = config.get('owner_role_id')
bot_mod_role_id = config.get('bot_mod_role_id')
mod_role_id = config.get('mod_role_id')
yeetard_role_id = config.get('yeetard_role_id')
leds_role_id = config.get('leds_role_id')
leds_alert_channel_id = config.get('leds_alert_channel_id')
bot_mod_role_id = 553150973581721600
mod_role_id = 475345534723555339
yeetard_role_id = 488342364570779650


class Admin(commands.Cog):
def __init__(self, client):
"""Admin commands."""
self.client = client

@commands.has_role(leds_role_id)
@commands.slash_command(name="leds", description="Controls the LEDs I have behind my desk")
async def leds(
self,
inter: disnake.ApplicationCommandInteraction,
hue: int = Param(0, desc="Hue", min_value=0, max_value=360),
saturation: int = Param(0, desc="Saturation", min_value=0, max_value=100),
value: int = Param(0, desc="Value", min_value=0, max_value=100)
):
requests.post(f"{LED_URL}/{int(hue)}/{int(saturation*10)}/{int(value*10)}")

r, g, b = colorsys.hsv_to_rgb(hue / 360, saturation / 100, value / 100)
r, g, b = math.ceil(r * 255), math.ceil(g * 255), math.ceil(b * 255)

with io.BytesIO() as image_binary:
image = Image.new(mode="RGB", size=(200, 100), color=(r, g, b))
image.save(image_binary, "PNG")
image_binary.seek(0)

await inter.response.send_message(
f"Set the LED's to this 👇 color `hsv({hue}, {saturation}, {value})` or `rgb({r}, {g}, {b})`",
file=disnake.File(fp=image_binary, filename="color.png"),
ephemeral=True
)
await self.client.get_channel(leds_alert_channel_id).send(
f"**{inter.author.name}** set the LED's to `hsv({hue}, {saturation}, {value})` or `rgb({r}, {g}, {b})`"
)

@commands.has_role(mod_role_id)
@commands.has_role(bot_mod_role_id)
@commands.slash_command(name="clear", description="Clears amount of messages. Default is 1")
Expand Down
120 changes: 0 additions & 120 deletions cogs/blackjack.py

This file was deleted.

Loading

0 comments on commit e89566d

Please sign in to comment.