Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

feat: added help command in bot. #24

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .vscode/settings.json
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Esse ficheiro é user-based configuration

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sim, vou concertar isso.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"[python]": {
"editor.defaultFormatter": "ms-python.autopep8"
},
"python.formatting.provider": "none"
}
15 changes: 15 additions & 0 deletions src/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,16 @@
case_insensitive=True, intents=intents)
searcher = GithubSearcher(github_token=GITHUB_TOKEN)

bot.remove_command('help')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uma explicação?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Por padrão o bot já vem com o comando help, então essa linha remove esse comando padrão.


locales = {
"linguagem": "language",
"dono": "owner",
"actualização": "updated",
"criado": "created",
}


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove espaços extras

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Certo.

@bot.event
async def on_ready():
"""Log when bot is ready"""
Expand All @@ -50,6 +53,18 @@ async def search_send(ctx, *args):

queries = translate_queries(args)

if "help" in queries or "?" in queries:
embed = discord.Embed(
title="SavannaBot", description="Search for github issues from discord", color=0x00ff00)
embed.add_field(name="How to use",
value="To use this bot, type `/svn` followed by the search terms. For example: `/svn language:python owner:django`", inline=False)
embed.add_field(name="Available search terms",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isso não é verdade.
O Bot suporta todas queries possíveis no github.

Copy link
Contributor Author

@jocaetano1 jocaetano1 Oct 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vou verificar isso.

value="`language`, `owner`, `updated`, `created`", inline=False)
embed.add_field(name="Available commands",
value="`/svn help` or `/svn ?`", inline=False)
await ctx.send(embed=embed)
return

# automatically parse all the arguments
params = ' '.join(queries)
results = await searcher.search(params)
Expand Down