-
Notifications
You must be signed in to change notification settings - Fork 6
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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
Please move the examples from |
There was a problem hiding this 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.
example/discord_bot/basic_prefix.py
Outdated
class Bot(commands.Bot): | ||
def __init__(self, **kwargs): | ||
super().__init__(command_prefix="!", intents=intents, **kwargs) | ||
self.vac_api= vacefron.Client() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.vac_api= vacefron.Client() | |
self.vac_api = vacefron.Client() |
Needs some space between the name and =
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 .
example/discord_bot/basic_prefix.py
Outdated
|
||
|
||
class Bot(commands.Bot): | ||
def __init__(self, **kwargs): |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my bad
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
example/discord_bot/basic_prefix.py
Outdated
self.vac_api= vacefron.Client() | ||
|
||
|
||
#Optional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#Optional | |
# this is optional for closing the client session and preventing the "Unclosed client session" warning. |
There was a problem hiding this comment.
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?
example/discord_bot/basic_prefix.py
Outdated
await self.vac_api.close() | ||
await super().close() | ||
|
||
bot= Bot() |
There was a problem hiding this comment.
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 =
bot= Bot() | |
bot = Bot() |
There was a problem hiding this comment.
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?
example/discord_bot/basic_prefix.py
Outdated
|
||
|
||
|
||
bot.run("") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bot.run("") | |
bot.run(...) |
There was a problem hiding this comment.
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?
example/discord_bot/basic_prefix.py
Outdated
import discord | ||
|
||
import vacefron | ||
|
||
from discord.ext import commands | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import discord | |
import vacefron | |
from discord.ext import commands | |
import vacefron | |
import discord | |
from discord.ext import commands | |
There was a problem hiding this comment.
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?
example/discord_bot/basic_slash.py
Outdated
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("") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as other example.
There was a problem hiding this comment.
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?
Wait |
I jusy marked as resolved and still shows that ,aka the changzs are not merged |
Co-authored-by: Soheab_ <[email protected]>
Co-authored-by: Soheab_ <[email protected]>
Co-authored-by: Soheab_ <[email protected]>
Co-authored-by: Soheab_ <[email protected]>
Co-authored-by: Soheab_ <[email protected]>
@Soheab |
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.