Skip to content

Commit e526ffa

Browse files
authored
Update: v0.7.0
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
2 parents 13c241c + 1713073 commit e526ffa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+2879
-3188
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
uses: Gr1N/setup-poetry@v8
3434
- name: Cache Poetry
3535
id: cache-poetry
36-
uses: actions/cache@v3.3.0
36+
uses: actions/cache@v3.3.1
3737
with:
3838
path: ~/.cache/pypoetry/virtualenvs
3939
key: ${{ runner.os }}-poetry-v3-${{ hashFiles('**/poetry.lock') }}

.github/workflows/docker-build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
password: ${{ secrets.GHCR_PACKAGE_TOKEN }}
5050

5151
- name: Cache Docker layers
52-
uses: actions/cache@v3.3.0
52+
uses: actions/cache@v3.3.1
5353
with:
5454
path: /tmp/.buildx-cache
5555
key: ${{ runner.os }}-buildx-debian-ghcr-${{ github.sha }}
@@ -108,7 +108,7 @@ jobs:
108108
password: ${{ secrets.DOCKER_TOKEN }}
109109

110110
- name: Cache Docker layers
111-
uses: actions/cache@v3.3.0
111+
uses: actions/cache@v3.3.1
112112
with:
113113
path: /tmp/.buildx-cache
114114
key: ${{ runner.os }}-buildx-debian-hub-${{ github.sha }}

.github/workflows/lint.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Lint
2+
on:
3+
push:
4+
branches:
5+
- dev
6+
7+
pull_request:
8+
branches:
9+
- dev
10+
11+
env:
12+
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres
13+
14+
jobs:
15+
Analyze:
16+
runs-on: ubuntu-latest
17+
18+
services:
19+
postgres:
20+
image: postgres:15
21+
env:
22+
POSTGRES_USER: postgres
23+
POSTGRES_PASSWORD: postgres
24+
POSTGRES_DB: postgres
25+
ports:
26+
- 5432:5432
27+
options: >-
28+
--health-cmd pg_isready
29+
--health-interval 10s
30+
--health-timeout 5s
31+
--health-retries 5
32+
33+
steps:
34+
- name: Checkout Repository
35+
uses: actions/checkout@v3
36+
37+
- name: Set up Python 3.11
38+
id: setup-python
39+
uses: actions/setup-python@v4.5.0
40+
with:
41+
python-version: '3.11'
42+
43+
- name: Set up Poetry
44+
uses: Gr1N/setup-poetry@v8
45+
46+
- name: Cache Poetry
47+
id: cache-poetry
48+
uses: actions/cache@v3.3.1
49+
with:
50+
path: ~/.cache/pypoetry/virtualenvs
51+
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
52+
53+
- name: Install Poetry Dependencies
54+
if: steps.cache-poetry.outputs.cache-hit != 'true'
55+
run: |
56+
poetry install --with dev
57+
58+
- name: Generate Prisma Client
59+
run: |
60+
poetry run prisma db push
61+
62+
- name: Run Pyright
63+
run: |
64+
poetry run pyright Bot

.github/workflows/snyk.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
uses: Gr1N/setup-poetry@v8
2929
- name: Cache Poetry
3030
id: cache-poetry
31-
uses: actions/cache@v3.3.0
31+
uses: actions/cache@v3.3.1
3232
with:
3333
path: ~/.cache/pypoetry/virtualenvs
3434
key: ${{ runner.os }}-poetry-v2-${{ hashFiles('**/poetry.lock') }}

.github/workflows/tests.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ on:
1111

1212
env:
1313
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres
14+
REDIS_HOST: localhost
15+
REDIS_PORT: 6379
16+
REDIS_PASSWORD: kumiko
1417

1518

1619
jobs:
@@ -20,7 +23,7 @@ jobs:
2023

2124
services:
2225
redis:
23-
image: redis/redis-stack-server:7.0.6-RC6
26+
image: redis/redis-stack-server:7.0.6-RC8
2427
ports:
2528
- 6379:6379
2629

@@ -75,4 +78,4 @@ jobs:
7578
- name: Upload coverage to Codecov
7679
uses: codecov/codecov-action@v3
7780
with:
78-
files: ./coverage.xml
81+
files: ./coverage.xml

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,5 @@ image-testspy
7979
.vagrant
8080
migrations
8181
.env-old
82-
database.db
82+
database.db
83+
json-tests

.pre-commit-config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ repos:
88
rev: 1.7.4
99
hooks:
1010
- id: bandit
11+
args: ["-c", "pyproject.toml"]
1112
name: Bandit
1213
stages: [commit]
14+
additional_dependencies: ["bandit[toml]"]
1315

1416

1517
# - repo: https://github.com/pre-commit/mirrors-autopep8

.python-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.11.2
1+
3.11.2

