Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

Commit

Permalink
Change bot prefix and separator
Browse files Browse the repository at this point in the history
  • Loading branch information
antoine-royer committed Jun 21, 2022
1 parent 5f2817f commit 5cac381
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 27 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,34 @@ This code was provided with license GNU General Public License v3.0.

### Adding WikiBot

For adding WikiBot to your server, please [click here](https://discord.com/api/oauth2/authorize?client_id=731043686682591263&permissions=274877991936&scope=bot).
For adding WikiBot to your server, please [click here](https://discord.com/api/oauth2/authorize?client_id=731043686682591263;permissions=274877991936;scope=bot).

## Features and command

### Get a list of random articles from wikipedia

`!r number_of_random_article [& language]`
`/r number_of_random_article [; language]`

### Get the summary of an article from wikipedia

`!p name_of_article [& language]`
`/p name_of_article [; language]`

`!p+ name_of_the_article [& language]`
`/p+ name_of_the_article [; language]`
This last function apply an automatic correction on the title given.

### Make a research on wikipedia

`!s search_terms [& language]`
`/s search_terms [; language]`

### Get the last news

`!n the_newspaper's_name [& number_of_newspaper_articles [+]]`
`/n the_newspaper's_name [; number_of_newspaper_articles [+]]`

### Get the weather

The weather forecasts are provided by the OpenWeather's API.

`!w the_city_name [& day_of_the_forecast]`
`/w the_city_name [; day_of_the_forecast]`

The day parameter allow you to see the day. 0 is today, 1 tomorrow… The maximum is 7.

Expand All @@ -54,32 +54,32 @@ This argument allows you to choose the language of article on wikipedia or the d

### Wikipedia handlings

`!r 1 & de`
`/r 1 ; de`
Returns a random article in german.

`!p Paris & fr`
`/p Paris ; fr`
Returns the Paris's wikipedia page in french.

If you have a doubt on the spelling of your search, use `!p+ …`.
If you have a doubt on the spelling of your search, use `/p+ …`.

`!s Sea`
`/s Sea`
Returns a list of wikipedia pages in english about the 'sea'.

### The newspaper

`!n The Lancet`
`/n The Lancet`
Returns the last article of the Lancet.

`!n The Lancet & 2`
`/n The Lancet ; 2`
Returns the two last articles of The Lancet.

`!n The Lancet & 2+`
`/n The Lancet ; 2+`
Returns the second article only.

The number of the article is specified on the embed title.


### The weather

`!w Paris & 1`
`/w Paris ; 1`
Returns the weather for Paris tomorrow.
24 changes: 12 additions & 12 deletions wikibot.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# --------------------------------------------------
# WikiBot (Version 2.1.1)
# WikiBot (Version 2.1.2)
# by Sha-chan~
# last version released on the 24 of Febuary 2022
# last version released on the 21 of June 2022
#
# code provided with licence :
# GNU General Public Licence v3.0
Expand All @@ -15,7 +15,7 @@

client = discord.Client()
token = os.environ["token"]
__version__ = "2.1.1"
__version__ = "2.1.2"


def make_embed(title, description, field, color, image, in_line = False, thumb = False):
Expand All @@ -37,11 +37,11 @@ async def on_message(message):
if message.author == client.user: return None

try:
if msg_content[0] != "!": return None
if msg_content[0] != "/": return None
except:
return None

msg_content = list(msg_content[1:].partition("&"))
msg_content = list(msg_content[1:].partition(";"))

msg_content[0] = msg_content[0].rstrip()

Expand Down Expand Up @@ -93,12 +93,12 @@ async def on_message(message):

elif msg_content[0] == "help":
rep = discord.Embed(title=f"Help pannel (WikiBot v{__version__})", description="List of available commands", color=randint(0, 16777215))
rep.add_field(name="Make a research on wikipedia", value="`!s < search_terms > [& < language >]`", inline=False)
rep.add_field(name="Get an article from Wikipedia with the exact title", value="`!p < title > [& < language >]`", inline=False)
rep.add_field(name="Get an article with an automatic correction on the title", value="`!p+ < title > [& < language >]`", inline=False)
rep.add_field(name="Random selection of articles from Wikipedia", value="`!r < nb > [& < language >]`", inline=False)
rep.add_field(name="Get some news", value="`!n < newspaper_name > [& < number_of_article > [+]]`", inline=False)
rep.add_field(name="Get the weather", value="`!w < city name > [& < day_of_forecast >]` for the day : 0 is today, 1 tomorrow…", inline=False)
rep.add_field(name="Make a research on wikipedia", value="`/s < search_terms > [; < language >]`", inline=False)
rep.add_field(name="Get an article from Wikipedia with the exact title", value="`/p < title > [; < language >]`", inline=False)
rep.add_field(name="Get an article with an automatic correction on the title", value="`/p+ < title > [; < language >]`", inline=False)
rep.add_field(name="Random selection of articles from Wikipedia", value="`/r < nb > [; < language >]`", inline=False)
rep.add_field(name="Get some news", value="`/n < newspaper_name > [; < number_of_article > [+]]`", inline=False)
rep.add_field(name="Get the weather", value="`/w < city name > [; < day_of_forecast >]` for the day : 0 is today, 1 tomorrow…", inline=False)
rep.add_field(name="Complete documentation", value="https://github.com/Shadow15510/WikiBot/blob/master/README.md", inline=False)

if not rep: return None
Expand All @@ -112,7 +112,7 @@ async def on_message(message):

@client.event
async def on_ready():
await client.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="!help"))
await client.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="/help"))
print("Online.")

client.run(token)

0 comments on commit 5cac381

Please sign in to comment.