Skip to content

Commit

Permalink
Update: v0.7.0
Browse files Browse the repository at this point in the history
This update of Kumiko sets the foundation for v0.8.x. Kumiko now uses Discord.py instead of Pycord due to the direction that Pycord v2 is headed as of now. For more information, please check out the changelog. - Noelle
  • Loading branch information
No767 authored Mar 30, 2023
2 parents 13c241c + 1713073 commit e526ffa
Show file tree
Hide file tree
Showing 78 changed files with 2,879 additions and 3,188 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
uses: Gr1N/setup-poetry@v8
- name: Cache Poetry
id: cache-poetry
uses: actions/[email protected].0
uses: actions/[email protected].1
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-v3-${{ hashFiles('**/poetry.lock') }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
password: ${{ secrets.GHCR_PACKAGE_TOKEN }}

- name: Cache Docker layers
uses: actions/[email protected].0
uses: actions/[email protected].1
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-debian-ghcr-${{ github.sha }}
Expand Down Expand Up @@ -108,7 +108,7 @@ jobs:
password: ${{ secrets.DOCKER_TOKEN }}

- name: Cache Docker layers
uses: actions/[email protected].0
uses: actions/[email protected].1
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-debian-hub-${{ github.sha }}
Expand Down
64 changes: 64 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Lint
on:
push:
branches:
- dev

pull_request:
branches:
- dev

env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres

jobs:
Analyze:
runs-on: ubuntu-latest

services:
postgres:
image: postgres:15
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Set up Python 3.11
id: setup-python
uses: actions/[email protected]
with:
python-version: '3.11'

- name: Set up Poetry
uses: Gr1N/setup-poetry@v8

- name: Cache Poetry
id: cache-poetry
uses: actions/[email protected]
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}

- name: Install Poetry Dependencies
if: steps.cache-poetry.outputs.cache-hit != 'true'
run: |
poetry install --with dev
- name: Generate Prisma Client
run: |
poetry run prisma db push
- name: Run Pyright
run: |
poetry run pyright Bot
2 changes: 1 addition & 1 deletion .github/workflows/snyk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
uses: Gr1N/setup-poetry@v8
- name: Cache Poetry
id: cache-poetry
uses: actions/[email protected].0
uses: actions/[email protected].1
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-v2-${{ hashFiles('**/poetry.lock') }}
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ on:

env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres
REDIS_HOST: localhost
REDIS_PORT: 6379
REDIS_PASSWORD: kumiko


jobs:
Expand All @@ -20,7 +23,7 @@ jobs:

services:
redis:
image: redis/redis-stack-server:7.0.6-RC6
image: redis/redis-stack-server:7.0.6-RC8
ports:
- 6379:6379

Expand Down Expand Up @@ -75,4 +78,4 @@ jobs:
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml
files: ./coverage.xml
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,5 @@ image-testspy
.vagrant
migrations
.env-old
database.db
database.db
json-tests
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ repos:
rev: 1.7.4
hooks:
- id: bandit
args: ["-c", "pyproject.toml"]
name: Bandit
stages: [commit]
additional_dependencies: ["bandit[toml]"]


# - repo: https://github.com/pre-commit/mirrors-autopep8
Expand Down
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.11.2
3.11.2
94 changes: 94 additions & 0 deletions Bot/Cogs/actions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import aiohttp
import discord
import orjson
from discord import app_commands
from discord.ext import commands
from Libs.utils import Embed


class Actions(commands.Cog):
"""Hug, pet, or kiss someone on Discord!"""

def __init__(self, bot: commands.Bot) -> None:
self.bot = bot

@commands.hybrid_command(name="hug")
@app_commands.describe(user="The user to hug")
async def hug(self, ctx: commands.Context, user: discord.Member) -> None:
"""Hug someone on Discord!"""
async with aiohttp.ClientSession() as session:
async with session.get("https://nekos.life/api/v2/img/hug") as r:
data = await r.json(loads=orjson.loads)
embed = Embed(title=f"{ctx.author.name} hugs {user.name}!")
embed.set_image(url=data["url"])
await ctx.send(embed=embed)

@commands.hybrid_command(name="pat")
@app_commands.describe(user="The user to pat")
async def pat(self, ctx: commands.Context, user: discord.Member) -> None:
"""Give someone a headpat!"""
async with aiohttp.ClientSession() as session:
async with session.get("https://nekos.life/api/v2/img/pat") as r:
data = await r.json(loads=orjson.loads)
embed = Embed(title=f"{ctx.author.name} pats {user.name}!")
embed.set_image(url=data["url"])
await ctx.send(embed=embed)

@commands.hybrid_command(name="kiss")
@app_commands.describe(user="The user to kiss")
async def kiss(self, ctx: commands.Context, user: discord.Member) -> None:
"""Give someone a kiss!"""
async with aiohttp.ClientSession() as session:
async with session.get("https://nekos.life/api/v2/img/kiss") as r:
data = await r.json(loads=orjson.loads)
embed = Embed(title=f"{ctx.author.name} kisses {user.name}!")
embed.set_image(url=data["url"])
await ctx.send(embed=embed)

@commands.hybrid_command(name="cuddle")
@app_commands.describe(user="The user to cuddle")
async def cuddle(self, ctx: commands.Context, user: discord.Member) -> None:
"""Cuddle someone on Discord!"""
async with aiohttp.ClientSession() as session:
async with session.get("https://nekos.life/api/v2/img/cuddle") as r:
data = await r.json(loads=orjson.loads)
embed = Embed(title=f"{ctx.author.name} cuddles {user.name}!")
embed.set_image(url=data["url"])
await ctx.send(embed=embed)

@commands.hybrid_command(name="slap")
@app_commands.describe(user="The user to slap")
async def slap(self, ctx: commands.Context, user: discord.Member) -> None:
"""Slaps someone on Discord!"""
async with aiohttp.ClientSession() as session:
async with session.get("https://nekos.life/api/v2/img/slap") as r:
data = await r.json(loads=orjson.loads)
embed = Embed(title=f"{ctx.author.name} slaps {user.name}!")
embed.set_image(url=data["url"])
await ctx.send(embed=embed)

@commands.hybrid_command(name="tickle")
@app_commands.describe(user="The user to tickle")
async def tickles(self, ctx: commands.Context, user: discord.Member) -> None:
"""Tickle someone on Discord!"""
async with aiohttp.ClientSession() as session:
async with session.get("https://nekos.life/api/v2/img/tickle") as r:
data = await r.json(loads=orjson.loads)
embed = Embed(title=f"{ctx.author.name} tickles {user.name}!")
embed.set_image(url=data["url"])
await ctx.send(embed=embed)

@commands.hybrid_command(name="poke")
@app_commands.describe(user="The user to poke")
async def poke(self, ctx: commands.Context, user: discord.Member) -> None:
"""Poke someone on Discord!"""
async with aiohttp.ClientSession() as session:
async with session.get("https://nekos.life/api/v2/img/poke") as r:
data = await r.json(loads=orjson.loads)
embed = Embed(title=f"{ctx.author.name} pokes {user.name}!")
embed.set_image(url=data["url"])
await ctx.send(embed=embed)


async def setup(bot: commands.Bot) -> None:
await bot.add_cog(Actions(bot))
125 changes: 0 additions & 125 deletions Bot/Cogs/admin.py

This file was deleted.

Loading

0 comments on commit e526ffa

Please sign in to comment.