Bot/Cogs/actions.py

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
import aiohttp
2+
import discord
3+
import orjson
4+
from discord import app_commands
5+
from discord.ext import commands
6+
from Libs.utils import Embed
7+
8+
9+
class Actions(commands.Cog):
10+
"""Hug, pet, or kiss someone on Discord!"""
11+
12+
def __init__(self, bot: commands.Bot) -> None:
13+
self.bot = bot
14+
15+
@commands.hybrid_command(name="hug")
16+
@app_commands.describe(user="The user to hug")
17+
async def hug(self, ctx: commands.Context, user: discord.Member) -> None:
18+
"""Hug someone on Discord!"""
19+
async with aiohttp.ClientSession() as session:
20+
async with session.get("https://nekos.life/api/v2/img/hug") as r:
21+
data = await r.json(loads=orjson.loads)
22+
embed = Embed(title=f"{ctx.author.name} hugs {user.name}!")
23+
embed.set_image(url=data["url"])
24+
await ctx.send(embed=embed)
25+
26+
@commands.hybrid_command(name="pat")
27+
@app_commands.describe(user="The user to pat")
28+
async def pat(self, ctx: commands.Context, user: discord.Member) -> None:
29+
"""Give someone a headpat!"""
30+
async with aiohttp.ClientSession() as session:
31+
async with session.get("https://nekos.life/api/v2/img/pat") as r:
32+
data = await r.json(loads=orjson.loads)
33+
embed = Embed(title=f"{ctx.author.name} pats {user.name}!")
34+
embed.set_image(url=data["url"])
35+
await ctx.send(embed=embed)
36+
37+
@commands.hybrid_command(name="kiss")
38+
@app_commands.describe(user="The user to kiss")
39+
async def kiss(self, ctx: commands.Context, user: discord.Member) -> None:
40+
"""Give someone a kiss!"""
41+
async with aiohttp.ClientSession() as session:
42+
async with session.get("https://nekos.life/api/v2/img/kiss") as r:
43+
data = await r.json(loads=orjson.loads)
44+
embed = Embed(title=f"{ctx.author.name} kisses {user.name}!")
45+
embed.set_image(url=data["url"])
46+
await ctx.send(embed=embed)
47+
48+
@commands.hybrid_command(name="cuddle")
49+
@app_commands.describe(user="The user to cuddle")
50+
async def cuddle(self, ctx: commands.Context, user: discord.Member) -> None:
51+
"""Cuddle someone on Discord!"""
52+
async with aiohttp.ClientSession() as session:
53+
async with session.get("https://nekos.life/api/v2/img/cuddle") as r:
54+
data = await r.json(loads=orjson.loads)
55+
embed = Embed(title=f"{ctx.author.name} cuddles {user.name}!")
56+
embed.set_image(url=data["url"])
57+
await ctx.send(embed=embed)
58+
59+
@commands.hybrid_command(name="slap")
60+
@app_commands.describe(user="The user to slap")
61+
async def slap(self, ctx: commands.Context, user: discord.Member) -> None:
62+
"""Slaps someone on Discord!"""
63+
async with aiohttp.ClientSession() as session:
64+
async with session.get("https://nekos.life/api/v2/img/slap") as r:
65+
data = await r.json(loads=orjson.loads)
66+
embed = Embed(title=f"{ctx.author.name} slaps {user.name}!")
67+
embed.set_image(url=data["url"])
68+
await ctx.send(embed=embed)
69+
70+
@commands.hybrid_command(name="tickle")
71+
@app_commands.describe(user="The user to tickle")
72+
async def tickles(self, ctx: commands.Context, user: discord.Member) -> None:
73+
"""Tickle someone on Discord!"""
74+
async with aiohttp.ClientSession() as session:
75+
async with session.get("https://nekos.life/api/v2/img/tickle") as r:
76+
data = await r.json(loads=orjson.loads)
77+
embed = Embed(title=f"{ctx.author.name} tickles {user.name}!")
78+
embed.set_image(url=data["url"])
79+
await ctx.send(embed=embed)
80+
81+
@commands.hybrid_command(name="poke")
82+
@app_commands.describe(user="The user to poke")
83+
async def poke(self, ctx: commands.Context, user: discord.Member) -> None:
84+
"""Poke someone on Discord!"""
85+
async with aiohttp.ClientSession() as session:
86+
async with session.get("https://nekos.life/api/v2/img/poke") as r:
87+
data = await r.json(loads=orjson.loads)
88+
embed = Embed(title=f"{ctx.author.name} pokes {user.name}!")
89+
embed.set_image(url=data["url"])
90+
await ctx.send(embed=embed)
91+
92+
93+
async def setup(bot: commands.Bot) -> None:
94+
await bot.add_cog(Actions(bot))

Bot/Cogs/admin.py

Lines changed: 0 additions & 125 deletions
This file was deleted.

0 commit comments

Comments
 (0)