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
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
4affbfd
Added an example
lol219 Nov 26, 2022
c01f82e
Update basic_slash.py
lol219 Nov 26, 2022
bcce6fe
Fixed indents , improved the code quality.
lol219 Nov 26, 2022
a0516d4
Added a prefixed command example
lol219 Nov 26, 2022
9dc0967
Mini-Improvement
lol219 Nov 26, 2022
d8c922a
Renamed example with examples
lol219 Nov 26, 2022
bb16d25
Delete examples
lol219 Nov 26, 2022
b109913
Updated gitignore
lol219 Nov 26, 2022
ae7a6ee
Update example/discord_bot/basic_prefix.py
lol219 Nov 27, 2022
0d45f5f
Update example/discord_bot/basic_prefix.py
lol219 Nov 27, 2022
287257e
Update example/discord_bot/basic_prefix.py
lol219 Nov 27, 2022
02630d1
Update example/discord_bot/basic_prefix.py
lol219 Nov 27, 2022
89c557d
Update example/discord_bot/basic_prefix.py
lol219 Nov 27, 2022
60a69f0
Update example/discord_bot/basic_prefix.py
lol219 Nov 27, 2022
34f85fc
My bad | Reverted gitignore change
lol219 Nov 27, 2022
691d2fa
Rename example/discord_bot/basic_prefix.py to example/discord.py/basi…
lol219 Nov 27, 2022
395fa83
Rename example/discord_bot/basic_slash.py to example/discord.py/basic…
lol219 Nov 27, 2022
6d98b0a
Rename example/discord.py/basic_prefix.py to examples/discord.py/basi…
lol219 Nov 27, 2022
8046465
Rename example/discord.py/basic_slash.py to examples/discord.py/basic…
lol219 Nov 27, 2022
2fcca2a
Update basic_prefix.py
lol219 Nov 27, 2022
e88ebe1
Update basic_prefix.py
lol219 Nov 27, 2022
5d15593
Update basic_slash.py
lol219 Nov 27, 2022
ab20991
Cleanup
lol219 Nov 27, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ test.py
test.py
test_api.py


# Visual Studio Code and other IDEs
.idea/
.vscode/*
32 changes: 32 additions & 0 deletions examples/discord.py/basic_prefix.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import vacefron

import discord
from discord.ext import commands


intent = discord.Intents(guilds=True, messages=True, message_content=True)


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


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

bot= MyBot()

@bot.command()
async def peposign(ctx, text: str):
image = await bot.vac_api.peeposign(text)
embed= discord.Embed(title="Peposign")
embed.set_image(url=image.url)
await ctx.send(embed=embed)



bot.run(...)
29 changes: 29 additions & 0 deletions examples/discord.py/basic_slash.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import discord
from discord import app_commands
import vacefron

from discord.ext import commands


class MyBot(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= MyBot()

@bot.tree.command()
async def peposign(interaction: discord.Interaction, text: str):
image = await bot.vac_api.peeposign(text)
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("")