-
Notifications
You must be signed in to change notification settings - Fork 13
feat: added help command in bot. #24
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"[python]": { | ||
"editor.defaultFormatter": "ms-python.autopep8" | ||
}, | ||
"python.formatting.provider": "none" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,13 +29,16 @@ | |
case_insensitive=True, intents=intents) | ||
searcher = GithubSearcher(github_token=GITHUB_TOKEN) | ||
|
||
bot.remove_command('help') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. uma explicação? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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", | ||
} | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove espaços extras There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Certo. |
||
@bot.event | ||
async def on_ready(): | ||
"""Log when bot is ready""" | ||
|
@@ -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", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isso não é verdade. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) | ||
|
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sim, vou concertar isso.