Giter VIP home page Giter VIP logo

guide's People

Contributors

alegend21 avatar amach2005 avatar bobdotcom avatar brucecodesgithub avatar dependabot[bot] avatar dorukyum avatar elitesparkle avatar emretech avatar enokiun avatar hannesrahn avatar iddev5 avatar itsnotrin avatar jab416171 avatar justasqu1d avatar kilgoreandy avatar krittick avatar lulalaby avatar martinbndr avatar matteusan avatar mcbabo avatar middledot avatar neloblivion avatar nzii3 avatar plun1331 avatar rajdave69 avatar sengolda avatar tibue99 avatar tommodev-ctrl avatar vincentrps avatar whoisconch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

guide's Issues

Invalid 404 links for events

Summary

Most links on the event handler topic are 404 pages.

Reproduction Steps

Go here https://guide.pycord.dev/getting-started/more-features

Under event handlers, click on few links. Most redirect to 404 pages. Examples:

  1. https://docs.pycord.dev/en/stable/api.html#discord.Intents
  2. https://docs.pycord.dev/en/stable/api.html#discord.Bot.event
  3. https://docs.pycord.dev/en/stable/api.html#discord.on_member_join

Expected Results

The links should redirect to correct pages

Actual Results

Links are 404 pages

System Information

Chrome

Checklist

  • I have searched the open issues for duplicates.

Additional Context

No response

Initial Release Roadmap

