update how to add the bot with the right perms

This commit is contained in:
Mylloon 2021-05-28 17:52:23 +02:00
parent 8096305121
commit 414c4352f1
2 changed files with 7 additions and 14 deletions

View file

@ -29,9 +29,9 @@ To find reddit tokens, go to [this site](https://www.reddit.com/prefs/apps) and
## __Add the bot to your server__ ## __Add the bot to your server__
- [This site](https://discordapi.com/permissions.html) allows you to choose which permissions to add by default to the bot. - In the [Discord Dev Portal](https://discord.com/developers/applications) create an application, and make sure it's a `Bot` (third tab).
- Choose *Administrator* so you don't get in over your head. - To invite it, go to the `OAuth2` (second tab) tab, select the scopes `bot` (required) and `applications.commands` (for the slashs commands) and in the bot permissions select `Administrator` (You can select manually at your own risk).
- Copy and paste the ID of your bot in *Client ID* found [here](https://discord.com/developers/applications) and go to the link at the bottom of the page. - You have the link above between the two blocks scope and permissions
## __Features__ ## __Features__

View file

@ -1,5 +1,4 @@
import discord
import time
from discord.ext import commands from discord.ext import commands
from discord_slash import cog_ext, SlashContext from discord_slash import cog_ext, SlashContext
@ -12,12 +11,6 @@ class Slash(commands.Cog):
def __init__(self, client): def __init__(self, client):
self.client = client self.client = client
@cog_ext.cog_slash(name="pingSlash", description = "Affiche mon ping.") @cog_ext.cog_slash(name="pingg")
async def _pingSlash(self, ctx: SlashContext): async def pingg(self, ctx: SlashContext):
now = int(round(time.time() * 1000)) await ctx.send(content="Pong!")
ping = now - int(round(ctx.message.created_at.timestamp() * 1000))
embed = discord.Embed(description = 'Pinging...')
message = await ctx.send(embed = embed)
ping2 = int(round(time.time() * 1000)) - now
await message.edit(embed = discord.Embed(color = discord.Colour.random(), description = f':hourglass: {round(self.client.latency * 1000)} ms\n\n:stopwatch: {ping2} ms\n\n:heartbeat: {ping} ms'))
await ctx.message.add_reaction(emoji = '')