simplification reddit token

This commit is contained in:
Mylloon 2020-12-11 15:43:11 +01:00
parent 75d9d9c9ea
commit 6d282f28e4
2 changed files with 5 additions and 2 deletions

View file

@ -12,8 +12,11 @@
```python ```python
token_discord = "ton token discord" token_discord = "ton token discord"
token_genius = "ton token genius" token_genius = "ton token genius"
token_reddit = {"client_id": "ton client_id", "client_secret": "ton client_secret", "user_agent": "ton pseudo (exemple u/gotaga)"} token_reddit = {"client_id": "ton client_id", "client_secret": "ton client_secret", "user_agent": "ton pseudo reddit"}
``` ```
Pour trouver ton token reddit, va sur [ce site](https://www.reddit.com/prefs/apps) et voici les instructions : ![instructions](https://i.imgur.com/tEzYKDA.png)
*rediriger uri (pour le copié/collé) : http://localhost:8080*
#### __Mise en marche__ #### __Mise en marche__

View file

@ -17,7 +17,7 @@ class Internet(commands.Cog):
async def _memes(self, ctx, *, args = ""): async def _memes(self, ctx, *, args = ""):
"""Envois un meme de reddit.\n ➡ Syntaxe: .memes/meme [subreddit]""" """Envois un meme de reddit.\n ➡ Syntaxe: .memes/meme [subreddit]"""
try: try:
reddit = praw.Reddit(client_id = token['client_id'], client_secret = token['client_secret'], user_agent = f"disreddit /{token['user_agent']}, http://localhost:8080") reddit = praw.Reddit(client_id = token['client_id'], client_secret = token['client_secret'], user_agent = f"disreddit /u/{token['user_agent']}, http://localhost:8080")
if args != "": # si il y a un arg différent d'un meme if args != "": # si il y a un arg différent d'un meme
subredditchoix = args subredditchoix = args