Compare commits
No commits in common. "bb5065d523ece6ee5a05c8d1163de82b856d2aa7" and "640c68a81aaa3075e53ad39cc2490fe214f77f31" have entirely different histories.
bb5065d523
...
640c68a81a
7 changed files with 75 additions and 308 deletions
186
.gitignore
vendored
186
.gitignore
vendored
|
@ -1,185 +1,3 @@
|
||||||
# Byte-compiled / optimized / DLL files
|
/venv/*
|
||||||
__pycache__/
|
|
||||||
*.py[cod]
|
|
||||||
*$py.class
|
|
||||||
|
|
||||||
# C extensions
|
|
||||||
*.so
|
|
||||||
|
|
||||||
# Distribution / packaging
|
|
||||||
.Python
|
|
||||||
build/
|
|
||||||
develop-eggs/
|
|
||||||
dist/
|
|
||||||
downloads/
|
|
||||||
eggs/
|
|
||||||
.eggs/
|
|
||||||
lib/
|
|
||||||
lib64/
|
|
||||||
parts/
|
|
||||||
sdist/
|
|
||||||
var/
|
|
||||||
wheels/
|
|
||||||
share/python-wheels/
|
|
||||||
*.egg-info/
|
|
||||||
.installed.cfg
|
|
||||||
*.egg
|
|
||||||
MANIFEST
|
|
||||||
|
|
||||||
# PyInstaller
|
|
||||||
# Usually these files are written by a python script from a template
|
|
||||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
||||||
*.manifest
|
|
||||||
*.spec
|
|
||||||
|
|
||||||
# Installer logs
|
|
||||||
pip-log.txt
|
|
||||||
pip-delete-this-directory.txt
|
|
||||||
|
|
||||||
# Unit test / coverage reports
|
|
||||||
htmlcov/
|
|
||||||
.tox/
|
|
||||||
.nox/
|
|
||||||
.coverage
|
|
||||||
.coverage.*
|
|
||||||
.cache
|
|
||||||
nosetests.xml
|
|
||||||
coverage.xml
|
|
||||||
*.cover
|
|
||||||
*.py,cover
|
|
||||||
.hypothesis/
|
|
||||||
.pytest_cache/
|
|
||||||
cover/
|
|
||||||
|
|
||||||
# Translations
|
|
||||||
*.mo
|
|
||||||
*.pot
|
|
||||||
|
|
||||||
# Django stuff:
|
|
||||||
*.log
|
|
||||||
local_settings.py
|
|
||||||
db.sqlite3
|
|
||||||
db.sqlite3-journal
|
|
||||||
|
|
||||||
# Flask stuff:
|
|
||||||
instance/
|
|
||||||
.webassets-cache
|
|
||||||
|
|
||||||
# Scrapy stuff:
|
|
||||||
.scrapy
|
|
||||||
|
|
||||||
# Sphinx documentation
|
|
||||||
docs/_build/
|
|
||||||
|
|
||||||
# PyBuilder
|
|
||||||
.pybuilder/
|
|
||||||
target/
|
|
||||||
|
|
||||||
# Jupyter Notebook
|
|
||||||
.ipynb_checkpoints
|
|
||||||
|
|
||||||
# IPython
|
|
||||||
profile_default/
|
|
||||||
ipython_config.py
|
|
||||||
|
|
||||||
# pyenv
|
|
||||||
# For a library or package, you might want to ignore these files since the code is
|
|
||||||
# intended to run in multiple environments; otherwise, check them in:
|
|
||||||
# .python-version
|
|
||||||
|
|
||||||
# pipenv
|
|
||||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
||||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
||||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
||||||
# install all needed dependencies.
|
|
||||||
#Pipfile.lock
|
|
||||||
|
|
||||||
# UV
|
|
||||||
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
||||||
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
||||||
# commonly ignored for libraries.
|
|
||||||
#uv.lock
|
|
||||||
|
|
||||||
# poetry
|
|
||||||
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
||||||
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
||||||
# commonly ignored for libraries.
|
|
||||||
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
||||||
#poetry.lock
|
|
||||||
|
|
||||||
# pdm
|
|
||||||
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
||||||
#pdm.lock
|
|
||||||
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
||||||
# in version control.
|
|
||||||
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
|
||||||
.pdm.toml
|
|
||||||
.pdm-python
|
|
||||||
.pdm-build/
|
|
||||||
|
|
||||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
||||||
__pypackages__/
|
|
||||||
|
|
||||||
# Celery stuff
|
|
||||||
celerybeat-schedule
|
|
||||||
celerybeat.pid
|
|
||||||
|
|
||||||
# SageMath parsed files
|
|
||||||
*.sage.py
|
|
||||||
|
|
||||||
# Environments
|
|
||||||
.env
|
|
||||||
.venv
|
|
||||||
env/
|
|
||||||
venv/
|
|
||||||
ENV/
|
|
||||||
env.bak/
|
|
||||||
venv.bak/
|
|
||||||
|
|
||||||
# Spyder project settings
|
|
||||||
.spyderproject
|
|
||||||
.spyproject
|
|
||||||
|
|
||||||
# Rope project settings
|
|
||||||
.ropeproject
|
|
||||||
|
|
||||||
# mkdocs documentation
|
|
||||||
/site
|
|
||||||
|
|
||||||
# mypy
|
|
||||||
.mypy_cache/
|
|
||||||
.dmypy.json
|
|
||||||
dmypy.json
|
|
||||||
|
|
||||||
# Pyre type checker
|
|
||||||
.pyre/
|
|
||||||
|
|
||||||
# pytype static type analyzer
|
|
||||||
.pytype/
|
|
||||||
|
|
||||||
# Cython debug symbols
|
|
||||||
cython_debug/
|
|
||||||
|
|
||||||
# PyCharm
|
|
||||||
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
||||||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
||||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
||||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
||||||
#.idea/
|
|
||||||
|
|
||||||
# Ruff stuff:
|
|
||||||
.ruff_cache/
|
|
||||||
|
|
||||||
# PyPI configuration file
|
|
||||||
.pypirc
|
|
||||||
|
|
||||||
# Cursor
|
|
||||||
# Cursor is an AI-powered code editor.`.cursorignore` specifies files/directories to
|
|
||||||
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
|
||||||
# refer to https://docs.cursor.com/context/ignore-files
|
|
||||||
.cursorignore
|
|
||||||
.cursorindexingignore
|
|
||||||
|
|
||||||
# Custom stuff
|
|
||||||
gacha_game.db
|
gacha_game.db
|
||||||
config.ini
|
__pycache__/
|
||||||
|
|
|
@ -1,16 +1,25 @@
|
||||||
import time
|
|
||||||
import traceback
|
|
||||||
import misskey
|
import misskey
|
||||||
|
import os
|
||||||
|
import asyncio
|
||||||
from parsing import parse_notification
|
from parsing import parse_notification
|
||||||
from db_utils import get_or_create_user, add_pull, get_config, set_config
|
from db_utils import get_or_create_user, add_pull, get_config, set_config
|
||||||
from client import client_connection
|
from client import client_connection
|
||||||
|
|
||||||
# Initialize the Misskey client
|
# Initialize the Misskey client
|
||||||
|
|
||||||
|
# Function to create a note when a user pulls a character in the gacha game
|
||||||
|
|
||||||
|
|
||||||
|
# Set the access token and instance URL (replace with your own values)
|
||||||
|
|
||||||
|
# Initialize the Misskey client
|
||||||
|
|
||||||
client = client_connection()
|
client = client_connection()
|
||||||
|
|
||||||
|
import time
|
||||||
|
|
||||||
# Define your whitelist
|
# Define your whitelist
|
||||||
# TODO: move to config
|
whitelisted_instances = []
|
||||||
whitelisted_instances: list[str] = []
|
|
||||||
|
|
||||||
def stream_notifications():
|
def stream_notifications():
|
||||||
print("Starting filtered notification stream...")
|
print("Starting filtered notification stream...")
|
||||||
|
@ -19,9 +28,6 @@ def stream_notifications():
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
# May be able to mark notifications as read using misskey.py and
|
|
||||||
# filter them out here. This function also takes a since_id we
|
|
||||||
# could use as well
|
|
||||||
notifications = client.i_notifications()
|
notifications = client.i_notifications()
|
||||||
|
|
||||||
if notifications:
|
if notifications:
|
||||||
|
@ -69,7 +75,7 @@ def stream_notifications():
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"An exception has occured: {e}\n{traceback.format_exc()}")
|
print(f"Error: {e}")
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,8 @@
|
||||||
'''Essentials for the bot to function'''
|
# Essential for the bot to function
|
||||||
import configparser
|
INSTANCE = "" # Bots Misskey instance's URL **with schema**
|
||||||
config = configparser.ConfigParser()
|
KEY = "" # API key for the bot
|
||||||
config.read('config.ini')
|
|
||||||
|
|
||||||
# Username for the bot
|
# Extra stuff for control of the bot
|
||||||
USER = config['application']['BotUser']
|
ADMINS = [] # Fedi handles in the traditional 'user@domain.tld' style,
|
||||||
|
# allows these users to use extra admin exclusive commands
|
||||||
# API key for the bot
|
# with the bot
|
||||||
KEY = config['application']['ApiKey']
|
|
||||||
# Bot's Misskey instance URL
|
|
||||||
INSTANCE = config['application']['InstanceUrl']
|
|
||||||
|
|
||||||
# Extra stuff for control of the bot
|
|
||||||
|
|
||||||
# TODO: move this to db
|
|
||||||
# Fedi handles in the traditional 'user@domain.tld' style, allows these users
|
|
||||||
# to use extra admin exclusive commands with the bot'''
|
|
||||||
ADMINS = config['application']['DefaultAdmins']
|
|
||||||
|
|
|
@ -1,26 +1,22 @@
|
||||||
import sqlite3
|
import sqlite3
|
||||||
import random
|
import random
|
||||||
|
|
||||||
# TODO: grab this from a config file instead
|
|
||||||
DB_PATH = "./gacha_game.db" # Adjust if needed
|
DB_PATH = "./gacha_game.db" # Adjust if needed
|
||||||
|
|
||||||
def get_db_connection():
|
def get_db_connection():
|
||||||
'''Creates a connection to the database'''
|
|
||||||
conn = sqlite3.connect(DB_PATH)
|
conn = sqlite3.connect(DB_PATH)
|
||||||
conn.row_factory = sqlite3.Row
|
conn.row_factory = sqlite3.Row
|
||||||
return conn
|
return conn
|
||||||
|
|
||||||
def get_or_create_user(username):
|
def get_or_create_user(username):
|
||||||
'''Retrieves an ID for a given user, if the user does not exist, it will be
|
|
||||||
created.'''
|
|
||||||
conn = get_db_connection()
|
conn = get_db_connection()
|
||||||
conn.row_factory = sqlite3.Row
|
conn.row_factory = sqlite3.Row
|
||||||
cur = conn.cursor()
|
cur = conn.cursor()
|
||||||
cur.execute('SELECT id FROM users WHERE username = ?', (username,))
|
cur.execute('SELECT * FROM users WHERE username = ?', (username,))
|
||||||
user = cur.fetchone()
|
user = cur.fetchone()
|
||||||
if user:
|
if user:
|
||||||
conn.close()
|
conn.close()
|
||||||
return user[0]
|
return user['id']
|
||||||
|
|
||||||
# New user starts with has_rolled = False
|
# New user starts with has_rolled = False
|
||||||
cur.execute(
|
cur.execute(
|
||||||
|
@ -33,7 +29,6 @@ def get_or_create_user(username):
|
||||||
return user_id
|
return user_id
|
||||||
|
|
||||||
def add_pull(user_id, character_id):
|
def add_pull(user_id, character_id):
|
||||||
'''Creates a pull in the database'''
|
|
||||||
conn = get_db_connection()
|
conn = get_db_connection()
|
||||||
cur = conn.cursor()
|
cur = conn.cursor()
|
||||||
cur.execute('INSERT INTO pulls (user_id, character_id) VALUES (?, ?)', (user_id, character_id))
|
cur.execute('INSERT INTO pulls (user_id, character_id) VALUES (?, ?)', (user_id, character_id))
|
||||||
|
@ -41,7 +36,6 @@ def add_pull(user_id, character_id):
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
def get_config(key):
|
def get_config(key):
|
||||||
'''Reads the value for a specified config key from the db'''
|
|
||||||
conn = get_db_connection()
|
conn = get_db_connection()
|
||||||
cur = conn.cursor()
|
cur = conn.cursor()
|
||||||
cur.execute("SELECT value FROM config WHERE key = ?", (key,))
|
cur.execute("SELECT value FROM config WHERE key = ?", (key,))
|
||||||
|
@ -50,9 +44,8 @@ def get_config(key):
|
||||||
return row[0] if row else None
|
return row[0] if row else None
|
||||||
|
|
||||||
def set_config(key, value):
|
def set_config(key, value):
|
||||||
'''Writes the value for a specified config key to the db'''
|
|
||||||
conn = get_db_connection()
|
conn = get_db_connection()
|
||||||
cur = conn.cursor()
|
cur = conn.cursor()
|
||||||
cur.execute("INSERT OR REPLACE INTO config (key, value) VALUES (?, ?)", (key, value))
|
cur.execute("INSERT OR REPLACE INTO config (key, value) VALUES (?, ?)", (key, value))
|
||||||
conn.commit()
|
conn.commit()
|
||||||
conn.close()
|
conn.close()
|
|
@ -3,7 +3,6 @@ from db_utils import get_or_create_user, add_pull, get_db_connection
|
||||||
from add_character import add_character
|
from add_character import add_character
|
||||||
|
|
||||||
def get_character():
|
def get_character():
|
||||||
''' Gets a random character from the database'''
|
|
||||||
conn = get_db_connection()
|
conn = get_db_connection()
|
||||||
cur = conn.cursor()
|
cur = conn.cursor()
|
||||||
cur.execute('SELECT * FROM characters')
|
cur.execute('SELECT * FROM characters')
|
||||||
|
@ -11,59 +10,37 @@ def get_character():
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
if not characters:
|
if not characters:
|
||||||
return None, None, None, None
|
return None, None
|
||||||
|
|
||||||
weights = [c['weight'] for c in characters]
|
weights = [c['weight'] for c in characters]
|
||||||
chosen = random.choices(characters, weights=weights, k=1)[0]
|
chosen = random.choices(characters, weights=weights, k=1)[0]
|
||||||
|
|
||||||
return chosen['id'], chosen['name'], chosen['file_id'], chosen['rarity']
|
return chosen['id'], chosen['name'], chosen['file_id'], chosen['rarity']
|
||||||
|
|
||||||
def is_float(val):
|
|
||||||
try:
|
|
||||||
float(val)
|
|
||||||
return True
|
|
||||||
except ValueError:
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
# TODO: See issue #3, separate command parsing from game logic.
|
|
||||||
def gacha_response(command,full_user, arguments,note_obj):
|
def gacha_response(command,full_user, arguments,note_obj):
|
||||||
'''Parses a given command with arguments, processes the game state and
|
|
||||||
returns a response'''
|
|
||||||
|
|
||||||
if command == "roll":
|
if command == "roll":
|
||||||
user_id = get_or_create_user(full_user)
|
user_id = get_or_create_user(full_user)
|
||||||
character_id, character_name, file_id, rarity = get_character()
|
character_id, character_name, file_id, rarity = get_character()
|
||||||
|
|
||||||
if not character_id:
|
if not character_id:
|
||||||
#TODO: Can't have tuples of a single element
|
|
||||||
# Return these as a dict or object instead.
|
|
||||||
return(f"@{full_user} Uwaaa... something went wrong! No characters found. 😿")
|
return(f"@{full_user} Uwaaa... something went wrong! No characters found. 😿")
|
||||||
|
|
||||||
add_pull(user_id,character_id)
|
add_pull(user_id,character_id)
|
||||||
stars = '⭐️' * rarity
|
stars = '⭐️' * rarity
|
||||||
return([f"@{full_user} 🎲 Congrats! You rolled {stars} **{character_name}**\nShe's all yours now~ 💖✨",[file_id]])
|
return([f"@{full_user} 🎲 Congrats! You rolled **{character_name}** she's {stars} stars! She's all yours now~ 💖✨",[file_id]])
|
||||||
|
|
||||||
if command == "create":
|
if command == "create":
|
||||||
# Example call from bot logic
|
# Example call from bot logic
|
||||||
image_url = note_obj.get("files", [{}])[0].get("url") if note_obj.get("files") else None
|
image_url = note_obj.get("files", [{}])[0].get("url") if note_obj.get("files") else None
|
||||||
if not image_url:
|
if not image_url:
|
||||||
return "You need an image to create a character, dumbass."
|
return("You need an image to create a character, dumbass.")
|
||||||
|
|
||||||
if len(arguments) != 3:
|
|
||||||
return "Please specify the following attributes in order: name, rarity, drop weighting"
|
|
||||||
|
|
||||||
if not (arguments[1].isnumeric() and 1 <= int(arguments[1]) <= 5):
|
|
||||||
return f"Invalid rarity: '{arguments[1]}' must be a number between 1 and 5"
|
|
||||||
|
|
||||||
if not (is_float(arguments[2]) and 0.0 < float(arguments[2]) <= 1.0):
|
|
||||||
return f"Invalid drop weight: '{arguments[2]}' must be a decimal value between 0.0 and 1.0"
|
|
||||||
|
|
||||||
character_id, file_id = add_character(
|
character_id, file_id = add_character(
|
||||||
name=arguments[0],
|
name=arguments[0],
|
||||||
rarity=int(arguments[1]),
|
rarity=int(arguments[1]),
|
||||||
weight=float(arguments[2]),
|
weight=float(arguments[2]),
|
||||||
image_url=image_url
|
image_url=image_url
|
||||||
)
|
)
|
||||||
return([f"Added {arguments[0]}, ID {character_id}.",[file_id]])
|
return([f"Added {arguments[0]}, ID {character_id}.",[file_id]])
|
||||||
return None
|
|
|
@ -1,29 +1,29 @@
|
||||||
import random, re
|
import random, re
|
||||||
import config
|
|
||||||
from gacha_response import gacha_response
|
from gacha_response import gacha_response
|
||||||
|
|
||||||
def parse_notification(notification,client):
|
|
||||||
'''Oarses any notifications received by the bot and sends any commands to
|
|
||||||
gacha_response()'''
|
|
||||||
|
|
||||||
# We get the type of notification to filter the ones that we actually want
|
def parse_notification(notification,client):
|
||||||
# to parse
|
|
||||||
|
# We get the type of notification to filter the ones that we actually want to parse
|
||||||
|
|
||||||
notif_type = notification.get("type")
|
notif_type = notification.get("type")
|
||||||
if not notif_type in ('mention', 'reply'):
|
if not((notif_type == "mention") or (notif_type == "reply")):
|
||||||
return # Ignore anything that isn't a mention
|
|
||||||
|
return # Ignora todo lo que no sea una mención
|
||||||
|
|
||||||
|
# We want the visibility to be related to the type that was received (so if people don't want to dump a bunch of notes on home they don't have to)
|
||||||
|
|
||||||
# We want the visibility to be related to the type that was received (so if
|
|
||||||
# people don't want to dump a bunch of notes on home they don't have to)
|
|
||||||
visibility = notification["note"]["visibility"]
|
visibility = notification["note"]["visibility"]
|
||||||
if visibility != "specified":
|
if visibility == "specified":
|
||||||
|
visibility = "specified"
|
||||||
|
else:
|
||||||
visibility = "home"
|
visibility = "home"
|
||||||
|
|
||||||
# Get the full Activitypub ID of the user
|
|
||||||
|
|
||||||
user = notification.get("user", {})
|
user = notification.get("user", {})
|
||||||
username = user.get("username", "unknown")
|
username = user.get("username", "unknown")
|
||||||
host = user.get("host")
|
host = user.get("host")
|
||||||
# Local users may not have a hostname attached
|
|
||||||
full_user = f"@{username}" if not host else f"@{username}@{host}"
|
full_user = f"@{username}" if not host else f"@{username}@{host}"
|
||||||
|
|
||||||
note_obj = notification.get("note", {})
|
note_obj = notification.get("note", {})
|
||||||
|
@ -32,40 +32,38 @@ def parse_notification(notification,client):
|
||||||
|
|
||||||
note = note_text.strip().lower() if note_text else ""
|
note = note_text.strip().lower() if note_text else ""
|
||||||
|
|
||||||
# Check for both short and fully-qualified name mentions
|
waifumelon_variants = [
|
||||||
username_variants = [
|
"@waifumelon", # simple mention
|
||||||
config.USER,
|
"@waifumelon@mai.waifuism.life", # fully qualified
|
||||||
f'@{config.USER.split("@")[1]}'
|
|
||||||
]
|
]
|
||||||
|
|
||||||
# Make sure the notification text explicitly mentions the bot
|
if any(variant in note for variant in waifumelon_variants):
|
||||||
if not any(variant in note for variant in username_variants):
|
# Find command and arguments after the mention
|
||||||
return
|
# Removes all mentions (regex = mentions that start with @ and may contain @domain)
|
||||||
|
cleaned_text = re.sub(r"@\w+(?:@\S+)?", "", note).strip()
|
||||||
|
parts = cleaned_text.split()
|
||||||
|
print(cleaned_text)
|
||||||
|
print(parts)
|
||||||
|
|
||||||
# Find command and arguments after the mention
|
command = parts[0].lower() if parts else None
|
||||||
# Removes all mentions (regex = mentions that start with @ and may contain @domain)
|
arguments = parts[1:] if len(parts) > 1 else []
|
||||||
cleaned_text = re.sub(r"@\w+(?:@\S+)?", "", note).strip()
|
|
||||||
parts = cleaned_text.split()
|
|
||||||
|
|
||||||
command = parts[0].lower() if parts else None
|
|
||||||
arguments = parts[1:] if len(parts) > 1 else []
|
|
||||||
|
|
||||||
# TODO: move response generation to a different function
|
|
||||||
response = gacha_response(command.lower(),full_user, arguments, note_obj)
|
|
||||||
if not response:
|
|
||||||
return
|
|
||||||
|
|
||||||
if isinstance(response, str):
|
|
||||||
client.notes_create(
|
|
||||||
text=response,
|
|
||||||
reply_id=note_id,
|
|
||||||
visibility=visibility
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
client.notes_create(
|
command = None
|
||||||
text=response[0],
|
if command:
|
||||||
reply_id=note_id,
|
response = gacha_response(command.lower(),full_user, arguments, note_obj)
|
||||||
visibility=visibility,
|
if response:
|
||||||
file_ids=response[1]
|
if type(response) == str:
|
||||||
#visible_user_ids=[] #todo: write actual visible users ids so pleromers can use the bot privately
|
client.notes_create(
|
||||||
)
|
text=response,
|
||||||
|
reply_id=note_id,
|
||||||
|
visibility=visibility
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
client.notes_create(
|
||||||
|
text=response[0],
|
||||||
|
reply_id=note_id,
|
||||||
|
visibility=visibility,
|
||||||
|
file_ids=response[1]
|
||||||
|
#visible_user_ids=[] #todo: write actual visible users ids so pleromers can use the bot privately
|
||||||
|
|
||||||
|
)
|
|
@ -1,14 +0,0 @@
|
||||||
; Rename me to config.ini and put your values in here
|
|
||||||
[application]
|
|
||||||
; Full fedi handle of the bot user
|
|
||||||
BotUser = @bot@example.tld
|
|
||||||
|
|
||||||
; API key for the bot
|
|
||||||
; Generate one by going to Settings > API > Generate access token
|
|
||||||
ApiKey = abcdefghijklmnopqrstuvwxyz012345
|
|
||||||
|
|
||||||
; Fully qualified URL of the instance hosting the bot
|
|
||||||
InstanceUrl = http://example.tld
|
|
||||||
|
|
||||||
; Comma separated list of fedi handles for any administrator users
|
|
||||||
DefaultAdmins = ['admin@example.tld']
|
|
Loading…
Add table
Reference in a new issue