Getting Started

  • Creating your first bot
  • More Features
    • Design (#40)
      • Embeds

        Needs example discord components

      • Markdown in Messages
    • Events
    • wait_for
  • Rules & Common Practices

    May need partial rewriting

  • Hosting your bot

Interactions

✅ Commands

  • Slash Commands
  • Context Menus
  • Localization (#59)
    Cogs with Application Commands (see #75) moved to the Popular Topics section

✅ UI Components

  • Button
  • Dropdowns
  • Text Modals

Extensions

✅ Commands

  • Prefixed Commands
  • Command Groups
  • Help Command
  • Cogs

✅ Tasks

  • Getting Started with ext.tasks (#31)

✅ Pages (guide progress on ext.pages might be halted for now)

  • Getting Started with ext.pages

✅ Bridge

  • Getting Started with ext.bridge

Popular Topics

  • Webhooks
  • Sharding
  • Sublcassing Bot
  • Intents
  • Threads
  • Cogs (see #112)

Voice

NOTE: might be ignored, for the initial release

  • Receiving Voice Samples
  • Playing Audio
  • Creating Voice Commands

✅ More

  • Installing Git
  • Community Resources
  • Contributing to the guide
  • Virtual Enviorments (#65)

Low Priority

Unless the team decides to create the page or a PR for it is made these aren’t required for release

  • Creating Voice Commands
  • Playing Audio
  • Anything else not on the list, mostly to remove "feature creep" from the list

[IMPROVEMENT] Pin dependency versions

This way, everyone gets the same version. I know some libraries are prone to breaking something even if it's just a minor version. Better to be safe than not.

Create Your First Bot Tab

Summary

Old Tutorial

Reproduction Steps

I followed the instructions in Creating Your First Bot, and what led me here is the Coding the Basics section. The tab itself looks outdated, along with the images and instructions. I would love to contribute to fixing this, maybe.

Regarding the Coding the Basics section, I encountered an error, which is as follows:

Traceback (most recent call last):
  File "PATH\Pycord\First Project\bot.py", line 6, in <module>
    bot = discord.Bot()
AttributeError: module 'discord' has no attribute 'Bot'

Expected Results

I expected to have a working code and clear instructions because one example that confused me is Inviting the bot. It says, "Go to the OAuth2 tab in the left pane and select bot and applications.commands as scopes." However, in the Discord Dev Portal, there are two buttons inside OAuth2, namely General and URL Generator, but it doesn't mention these.

This isn't a major issue; what I want to convey is that the information in the tab appears outdated, and I haven't progressed to the other tabs beyond this point.

Regarding the code, as I mentioned earlier, I encountered an error, and I expected the code to work without any issues.

Actual Results

Encountered an error and got lost in the middle of the instructions.

System Information

Windows 10
Python 3.11.1
Google Chrome
VSCode for running the code.

Checklist

  • I have searched the open issues for duplicates.

Additional Context

No response

"Edit this page" buttons have broken link

Describe the bug

The buttons lead to a 404 on github

To Reproduce

Click the "Edit this page" button at the bottom of any docs page, and observe the GitHub 404. Can be reproduced on (but not limited to) the following: Introduction, Installation, Creating Your First Bot, etc.

Expected behavior

It should not 404

Screenshots

Screen.Recording.2022-03-20.at.1.17.06.PM.mov

Additional context

n/a

Checklist

Let's make sure you've properly done due diligence when reporting this issue!

  • This is an issue with the build, not a spelling or grammar mistake.
  • I have the latest version of the guide.

Meta: Git commits directly to main

Currently, for collaborators (people that can directly commit to this repo), you cannot directly commit to the main branch. I do understand why this is the case, but it's not the solution for all commits. The only type of commits that should have this restriction is commits that add WIP things and aren't immediate.

For example, if you're going to push a commit to main that fixes only one spelling error or multiple ones in the same file, then it should be committed directly to main. However, if you're going around fixing spelling errors in multiple files, then it should be indirectly committed to main (new branch, PR, merge).

Remember, this applies only to people that can commit directly to this repo. If you do not have such permissions, then ignore this issue.

Subclassing guide doesn't work?

It doesn't seem like the subclassing guide works -- by default, Python doesn't inherit decorators from parents (see eg https://stackoverflow.com/questions/3421337/accessing-a-decorator-in-a-parent-class-from-the-child-in-python for discussion of how to make it work), and py-cord doesn't seem to have done the custom work to make it work. The result is that, eg, the @slash_command decorator is undefined in a subclass.

To Reproduce

Copy the first example from https://guide.pycord.dev/popular-topics/subclassing-bots:

$ cat > sample.py
import discord

class MyBot(discord.Bot): # subclass discord.Bot
    async def on_ready(self): # override the on_ready event
        print('Logged in as')
        print(self.user.name)
        print(self.user.id)
        print('------')

    @slash_command() # create a slash command
    async def ping(self, ctx):
        await ctx.respond('Pong!')

bot = MyBot()
bot.run('token')
$ python3 sample.py
Traceback (most recent call last):
  File "sample.py", line 3, in <module>
    class MyBot(discord.Bot): # subclass discord.Bot
  File "sample.py", line 10, in MyBot
    @slash_command() # create a slash command
NameError: name 'slash_command' is not defined

Expected behavior

Bot runs, with a ping slash command defined.

Change styling for links in titles

Is your feature request related to a problem? Please describe.
Links, when placed in titles, have the same styling as when placed in normal text. It would be ideal for them to have the same font-family and color as other titles, but have the font-decoration set to "underline".

Describe the solution you'd like
As described in the previous section. I found that the following css worked:

#verification a {
  font-family: var(--pyc-theme-title-family);
  text-decoration: underline;
}
#verification a:not(:hover) {
  color: unset;
}

Before:

Screen.Recording.2022-03-21.at.10.19.38.AM.mov

After (using the CSS above):

Screen.Recording.2022-03-21.at.10.35.35.AM.mov

Describe alternatives you've considered
n/a

Additional context
n/a

Enhancement for the guide

Is your feature request related to a problem? Please describe.
I think it'd be nice if you could see which "version" the hosted guide is, so at least the ones that care can look if something is already changed or not.

Describe the solution you'd like
discord.js guide does it
image

Describe alternatives you've considered
N/A

Other
I don't know how to add labels, else I'd do it :X

Add a user-app example

Summary

Add a user-app example

The Problem

Add a user-app example

The Ideal Solution

Add a user-app example

The Current Solution

Reading example on main repo

Additional Context

Add a user-app example

Explanation for Protecting Token

When explaining how to protect tokens here, you use raw Markdown formatting (probably copied from a Discord message).

I think you should either make two separate code blocks or, alternatively, remove the first part and only keep the actual example with proper formatting, like shown below.

TOKEN = NzkyNzE1NDU0MTk2MDg4ODQy.X-hvzA.Ovy4MCQywSkoMRRclStW4xAYK7I

Also, the part about ignoring .env files should probably be formatted like a Tip (the block with green background) because it is easy to miss but important to know.

Search breaks internal links

When accessing pages from the search bar in the top-right corner, internal links give a 404 error.
When accessing the same pages from the left-side menu or from any other link, internal links work.

Explanation for Migration

When explaining how to migrate from another library to Pycord here, you could add a paragraph with a short list of conflicting libraries that should be uninstalled before installing Pycord, mentioning that we can use pip freeze to check if we have them installed. Currently, only discord.py is being mentioned.

Syntax Error (Modal)

Syntax Mistake

In the Modal tutorial is a bracket missing

Screenshots
Unbenannt

Checklist

  • This is an issue with the build, not a spelling or grammar mistake.
  • I have the latest version of the guide.

ᵐʸ ᶠⁱʳˢᵗ ⁱˢˢᵘᵉ ❤️

Syntax error in Pycord Guide > Interactions > Application commands > Contextual menus > User Commands

Summary

A syntax error in the User Commands code

Reproduction Steps

Hi I am new to the community and I was reviewing the Pycord Guide, but I found a syntax error in the Context Menus section, specifically in the User Commands section, the error is that if you put the guild.ids=[] attribute in the decorator, the User Command does not work, but if you remove it magically works. On the assumption that I have it wrong, I would like you to add an explanation of how to do it right in the Pycord Guide.

Explanatory video

Video.mp4

Expected Results

If this error does not occur, it should run normally.

Actual Results

Gives https error or simply does not give error, but it does not work.

System Information

No response

Checklist

  • I have searched the open issues for duplicates.

Additional Context

I am Hispanic and my English is very bad, so I used Deepl's translator to express myself, so I apologize if there is something wrong written.

Fixing guide on Cogs

Is your feature request related to a problem? Please describe.
The guide on Cogs seems to be not working. First of all, it was never mentioned that bot.load_extension() needa to be awaited. Furthermore, function setup also needs to be an async function with bot.add_cog() requiring to be awaited

Describe the solution you'd like
Someone more experienced in Pycord needs to review if these problems are correct. If so, I can submit a PR with the changes necessary

Describe alternatives you've considered
Let everyone suffer 🤗

Additional context
Screenshot_2023-04-22-20-33-48-015-edit_com.replit.app.jpg
Screenshot_2023-04-22-20-34-25-618-edit_com.replit.app.jpg

Explanation for Slash Command Groups

When explaining how to use the SlashCommandGroup in the second example here, there is no mention that we need to import discord and then discord.SlashCommandGroup, or that we have to do something equivalent like from discord import SlashCommandGroup.

a feature to disabling the user from clicking any buttons for given time

Is your feature request related to a problem? Please describe.
i made a bot in which i want that if user enter wrong answer in the modal (self.children[0].value)
all ui components should be disabled for him

Describe the solution you'd like

I want a feature that can help me ease this process

Describe alternatives you've considered

i tried using timeout asyncio sleep and many stuff but didnt quite get the desired result

Additional context

Do not suggest using `sqlite3`

Is your feature request related to a problem? Please describe.
As of right now, sqlite3 is recommended on the "Rules and Common Practices" page. However, sqlite3 is synchronous and blocking, which, when considering many people reading this part of the guide are reading it with the idea that they can use this in their asynchronous bot, is... not great.

Describe the solution you'd like
Recommend aiosqlite instead. Maybe put a warning against using the Standard Library sqlite3.

Describe alternatives you've considered
asqlite exists, but I can understand not wanting to recommend that.
Leaving the page as-is is bound to confuse developers.

Application Role Connection Metadata Guide Entry

Summary

Have a Application Role Connection Metadata Guide Entry

The Problem

Have an Application Role Connection Metadata Guide entry. This is a cool feature and info on how to use it should be more public and accessible.

Resources to get started:

https://discord.com/developers/docs/tutorials/configuring-app-metadata-for-linked-roles
https://docs.pycord.dev/en/master/api/clients.html#discord.Bot.update_role_connection_metadata_records
https://docs.pycord.dev/en/master/api/clients.html#discord.Bot.fetch_role_connection_metadata_records

The Ideal Solution

Add an entry to the guide.

The Current Solution

No response

Additional Context

No response

Cogs reference for application commands

Describe the solution you'd like
A guide page made for application command cogs would be nice.

Additional context
There's only a cogs page for ext.commands at the moment (and an example cog in the ext.bridge guide).

More Features should be split into Events, Embeds, and Markdown

The page called More Features currently has a small section about Events, a section about Embeds, and another section about Markdown. The name used for the page is too generic and doesn't give any information about the actual content found within.

I think it would be more appropriate to replace the More Features page with 3 separate pages: Events, Embeds, and Markdown. This way the users will be able to quickly find the information they are looking for because each of these sections will be listed in the left-side menu and thus be more visible.

Translation

Translation
I suggest translations for: German, French, Italian and Vietnamese.

Make the examples more professional

Is your feature request related to a problem? Please describe.
The examples (particularly the discord chat) have somewhat childish and "edgy" jokes. While these jokes have their time and place, it would be better to uphold a more professional facade in our guide. New users judge will whether they'd like to use our package based off of what's in the guide, so while light and playful content is ok, we should pick topics that appeal to everyone.

Screen Shot 2022-03-20 at 1 20 21 PM
Screen Shot 2022-03-20 at 1 24 28 PM

Describe the solution you'd like
Examples should be changed to fit a more professional appearance.

Describe alternatives you've considered
n/a

Additional context
n/a

Meta: issue/PR labels

Is your feature request related to a problem? Please describe.
Like the main repository, this repository needs labels for issues/PRs.

Describe the solution you'd like
Add the following labels:

  • feature
  • bug
  • status
  • priority
    And possibly more depending on what's needed.

Describe alternatives you've considered
N/A

Additional context
N/A

Remove references to debug_guilds

As discord fixed the 1 hour delay in global command registration, it is no longer necessary to register guild commands instead of global commands when testing. Because of this, the guide has no reason to reference debug_guilds as it's an unnecessary detail that will just confuse the user. Removing all references should provide the guide with more clarity.

interactions index: unintended code block

Describe the bug

In the index page for the Interactions guide, there is an unintended code block.
Screen Shot 2022-05-03 at 11 36 59

To Reproduce

  1. Go to the page for the Interactions index
  2. You'll see a code block when the guide is listing the different types of Context Menu commands

Expected behavior

The text is formatted correctly to not be a code block.

Additional Context

I haven't tested to see if this issue appears in the master branch, but it definitely does appear in the production branch.

Checklist

  • This is an issue with the build, not a spelling or grammar mistake.
  • I have the latest version of the guide.

Wavelink not working on py-cord

Summary

Wavelink does not work with py-cord because of discord.py

Reproduction Steps

I did pip install wavelink then discord.py was installed automatically

Expected Results

The wavelink works with py-cord

Actual Results

The wavelink works with py-cord

System Information

https://guide.pycord.dev/voice/playing#starting-out

Checklist

  • I have searched the open issues for duplicates.

Additional Context

Can you remove wavelink from the py-cord guide because it does not work with py-cord?

cant remove all roles from a user (Member.edit() missing 1 required positional argument: 'self')

Describe the bug
I wanted to remove users roles including everyone role

The full goal of above snippet is to make a verifier modal that activates when a button is pressed and if the reponse text is not = to solvertextmain which is a captcha string(random 6 letter string) , if it matches i want allow user to message and assign him verified role but if it doesnt match i wanna mute the user for 2hours and when 2 hours passes i want to drop a message that reenables the user to use slash command and stuff

I want to add a role to user but i am getting this error
To Reproduce

import asyncio
from time import time
import discord
import os
from discord.ext import commands
import logging
import dotenv
import random
import string
from captcha.image import ImageCaptcha
import discord.utils

length=6
dotenv.load_dotenv()
token = str(os.getenv("TOKEN"))

solvertextmain = ''.join(random.choice(string.ascii_uppercase + string.digits + string.ascii_lowercase) for _ in range(length))
file_name = "some_image"
#''.join(random.choice(string.ascii_uppercase + string.digits + string.ascii_lowercase) for _ in range(20))
image = ImageCaptcha(width=280, height=90)
captcha = image.generate(solvertextmain)
image.write(solvertextmain, f"{file_name}.png")

listos=[]
config = None
verify_channel = None
mute_roleid =int(os.getenv("mute_roleid"))
verify_guild = int(os.getenv("verify_guild"))
verif_roleid= int(os.getenv("verif_roleid"))
everyoneroleid=int(os.getenv("everyoneroleid"))
kon=None
#globalvar

#loggerstart
logger = logging.getLogger('discord')
logger.setLevel(logging.DEBUG)
handler = logging.FileHandler(filename='discord.log', encoding='utf-8', mode='w')
handler.setFormatter(logging.Formatter('%(asctime)s:%(levelname)s:%(name)s: %(message)s'))
logger.addHandler(handler)
#loggerend

client = discord.Bot()
@client.event
async def on_ready():
print( 'We have logged in as {0.user}'.format(client))
@client.event
async def on_message (message):
if message.author == client.user:
return
if message.content.startswith('/start'):
await message.channel.send('Hello!')

@client.slash_command(desciption="starts-bot") # Create a slash command
async def wallet(ctx):

emchad =discord.Embed(title="Solve Captcha to Continue", color=0x2ea4ff)
imgfile = discord.File("some_image.png", filename="image.png")
emchad.set_image(url="attachment://image.png")
await ctx.respond("Please complete captcha to continue",embeds=[emchad],file=imgfile,ephemeral=True, view=verifierView()) 

Send a message with our View class that contains the button

class MyModal(discord.ui.Modal):
global kon
global listos
def init(self, *args, **kwargs) -> None:
super().init(*args, **kwargs)

    self.add_item(discord.ui.InputText(label="Enter your wallet address below"))

async def callback(self, interaction: discord.Interaction):
    embed = discord.Embed(title="Wallet Address")
    embed.add_field(name="Your Wallet Address ", value=self.children[0].value)
    member=discord.Member
    guild=client.get_guild(verify_guild)
    verifrole=guild.get_role(verif_roleid)
    print(verifrole)
    
    
    await interaction.response.send_message(embeds=[embed], ephemeral=True),
    await member.add_roles(verifrole)        
    kon=self.children[0].value
    listos.append(kon)
    print(listos)
    output=open("file.txt", 'a')
    for row in listos:
      output.write(str(row) + '\n')

class MyView(discord.ui.View):
@discord.ui.button(label="Click here to enter your address")
async def button_callback(self, button, interaction):
await interaction.response.send_modal(MyModal(title="Enter wallet address below"))

class verifierView(discord.ui.View):
@discord.ui.button(label="Click here to enter captcha code")
async def button_callback(self, button, interaction):
await interaction.response.send_modal(verifierModal(title="Enter captcha below"))
async def disable_all_items(self) -> None:
await super().disable_all_items()
async def enable_all_items(self) -> None:
await super().enable_all_items()

class verifierModal(discord.ui.Modal):
def init(self, *args, **kwargs) -> None:
super().init(*args, **kwargs)

    self.add_item(discord.ui.InputText(label="Enter Captcha code below"))

@commands.has_permissions(kick_members=True,manage_roles=True)
async def callback(self, interaction: discord.Interaction):
    print(self.children[0].value)
    global solvertextmain
    print(solvertextmain)
    if solvertextmain in  self.children[0].value:
        await interaction.response.send_message("Enter your Address",ephemeral=True, view=MyView())
    else:
        await interaction.response.edit_message(view=None)
        await interaction.followup.send(content="TRY AGAIN AFTER 2 HOURS",)
        member=discord.Member
        
        guild=client.get_guild(verify_guild)
        print(guild.me)
        role = guild.get_role(mute_roleid)
        verifrole=guild.get_role(verif_roleid)
        print(role)
        

        roles1 = member.roles #save the member roles
        print(roles1)
        await member.edit(roles=[]) #remove all member roles
         #bring back the old roles)
        #role=discord.utils.get(member.guild.roles, name="Muted")
        await member.add_roles(role)
        await interaction.followup.send("You have has been muted!")
        await asyncio.sleep(3600)
        print(role.name)
        if member.roles == "Muted":
            await member.remove_roles(role)
            await member.add_roles(verifrole)
            
            await interaction.followup.send("You have been unmuted!")
            await interaction.followup.send(content="NOW TRY AGAIN",view=verifierView())

####################################################################

if name == "main":
client.run(token)
Expected behavior
I wanted to remove users roles including everyone role

The full goal of above snippet is to make a verifier modal that activates when a button is pressed and if the reponse text is not = to solvertextmain which is a captcha string(random 6 letter string) , if it matches i want allow user to message and assign him verified role but if it doesnt match i wanna mute the user for 2hours and when 2 hours passes i want to drop a message that reenables the user to use slash command and stuff

I want to achieve results as shown in this Rapptz/discord.py#5937 but when i send this command await member.edit(roles=[]) erorr occurs
Screenshots
image

Additional context

Checklist

  • [ Y] This is an issue with the build, not a spelling or grammar mistake.
  • [ Y] I have the latest version of the guide.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.