diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..4ff2f1e --- /dev/null +++ b/.env.example @@ -0,0 +1,2 @@ +TOKEN=token-goes-here +API_URL=api_url_goes_here \ No newline at end of file diff --git a/README.md b/README.md index 07fdd32..41ca7be 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,15 @@ # IndiumRevolt.py -IndiumRevolt aims to recreate functionality of other popular bots from Discord, but on Revolt. + +IndiumRevolt.py aims to recreate functionality of other popular bots from Discord, but on Revolt. +You can invite the bot [here](https://app.revolt.chat/bot/01H3ANCNT182REPP90AY03NBMM). + +## Selfhosting + +If you're self-hosting IndiumRevolt.py, please make it clear that it is not the main instance (or change the name) but give credit by linking to this repo (for example, in the bot's profile - something like ``This bot [IndiumRevolt.py](https://github.com/SeaswimmerTheFsh/IndiumRevolt.py)`` will suffice). + +* Clone this repository (`git clone https://github.com/SeaswimmerTheFsh/IndiumRevolt.py.git`) +* Install Revolt.py and dotenv + * ``pip install revolt.py dotenv`` +* Set up an `.env` file + * Rename the `.env.example` file and fill out the values +* Run the bot (`python main.py`) diff --git a/main.py b/main.py new file mode 100644 index 0000000..a29e5cd --- /dev/null +++ b/main.py @@ -0,0 +1,33 @@ +import asyncio +import os +from dotenv import load_dotenv +import aiohttp +import revolt +from revolt.ext import commands + +load_dotenv() +token = os.getenv('TOKEN') +api_url = os.getenv('API_URL') + +class Client(commands.CommandsClient): + async def get_prefix(self, message: revolt.Message): + return "." + + @commands.command() + async def ping(self, ctx: commands.Context): + await ctx.send("Pong!") + + @commands.command() + async def avatar(self, ctx: commands.Context, member: revolt.Member): + if not isinstance(member, revolt.Member): + await ctx.send("Please provide a member argument!") + return + avatar = member.avatar.url + await ctx.send(f"{avatar}") + +async def main(): + async with aiohttp.ClientSession() as session: + client = Client(session, token, api_url=api_url) + await client.start() + +asyncio.run(main()) \ No newline at end of file