Metadata-Version: 2.4
Name: swagsocialbots
Version: 1.0.4
Summary: swagsocialbots is a library to make bots with the swagsocial.py library
Project-URL: Homepage, https://git.nomaakip.xyz/maxie/swagsocialbots
Project-URL: Issues, https://git.nomaakip.xyz/maxie/swagsocialbots/issues
Author: maxie
License-Expression: GPL-3.0-only
License-File: LICENSE
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.10
Requires-Dist: requests>=2.28
Requires-Dist: swagsocial-py[asynchronous]==1.3.2
Description-Content-Type: text/markdown

# swagsocialbots

Now on PyPI: https://pypi.org/project/swagsocialbots/

Python module to make bots in swagsocial with [swagsocial.py](https://pypi.org/project/swagsocial-py)

Created by maxie!

# Getting your API key

Log into your desired swagsocial account and go to Settings --> API

If you would like to grant manage post permissions, which includes making posts and replies. It also allows deleting posts and replies, so be careful!

# an example

```python
from swagsocialbots import SwagBot, Context
from swagsocialbots import tasks
from swagsocial_py import User

bot = SwagBot(prefix = "!", base_url = "https://swag.example.com")

# example command
# on swagsocial you would mention the bot
# write the command afterwards, and the arguments for it
#
# here its gonna be "@botexample !hello @user"
# will reply with "Hello User Display Example"
#
# annotating your arguments with desired class will make the
# command parser return the class instance you need such
# as in the example below
@bot.command()
async def hello(ctx: Context, user: User):
    await ctx.reply(f"Hello {user.display_name}")

@bot.event() # will reply to a post the bot is tagged on
async def on_mention(ctx: Context):
    await ctx.reply(f"Hello, {ctx.post.author.mention()}")

# will reply with an error message related to the comamnd
@bot.event()
async def on_command_error(ctx: Context, exception: Exception):
    await ctx.reply(f"something went wrong: {exception.__class__.__name__}: {exception}")

@bot.event()
async def on_error(ctx: Context, exception: Exception):
    # for now exception in this block will always be "Command not found"
    await ctx.reply(f"something went wrong: {exception.__class__.__name__}: {exception}")

# used for making a function repeat every N time, and N times (using for_times argument)
@tasks.repeat_every(hours = 1) # add for_times = <int> to repeat this function for a specific amount of times before stopping
async def post_meow():
    await bot.post("meow") # will post meow every 1 hour

@bot.event()
async def on_start():
    print("bot started")

bot.run("api key")
```

more in depth examples are in [here](https://git.nomaakip.xyz/swagorg/swagsocialbots/src/branch/main/examples)
