committing initial files

This commit is contained in:
SeaswimmerTheFsh 2023-06-19 16:39:15 -04:00
parent 00b756eea9
commit c0eeeb93f5
3 changed files with 49 additions and 1 deletions

2
.env.example Normal file
View file

@ -0,0 +1,2 @@
TOKEN=token-goes-here
API_URL=api_url_goes_here

View file

@ -1,2 +1,15 @@
# IndiumRevolt.py # 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 <is based on/is an instance of> [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`)

33
main.py Normal file
View file

@ -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())