Skip to content

feat: Added Basic examples #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open

feat: Added Basic examples #11

wants to merge 23 commits into from

Conversation

lol219
Copy link

@lol219 lol219 commented Nov 26, 2022

Closes #10
Hello there,
Hope you are fine, i have opened this PR to add some basic examples about how to use this library with discord.py , the code have been tested before i opened this pull request.

@lol219 lol219 changed the title Added Basic examples feat: Added Basic examples Nov 26, 2022
Copy link
Author

@lol219 lol219 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i Really don't know why it shows a blank file called examples , i just wanted to rename the folder example to examples smh

@Soheab
Copy link
Owner

Soheab commented Nov 27, 2022

Please move the examples from /examples/... it /examples/discordpy/...

Copy link
Owner

@Soheab Soheab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR.

Good work but some small changes required.

class Bot(commands.Bot):
def __init__(self, **kwargs):
super().__init__(command_prefix="!", intents=intents, **kwargs)
self.vac_api= vacefron.Client()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.vac_api= vacefron.Client()
self.vac_api = vacefron.Client()

Needs some space between the name and =

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change hasn't been committed, why was this resolved?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

github doesn't allow me to commit because example folder is renamed, please re-review these again .



class Bot(commands.Bot):
def __init__(self, **kwargs):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't use bare **kwargs. Either add the required kwargs or remove it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my bad

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change hasn't been committed, why was this resolved?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cant xommit at phone

self.vac_api= vacefron.Client()


#Optional
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#Optional
# this is optional for closing the client session and preventing the "Unclosed client session" warning.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change hasn't been committed, why was this resolved?

await self.vac_api.close()
await super().close()

bot= Bot()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, space between name and =

Suggested change
bot= Bot()
bot = Bot()

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change hasn't been committed, why was this resolved?




bot.run("")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
bot.run("")
bot.run(...)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change hasn't been committed, why was this resolved?

Comment on lines 1 to 6
import discord

import vacefron

from discord.ext import commands

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import discord
import vacefron
from discord.ext import commands
import vacefron
import discord
from discord.ext import commands

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change hasn't been committed, why was this resolved?

Comment on lines 1 to 30
import discord
from discord import app_commands
import vacefron

from discord.ext import commands


class Bot(commands.Bot):
def __init__(self, **kwargs):
super().__init__(command_prefix="!",intents= discord.Intents.default(), **kwargs)
self.vac_api= vacefron.Client()

#Optional
async def close(self):
await self.vac_api.close()
await super().close()

bot= Bot()

@bot.tree.command()
async def peposign(interaction: discord.Interaction, text: str):
image = await bot.vac_api.peeposign(text)
f = discord.File(await image.read(), "peposign.png")
embed= discord.Embed(title="Peposign")
embed.set_image(url=image.url)
await interaction.response.send_message(embed=embed)
# If it doesn't work then you should add await interaction.response.defer() then replace interaction.response.send_message with interaction.followup.send


bot.run("")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as other example.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change hasn't been committed, why was this resolved?

@lol219
Copy link
Author

lol219 commented Nov 27, 2022

Wait

@lol219
Copy link
Author

lol219 commented Nov 27, 2022

I jusy marked as resolved and still shows that ,aka the changzs are not merged

@lol219 lol219 requested a review from Soheab November 27, 2022 09:28
@lol219
Copy link
Author

lol219 commented Nov 27, 2022

@Soheab

@lol219
Copy link
Author

lol219 commented Aug 29, 2024

@Soheab
i think you forgot this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] Add some basic examples
2 participants