k
38
.gitignore
vendored
|
@ -1,9 +1,31 @@
|
|||
config.ini
|
||||
.idea/
|
||||
.vscode/
|
||||
__pycache__
|
||||
*.egg-info/
|
||||
.pytest_cache/
|
||||
# Royalnet ignores
|
||||
config*.toml
|
||||
downloads/
|
||||
|
||||
|
||||
# Python ignores
|
||||
**/__pycache__/
|
||||
dist/
|
||||
build/
|
||||
venv/
|
||||
*.egg-info/
|
||||
**/*.pyc
|
||||
|
||||
# PyCharm ignores
|
||||
.idea/**/workspace.xml
|
||||
.idea/**/tasks.xml
|
||||
.idea/**/usage.statistics.xml
|
||||
.idea/**/dictionaries
|
||||
.idea/**/shelf
|
||||
.idea/**/contentModel.xml
|
||||
.idea/**/dataSources/
|
||||
.idea/**/dataSources.ids
|
||||
.idea/**/dataSources.local.xml
|
||||
.idea/**/sqlDataSources.xml
|
||||
.idea/**/dynamic.xml
|
||||
.idea/**/uiDesigner.xml
|
||||
.idea/**/dbnavigator.xml
|
||||
.idea/**/gradle.xml
|
||||
.idea/**/libraries
|
||||
.idea/**/markdown-navigator.xml
|
||||
.idea/**/markdown-exported-files.xml
|
||||
.idea/**/misc.xml
|
||||
.idea/**/*.iml
|
22
README.md
|
@ -1,5 +1,21 @@
|
|||
# `{packname}` [![PyPI](https://img.shields.io/pypi/v/{packname}.svg)](https://pypi.org/project/{packname}/)
|
||||
# `keipack` [![PyPI](https://img.shields.io/pypi/v/keipack.svg)](https://pypi.org/project/keipack/)
|
||||
|
||||
{Replace everything surrounded by braces with your own data, including this description!}
|
||||
## Emotions
|
||||
|
||||
{Files to be changed are the package folder, setup.py, to_pypi.sh and this README!}
|
||||
- ![](./media/cat.png) cat
|
||||
- ![](./media/cry.png) cry
|
||||
- ![](./media/disappointed.png) disappointed
|
||||
- ![](./media/dootflute.png) dootflute
|
||||
- ![](./media/doottrumpet.png) doottrumpet
|
||||
- ![](./media/grin.png) grin
|
||||
- ![](./media/halflife.png) halflife
|
||||
- ![](./media/happy.png) happy
|
||||
- ![](./media/key.png) key
|
||||
- ![](./media/keyface.png) keyface
|
||||
- ![](./media/neutral.png) neutral
|
||||
- ![](./media/question.png) question
|
||||
- ![](./media/smug.png) smug
|
||||
- ![](./media/surprised.png) surprised
|
||||
- ![](./media/wink.png) wink
|
||||
- ![](./media/worried.png) worried
|
||||
- ![](./media/x.png) x
|
|
@ -1,18 +1,26 @@
|
|||
import random
|
||||
import datetime
|
||||
from typing import *
|
||||
from starlette.requests import Request
|
||||
from starlette.responses import *
|
||||
from royalnet.web import *
|
||||
from royalnet.constellation import *
|
||||
from royalnet.utils import *
|
||||
import royalnet.packs.common.tables as cpt
|
||||
import royalpack.tables as rpt
|
||||
|
||||
|
||||
class ApiKei(PageStar):
|
||||
path = "/api/kei"
|
||||
|
||||
tables = {}
|
||||
|
||||
async def _generate(self, request: Request, session) -> typing.Tuple[str, str]:
|
||||
return "happy", "Ciao!"
|
||||
async def _generate(self, request, session) -> Tuple[str, str]:
|
||||
if request.query_params.get("first", "false") == "true":
|
||||
return random.sample([
|
||||
("happy", "Ciao!"),
|
||||
("question", "Come va?"),
|
||||
("happy", "Sono al tuo servizio!"),
|
||||
("happy", "Attendo ordini!"),
|
||||
("happy", "Attendo ordini!"),
|
||||
("cat", "Mandami un messaggio :3"),
|
||||
], 1)[0]
|
||||
return "x", "MISSINGNO."
|
||||
|
||||
async def page(self, request: Request) -> JSONResponse:
|
||||
async with self.session_acm() as session:
|
||||
|
|
19
keipack/tables/keipeople.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship
|
||||
from sqlalchemy.ext.declarative import declared_attr
|
||||
|
||||
|
||||
class KeiPerson:
|
||||
__tablename__ = "keipeople"
|
||||
|
||||
@declared_attr
|
||||
def user_id(self):
|
||||
return Column(Integer, ForeignKey("users.uid"), primary_key=True)
|
||||
|
||||
@declared_attr
|
||||
def user(self):
|
||||
return relationship("User", foreign_keys=self.user_id, backref="kei_people")
|
||||
|
||||
@declared_attr
|
||||
def game_id(self):
|
||||
return Column(String, unique=True, primary_key=True)
|
BIN
media/cat.png
Normal file
After Width: | Height: | Size: 657 B |
BIN
media/cry.png
Normal file
After Width: | Height: | Size: 648 B |
BIN
media/disappointed.png
Normal file
After Width: | Height: | Size: 627 B |
BIN
media/dootflute.png
Normal file
After Width: | Height: | Size: 665 B |
BIN
media/doottrumpet.png
Normal file
After Width: | Height: | Size: 671 B |
BIN
media/grin.png
Normal file
After Width: | Height: | Size: 658 B |
BIN
media/halflife.png
Normal file
After Width: | Height: | Size: 648 B |
BIN
media/happy.png
Normal file
After Width: | Height: | Size: 661 B |
BIN
media/key.png
Normal file
After Width: | Height: | Size: 654 B |
BIN
media/keyface.png
Normal file
After Width: | Height: | Size: 648 B |
BIN
media/neutral.png
Normal file
After Width: | Height: | Size: 651 B |
BIN
media/question.png
Normal file
After Width: | Height: | Size: 663 B |
BIN
media/smug.png
Normal file
After Width: | Height: | Size: 643 B |
BIN
media/surprised.png
Normal file
After Width: | Height: | Size: 648 B |
BIN
media/wink.png
Normal file
After Width: | Height: | Size: 657 B |
BIN
media/worried.png
Normal file
After Width: | Height: | Size: 661 B |
BIN
media/x.png
Normal file
After Width: | Height: | Size: 668 B |
51
pyproject.toml
Normal file
|
@ -0,0 +1,51 @@
|
|||
# Remember to run `poetry update` after you edit this file!
|
||||
|
||||
[tool.poetry]
|
||||
name = "keipack"
|
||||
version = "5.1a1"
|
||||
description = "A mysterious AI assistant"
|
||||
authors = ["Stefano Pigozzi <ste.pigozzi@gmail.com>"]
|
||||
license = "AGPL-3.0+"
|
||||
readme = "README.md"
|
||||
homepage = "https://github.com/Steffo99/keipack"
|
||||
classifiers = [
|
||||
"Development Status :: 3 - Alpha",
|
||||
"Operating System :: OS Independent",
|
||||
"Programming Language :: Python :: 3.8",
|
||||
"License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)"
|
||||
]
|
||||
|
||||
# Library dependencies
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.8"
|
||||
|
||||
riotwatcher = "^2.7.1"
|
||||
|
||||
[tool.poetry.dependencies.royalnet]
|
||||
git = "https://github.com/Steffo99/royalnet/"
|
||||
# Maybe... there is a way to make these selectable?
|
||||
extras = [
|
||||
"telegram",
|
||||
"discord",
|
||||
"alchemy_easy",
|
||||
"bard",
|
||||
"constellation",
|
||||
"sentry",
|
||||
"herald",
|
||||
"coloredlogs"
|
||||
]
|
||||
|
||||
# Development dependencies
|
||||
[tool.poetry.dev-dependencies]
|
||||
|
||||
|
||||
|
||||
# Optional dependencies
|
||||
[tool.poetry.extras]
|
||||
|
||||
|
||||
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry>=0.12"]
|
||||
build-backend = "poetry.masonry.api"
|
|
@ -1,3 +0,0 @@
|
|||
starlette
|
||||
royalnet
|
||||
royalpack
|
112
sample_config.toml
Normal file
|
@ -0,0 +1,112 @@
|
|||
# ROYALNET CONFIGURATION FILE
|
||||
|
||||
[Herald]
|
||||
# Enable the herald module, allowing different parts of Royalnet to talk to each other
|
||||
# Requires the `herald` extra to be installed
|
||||
enabled = true
|
||||
|
||||
[Herald.Local]
|
||||
# Run locally a Herald web server (websocket) that other parts of Royalnet can connect to
|
||||
enabled = true
|
||||
# The address of the network interface on which the Herald server should listen for connections
|
||||
# If 0.0.0.0, listen for connections on all interfaces
|
||||
# If 127.0.0.1, listen only for connections coming from the local machine
|
||||
address = "0.0.0.0"
|
||||
# The port on which the Herald server should run
|
||||
port = 44444
|
||||
# A password required to connect to the local Herald server
|
||||
secret = "CHANGE-ME"
|
||||
# Use HTTPS instead of HTTP for Herald connections
|
||||
secure = false # Not supported yet!
|
||||
# Use a different HTTP path for Herald connections
|
||||
path = "/" # Different values aren't supported yet
|
||||
|
||||
[Herald.Remote]
|
||||
# Connect to a remote Herald web server (websocket)
|
||||
# Requires the `herald` extra to be installed
|
||||
enabled = false
|
||||
# The address of the remote Herald server
|
||||
address = "0.0.0.0"
|
||||
# The port of the remote Herald server
|
||||
port = 44444
|
||||
# The password required to connect to the remote Herald server
|
||||
secret = "CHANGE-ME"
|
||||
# Use HTTPS instead of HTTP for Herald connections
|
||||
secure = false # Not supported yet!
|
||||
# Use a different HTTP path for Herald connections
|
||||
path = "/" # Different values aren't supported yet
|
||||
|
||||
|
||||
[Alchemy]
|
||||
# Use the Alchemy module of Royalnet to connect to a PostgreSQL server
|
||||
# Requires either the `alchemy_easy` or the `alchemy_hard` extras to be installed
|
||||
enabled = true
|
||||
# The URL of the database you want to connect to, in sqlalchemy format:
|
||||
# https://docs.sqlalchemy.org/en/13/core/engines.html#database-urls
|
||||
database_url = "postgresql://username:password@host:port/database"
|
||||
|
||||
[Constellation]
|
||||
# Run locally a Constellation web server (uvicorn+starlette) serving the Stars contained in the enabled Packs
|
||||
# Requires the `constellation` extra to be installed
|
||||
enabled = true
|
||||
# The address of the network interface on which the Constellation should listen for requests
|
||||
# If 0.0.0.0, listen for requests on all interfaces
|
||||
# If 127.0.0.1, listen only for requests coming from the local machine
|
||||
address = "0.0.0.0"
|
||||
# The port on which the Constellation should run
|
||||
port = 44445
|
||||
|
||||
[Serfs]
|
||||
|
||||
[Serfs.Telegram]
|
||||
# Use the Telegram Serf (python-telegram-bot) included in Royalnet
|
||||
# Requires the `telegram` extra to be installed
|
||||
enabled = true
|
||||
# The Bot API Token of the bot you want to use for Royalnet
|
||||
# Obtain one at https://t.me/BotFather
|
||||
token = "0000000000:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
|
||||
# The size of the Connection Pool used by python-telegram-bot
|
||||
# 8 should be fine, but if you start getting `TimeoutError: QueuePool limit of size X overflow Y reached" errors,
|
||||
# increasing this number should fix them
|
||||
pool_size = 8
|
||||
# The maximum amount of time to wait for a response from Telegram before raising a `TimeoutError`
|
||||
# It also is the time that python-telegram-bot will wait before sending a new request if no updates are being received.
|
||||
read_timeout = 60
|
||||
|
||||
[Serfs.Discord]
|
||||
# Use the Discord Serf (discord.py) included in Royalnet
|
||||
# Requires the `discord` extra to be installed
|
||||
enabled = true
|
||||
# The Discord Bot Token of the bot you want to use for Royalnet
|
||||
# Obtain one at https://discordapp.com/developers/applications/ > Bot > Token
|
||||
token = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
|
||||
|
||||
[Logging]
|
||||
# Print to stderr all logging events of an equal or greater level than this
|
||||
# Possible values are "DEBUG", "INFO", "WARNING", "ERROR", "FATAL"
|
||||
log_level = "INFO"
|
||||
# Optional: install the `coloredlogs` extra for colored output!
|
||||
|
||||
[Sentry]
|
||||
# Connect Royalnet to a https://sentry.io/ project for error logging
|
||||
# Requires the `sentry` extra to be installed
|
||||
enabled = false
|
||||
# Get one at https://sentry.io/settings/YOUR-ORG/projects/YOUR-PROJECT/keys/
|
||||
dsn = "https://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@sentry.io/1111111"
|
||||
|
||||
[Packs]
|
||||
# The Python package name of the Packs you want to be usable in Royalnet
|
||||
# Please note that the `royalnet.backpack` Pack should always be available!
|
||||
active = [
|
||||
"royalnet.backpack", # DO NOT REMOVE THIS OR THINGS WILL BREAK
|
||||
# "yourpack",
|
||||
|
||||
]
|
||||
|
||||
# Configuration settings for specific packs
|
||||
[Packs."royalnet.backpack"]
|
||||
# Enable exception debug commands and stars
|
||||
exc_debug = false
|
||||
|
||||
# Add your packs config here!
|
||||
# [Packs."yourpack"]
|
24
setup.py
|
@ -1,24 +0,0 @@
|
|||
import setuptools
|
||||
|
||||
with open("README.md", "r") as f:
|
||||
long_description = f.read()
|
||||
|
||||
with open("requirements.txt", "r") as f:
|
||||
install_requires = f.readlines()
|
||||
|
||||
setuptools.setup(
|
||||
name="keipack",
|
||||
version="0.1",
|
||||
author="Stefano Pigozzi",
|
||||
author_email="ste.pigozzi@gmail.com",
|
||||
description="A mysterious AI assistant",
|
||||
long_description=long_description,
|
||||
long_description_content_type="text/markdown",
|
||||
url="https://github.com/Steffo99/keipack",
|
||||
packages=setuptools.find_packages(),
|
||||
install_requires=install_requires,
|
||||
python_requires=">=3.7",
|
||||
classifiers=[
|
||||
"Programming Language :: Python :: 3.7",
|
||||
],
|
||||
)
|
|
@ -1,3 +0,0 @@
|
|||
del /f /q /s dist\*.*
|
||||
python setup.py sdist bdist_wheel
|
||||
twine upload dist/*
|
15
to_pypi.sh
|
@ -1,15 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Set me to your pack name!
|
||||
PACKNAME="{packname}"
|
||||
|
||||
# Royalnet must be installed with `develop`
|
||||
VERSION=$(python3.7 -m "$PACKNAME.version")
|
||||
|
||||
rm -rf dist
|
||||
python setup.py sdist bdist_wheel
|
||||
twine upload "dist/$PACKNAME-$VERSION"*
|
||||
git add *
|
||||
git commit -m "$VERSION"
|
||||
git push
|
||||
hub release create --message "Version $VERSION" --prerelease "$VERSION"
|