README.md + various fixes
This commit is contained in:
parent
3cd3e44430
commit
09079e95cd
29
README.md
29
README.md
|
|
@ -1,3 +1,28 @@
|
|||
# MangaBot
|
||||
# Manga Bot
|
||||
|
||||
### A discord bot that tells you when manga comes out!!!
|
||||
|
||||
|
||||
# How To Use
|
||||
|
||||
### Option 1:
|
||||
|
||||
Add it to your server or do a user install here: [Discord Invite](https://discord.com/oauth2/authorize?client_id=1265022463964610721)
|
||||
|
||||
### Option 2:
|
||||
|
||||
Join my testing server and give it a shot: [My Server](https://discord.gg/q3SevqVHN5)
|
||||
|
||||
# Commands
|
||||
|
||||
## /list
|
||||
|
||||
> will list the manga you are currently following
|
||||
|
||||
## /search *title*
|
||||
|
||||
> Will search for the manga, allowing you to follow it.
|
||||
>
|
||||
> Title doesnt need to be perfect
|
||||
|
||||
|
||||
A discord bot that tells you when manga comes out
|
||||
14
main.py
14
main.py
|
|
@ -21,16 +21,6 @@ tree = app_commands.CommandTree(client)
|
|||
man = manager.Manager(client)
|
||||
|
||||
|
||||
@tree.command(
|
||||
name="ping",
|
||||
description="My first application Command",
|
||||
guild=discord.Object(id=1042133536926347324)
|
||||
)
|
||||
async def first_command(interaction: discord.Interaction):
|
||||
chanel = await interaction.user.create_dm()
|
||||
await chanel.send("Hi")
|
||||
|
||||
|
||||
async def render_manga_list_in_dm(interaction: discord.Interaction, manga_list: list[manga_api.Manga]):
|
||||
chanel = await interaction.user.create_dm()
|
||||
await interaction.followup.send("Check your DM's")
|
||||
|
|
@ -70,6 +60,8 @@ async def render_manga_list_in_dm(interaction: discord.Interaction, manga_list:
|
|||
description="Search for manga to follow",
|
||||
)
|
||||
@app_commands.describe(title='Title of the manga to search for')
|
||||
@app_commands.user_install()
|
||||
@discord.app_commands.guild_install()
|
||||
async def search_command(
|
||||
interaction: discord.Interaction,
|
||||
title: str
|
||||
|
|
@ -83,6 +75,8 @@ async def search_command(
|
|||
name="list",
|
||||
description="List the manga you follow",
|
||||
)
|
||||
@app_commands.user_install()
|
||||
@discord.app_commands.guild_install()
|
||||
async def list_command(interaction: discord.Interaction):
|
||||
await interaction.response.defer()
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ class Manager:
|
|||
self.manga[manga.id].remove(user.id)
|
||||
if len(self.manga[manga.id]) == 0:
|
||||
self.manga.pop(manga.id)
|
||||
if manga.id in self.chapters.keys():
|
||||
self.chapters.pop(manga.id)
|
||||
else:
|
||||
self.manga[manga.id] = []
|
||||
|
||||
|
|
@ -95,6 +97,11 @@ class Manager:
|
|||
self.chapters = data["chapters"]
|
||||
|
||||
def to_dict(self):
|
||||
for manga_id in self.manga.keys():
|
||||
if len(self.manga[manga_id]) == 0:
|
||||
self.manga.pop(manga_id)
|
||||
if manga_id in self.chapters.keys():
|
||||
self.chapters.pop(manga_id)
|
||||
return {
|
||||
"manga": self.manga,
|
||||
"chapters": self.chapters
|
||||
|
|
|
|||
Loading…
Reference in New Issue