Saravanan666/pypi-org huggingface dataset:
Package: discord-ext-utils
discord-ext-utilsa collection of utils I use with discord.pyThis repo includesglobal view error handler globalglobal modal error handlerglobal view interaction_checkCodeblockConverterBaseConverterCustom bot subclasssend_messageGuide/wiki/docsglobal view error handlerTo use it, simply subclass our view class instead ofdiscord.ui.View. (or if your using a modal, our modal class instead ofdiscord.ui.Modal)
After that, our subclass will callon_view_error(oron_modal_error) thenview.on_error(ormodal.on_error) in the case of an errorrrr.global view interaction_checkTo use it, simply subclass our view class instead ofdiscord.ui.View.
Our subclass will callbot.interaction_check(if it exists) which acts likeview.interaction_check. If it returnsTrue, then it will checkview.interaction_check.BaseConverterWe have a base converter class which allows you to easily make converters which work for slash, prefix, and hybrid cmds.
Example:classMyConverter(BaseConverter):asyncdefhandle(self,ctx_or_interaction,arg)->str:# handlereturnagCodeblockConverterCodeblockConverteris actually antyping.Annotatedstatement, which returnsCodeblock(a dataclass withcodeandlanguage). For the actual converter, seeActualCodeblockConverter.Custom bot subclassWe have a custom bot subclass which you can subclass and use. It contains a re-populated session attribute, and abot.load_extensionsmethod which can either take a list of extensions or a folder which your extensions reside in. It will then load them, and if there is an error it will send it via logs. It also has asetup_loggingmethod, which is auto-called when callingbot.run/start.send_messagethis helper func lets you easily send a message. It takes a pos-only arg which is the destination. This could be a context object, interaction, channel, member, webhook, or a messageable. It also takes every kwarg any send method takes, and if a certain method does not support a kwarg it will drop it.
Package: discord-ext-wizards
discord-ext-wizardsA module for creating setup wizards easily.Example UsageBelow is an example usage of discord-ext-wizards to create an interactive embed builder.importdiscordfromdiscord.extimportwizards,commandsclassEmbedBuilderWizard(wizards.Wizard):def__init__(self):self.result={}super().__init__(cleanup_after=False,timeout=30.0)# register an action, so users can type "stop" or "cancel" to stop# the wizard@wizards.action("stop","cancel")asyncdefcancel_wizard(self,message):awaitself.send("Wizard Cancelled.")awaitself.stop(wizards.StopReason.CANCELLED)@wizards.step("What should the embed title be?",position=1)asyncdefembed_title(self,message):self.result["title"]=message.content@wizards.step("What should the embed description be?",timeout=180.0,# override the default timeout of 30position=2,)asyncdefembed_description(self,message):length=len(message.content)iflength>2000:awaitself.send(f"That description is{length}chars, but the maximum is 2000.")returnawaitself.do_step(self.embed_description)# redo the stepself.result["description"]=message.content@wizards.step("Type 1 to add a field, or 2 to move on.",position=3,)asyncdefembed_fields(self,message):self.result.setdefault("fields",[])ifmessage.content=="2":pass# move on to the next stepelifmessage.content=="1":field_name=awaitself.do_step(self.embed_field_name)field_value=awaitself.do_step(self.embed_field_value)field_inline=awaitself.do_step(self.embed_field_inline)self.result["fields"].append((field_name,field_value,field_inline))# repeat the step, so users can add multiple fieldsreturnawaitself.do_step(self.embed_fields)else:awaitself.send("Please choose 1 or 2.")returnawaitself.do_step(self.embed_fields)@wizards.step("What should the field name be?",call_internally=False,)asyncdefembed_field_name(self,message):returnmessage.content@wizards.step("What should the field description be?",call_internally=False,)asyncdefembed_field_value(self,message):returnmessage.content@wizards.step("Should the field be inline?",call_internally=False,)asyncdefembed_field_inline(self,message):ifmessage.content.lower().startswith("y"):returnTrueelifmessage.content.lower().startswith("n"):returnFalseelse:awaitself.send("Please choose yes or no.")returnawaitself.do_step(self.embed_field_inline)bot=commands.Bot("!")@bot.command()asyncdefembed(ctx):wizard=EmbedBuilderWizard()awaitwizard.start(ctx)result=wizard.resultembed=discord.Embed(title=result["title"],description=result["description"],)forname,value,inlineinresult["fields"]:embed.add_field(name=name,value=value,inline=inline)awaitctx.send(embed=embed)bot.run("TOKEN")See here for the output of the code:https://circuit.is-from.space/kox47xokm9a.mov
Package: discord-feed-bot
RSS FeedDiscord bot for automating RSS feed updates.Installationpipinstalldiscord-feed-botFeaturesGet RSS Feed from URL/FileGet Metadata from RSS FeedGet Items from RSS FeedAuto Update RSS Feed on DiscordUsageCheck out thedocumentationfor more information on how to use RSS Feed.fromdiscord_extimportDiscordBotfeed_url=""discord_webhook_url=""sleep_time=60*20# 20 minutesbot=DiscordBot(feed_url,discord_webhook_url,interval=sleep_time)bot.send_message_to_discord()ContributingPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.Please make sure to update tests as appropriate.LicenseGNU General Public License v3.0AuthorsDeepak Raj
Package: discord-file-database
インストールpip install -U discord-file-databaseデータベースの作成この関数はデータベースを作成する一度のみ使用awaitcreate_db(client,channel_id,file_type)client - commands.Bot / discord.Clientchannel_id - discord.TextChannel.id データベースとするチャンネルのIDfile_type - str / int / float / dict / list 保存したい型実行結果：>>><messageid>この数値はconnect関数を使用する際に必要ですデータベースに接続awaitconnect(bot,channel_id,message_id)返り値を必ず受け取ってください。この説明では返り値をconnで表しています。bot - commands.Bot / discord.Clientchannel_id - discord.TextChannel.id データベースとするチャンネルのIDmessage_id - discord.Message.id create_db関数で取得した数値内容を取得awaitconn.content()内容を編集awaitconn.edit(after_content)after_content - file_type 編集後の内容データベースを削除awaitconn.remove_db()
Package: discord-game
discord.py-game-engineA game engine for discordHow to useIf you want to see some examples gohereor follow almong this tutorial to get a basic understanding of how this module works.Start by importing the moduleimportdiscord_gamefromdiscord_gameimportscreenYou will also need the discord libary to create the clientimportdiscordThen you can start by creating the discord clientclient=discord.Client()Now you can create the game and set its startcommand. Our is!startgame=discord_game.Game(client,"!start")Use theonStartevent to run code when someone starts the game. TheonBotReadyruns when the bot/client is ready.@game.event.onStartasyncdefonStart(display):print("The game is started")@game.event.onBotReadyasyncdefready():print("bot is ready")Don't forget to addclient.run(token)at the end of the fileclient.run("Your token")You can create a sprite like thismySprite=screen.Sprite(display,["costume","with","multiple rows"],0,0)# and lastly x and y posThen you will need to update the displayawaitdisplay.update()To create a button you do it like thismyButton=awaits.addButton("Click me!")To get a button click put this code inside the onstart function@myButton.onClickasyncdefclicked(btn):print("You clicked me!")The complete codeimportdiscord_gamefromdiscord_gameimportscreenimportdiscordclient=discord.Client()game=discord_game.Game(client,"!start")@game.event.onStartasyncdefonStart(display):print("The game is started")@game.event.onBotReadyasyncdefready():print("bot is ready")mySprite=screen.Sprite(display,["costume","with","multiple rows"],0,0)# and lastly x and y posawaitdisplay.update()myButton=awaits.addButton("Click me!")@myButton.onClickasyncdefclicked(btn):print("You clicked me!")client.run("Your token")
Package: discord-github-release-notifier
.. image:: https://github.com/FFY00/discord-github-release-notifier/raw/master/logo.png=======================Discord Github Release Notifier=======================.. image:: https://img.shields.io/github/release/FFY00/discord-github-release-notifier.svg:alt: latest release:target: http://github.com/FFY00/discord-github-release-notifier/releases.. image:: https://img.shields.io/pypi/v/discord-github-release-notifier.svg:alt: latest release:target: https://pypi.org/project/discord-github-release-notifier/This a fork of `femtopixel <https://github.com/femtopixel>`_'s `Github Release Notifier <https://github.com/femtopixel/github-release-notifier>`_ with the notifications adapted to Discord.Installation------------.. code::pip3 install discord-github-release-notifierUsage-----.. code::usage: discord-github-release-notifier [-h] [--action {cron,subscribe,unsubscribe}][--package PACKAGE] [--webhook WEBHOOK] [--uuid UUID]optional arguments:-h, --help            show this help message and exit--action {cron,subscribe,unsubscribe}, -a {cron,subscribe,unsubscribe}Action to do (default: cron)--package PACKAGE, -p PACKAGEGithub package name / url (required forsubscribe/unsubscribe) - prints uuid on subscription--webhook WEBHOOK, -w WEBHOOKURL to your webhook (required forsubscribe/unsubscribe)--uuid UUID, -u UUID  UUID of your webhook (required for unsubscribe)Example~~~~~~~First, I register my webhook :.. code::discord github-release-notifier --action subscribe --webhook https://discordapp.com/api/webhooks/{webhook.id}/{webhook.token} --package jaymoulin/google-music-manageran UUID is printed. this UUID will be required to unsubscribe the webhook.When `jaymoulin/google-music-manager` releases a new version, `https://discordapp.com/api/webhooks/{webhook.id}/{webhook.token}` will be called with the release details.For this to happen, the system should check if a new version have been released.We can do that by calling `discord-github-release-notifier` without any parameter or setting `--action` to `cron` (which is default).To automate this process, we could add this process in a cronjob:.. code::(crontab -l ; echo "0 0 * * * discord-github-release-notifier") | sort - | uniq - | crontab -This will check every day at midnight if new versions have been released.Submitting bugs and feature requests------------------------------------Bugs and feature request are tracked on GitHubAuthor------Jay MOULIN jaymoulin+github-release-notifier@gmail.com See also the list of contributors which participated in this program.Filipe LAÍNS filipe.lains@gmail.com (adaptatiion to discord)License-------Discord Github Release Notifier is licensed under the MIT License
Package: discord-handler
DiscordHandlerThis class is using the integrated logging class from Python andrequestsfrom PyPi.Feel free to change and add some good stuff.InstallingInstall and update using pip:pip install discord-handlerRequirementsInstalling requests:pip install requestsGet Started:First you need Discord or some Channels, where you have access to create a new Webhook.You find Webhooks options in the channel settings. Create a new Webhook and copy theWebhook Url. Note: Do NOT give this URL out to the public like me in previous commits. (I changed it :P )You can test the logging class by using theTest file.If u want to know, how to send messages via POST andrequeststo Discord you can see an example inDiscord file.Attention:Discord only allows 2 000 characters, so you might get trouble when using large messages. To limit
the length of the message usemax_sizein the constructor. See Example below.
Thanks toracinmatfor the implementation.Mentions:To use mentions use the paramter notify_users. You can useeveryonewithout id and private mentions with id.
To get your user id you need to activate the developer mode and right click on your name.Example:fromdiscord_handlerimportDiscordHandlerwebhook_url="Your Webhook here"agent="My Application"logger=logging.getLogger("My Application")logger.setLevel(logging.DEBUG)# Create formatterFORMAT=logging.Formatter("%(asctime)s-%(name)s-%(levelname)s-%(message)s")# Create DiscordHandler and StreamHandler# This will mention everyone. You can use your id here for private mentions.# Emits log as raw text, so strings can contain Discord markdown formatting such as __underline__ or **bold**notify_users=['everyone']discord_handler=DiscordHandler(webhook_url,agent,notify_users=notify_users,emit_as_code_block=False,max_size=20000)stream_handler=logging.StreamHandler()# Add log level to handlersdiscord_handler.setLevel(logging.WARNING)stream_handler.setLevel(logging.DEBUG)# Add format to handlersdiscord_handler.setFormatter(FORMAT)stream_handler.setFormatter(FORMAT)# Add the handlers to the Loggerlogger.addHandler(discord_handler)logger.addHandler(stream_handler)logger.debug("Logger created")For more Infos:Logging Cookbook
Package: discordhealthcheck
Discord Health CheckA small Python 3 library and command line app to automate Docker health checks fordiscord.pybots.Installationpip install discordhealthcheckThis will install both the Python library and the command line app, the python library is importable usingimport discordhealthcheckand the CLI app by using the commanddiscordhealthcheck.How It Works & Usage ExamplesPython Library (Server)The library has 1 function,start.starttakes adiscord.Clientobject as well as optional parameters, and returns an awaitable that produces aasyncio.base_events.Server:defstart(client:discord.client,port:int=40404,bot_max_latency:float=0.5)->Awaitable[asyncio.base_events.Server]startcallsasyncio.start_server, creating an asyncio TCP socket server which listens for connections. Once a client connects, it tests the discord client for various things that indicate its health (latency, login status, etc.), and the result of this health check is then sent to the healthcheck client.The returnedServerobject can be used to stop the server (e.g.healthcheck_server.close())The default port for the socket server is40404, if you change it you will need to use the--portflag on the client as well.Callstartonce your event loop is running, generally a good place to call from is inside yoursetup_hookmethod:importdiscordimportdiscordhealthcheckclassCustomClient(discord.Client):def__init__(self,*args,**kwargs):super().__init__(*args,**kwargs)asyncdefsetup_hook(self):self.healthcheck_server=awaitdiscordhealthcheck.start(self)# Later you can close or check on self.healthcheck_serverCLI App (Client)The CLI app is a simple client that connects to the server and determines its exit code from what the server sends;0for healthy,1for unhealthy.Here's an example of using in a Dockerfile:FROMpython:3.11-slim-buster# Copy files, install requirements, setup bot, etc.RUNpipinstalldiscordhealthcheck# The `|| exit 1` isn't required but it's good practice anyway.HEALTHCHECKCMDdiscordhealthcheck||exit1CMD["python","/path/to/bot.py"]
Package: discord-heater
HeaterHeat up a Discord bot in a blinkWhat is Heater?Heater is a Command Line Interface tool which allows you to generate a barebones Python Discord bot project, just in a matter of seconds.Getting StartedInstall Heater by runningpip install discord-heater(once it has been released on PyPi) on your Terminal or Command Prompt.To generate a project, just typediscord-heaterorpython -m discord-heater. Then it will ask you a few questions (name of the project,
dependencies, prefix, etc).Once you are done:Runcdto go into the folder that Heater generates for you.Runpip install -r requirements.txtto install all the dependenciesLastly, runpython bot.pyto run the bot.ContributingIf you are considering to contribute, thanks a lot! We welcome all contributors here and, you can help out as well.
Before contributing, please check out ourCONTRIBUTING.mdandCode of Conductfor more information.
Package: discordhelp
Discord HelperA simple helper library for discord.pyFeaturesgetEmoteFromName(name):
This gets the unicode emoji that corresponds to the discord emoji, like how:grinning:is the grinning emoji when adding reactions.getNameFromEmote(emote):
The exact opposite ofgetEmoteFromNameas this takes in the emoji and gives back the namecreateEmbed(title, text, footer, authour_name, color):
This returns a embed with the inputs givencheckURLs(string):
Returns a bool stating whether there is a url in the stringgetURLs(string):
Returns a list of all URLs in a stringgetTimeSinceMessage(message):
Returns DateTime of time since a message was createdgetColoredText(text, color):
Responds with the formatting corresponding to the color, here are the following colorsredgreendark-greenlight-greenorangeyellowdark-yellowblueVersion & FixesPlease feel free to make fixes and put up issues atthe github repoFixessmall readme formatting
Package: discord-helpers
discord-helpersA helper module for discord.py and its forksCurrent Features (v0.2.0)Invite trackerPer server custom prefixes using SQLite3 - aiosqlitePaginatorA chatbot coroutine function to get a reply from an AI (The Random Stuff API)A cycling status for your botA function to create a rich embed with every feature in a simple line of codeA coroutine function to find a webhook from a channel and send a message via itCoroutine functions for making GET and POST requests easilyInstallation$pipinstall-Udiscord-helpers
$pipinstall-Udiscord-helpers[sqlite]# development$pipinstall-Ugit+https://github.com/Dorukyum/discord-helpers.gitExamplesMore bot examples can be found in theexamplesdirectory.Prefixesimportdiscordfromdiscord.extimportcommands,helpersbot=commands.Bot(command_prefix="!",intents=discord.Intents.all())@bot.eventasyncdefon_ready():bot.db=helpers.Database(bot,"data.db")# also used in the examples belowbot.command_prefix=bot.db.custom_prefix("!")@bot.eventasyncdefon_message(message):ifmessage.mentions[0]==client.user:awaitbot.db.reply_with_prefix(message)@bot.command()asyncdefchange_prefix(ctx,*,prefix):awaitbot.db.change_prefix(ctx.guild.id,prefix)awaitctx.send(f"Successfuly changed the prefix to `{prefix}`.")Chatbot@bot.eventasyncdefon_message(message):ifmessage.channel.id==my_chatbot_channel_id:response=awaithelpers.chatbot(message.content,api_key=my_api_key)awaitmessage.reply(response)Paginator@bot.command()asyncdefsend_pages(ctx):paginator=helpers.Paginator(bot,pages=[discord.Embed(title="Page 1"),discord.Embed(title="Page 2"),])paginator.add_page(discord.Embed(title="Page 3"))awaitpaginator.start(ctx)Webhooks@bot.command()asyncdefsend_webhook(ctx,*,text):awaithelpers.Webhooks.find_and_send(text,channel=ctx.channel,webhook_name="Test")
Package: discord-hero-devtools
Discord Hero Developer Tools is a Debugging and Experimenting extension for Discord Hero. You can load, reload and unload extensions.Legal stuffDiscord is a registered trademark of Discord Inc.Except as otherwise noted, Discord Hero Developer Tools is
licensed under the Apache License, Version 2.0 (LICENSE.Apache-2.0orhttp://www.apache.org/licenses/LICENSE-2.0) or
the MIT license (LICENSE.MITorhttp://opensource.org/licenses/MIT), at your option.Unless you explicitly state otherwise, any contribution intentionally
submitted for inclusion in the work by you, as defined in the
Apache-2.0 license, shall be dual licensed under the Apache
License, Version 2.0, and the MIT license, without any
additional terms or conditions.SPDX-License-Identifier: Apache-2.0
Package: discord-hero-scheduler
A Scheduler extension for Discord Hero, allowing you to schedule the execution of Controller methods.
It also comes with a shutdown command that shuts down discord-hero gracefully.Legal stuffDiscord is a registered trademark of Discord Inc.Except as otherwise noted, Discord Hero Scheduler Extension is
licensed under the Apache License, Version 2.0 (LICENSE.Apache-2.0orhttp://www.apache.org/licenses/LICENSE-2.0) or
the MIT license (LICENSE.MITorhttp://opensource.org/licenses/MIT), at your option.Unless you explicitly state otherwise, any contribution intentionally
submitted for inclusion in the work by you, as defined in the
Apache-2.0 license, shall be dual licensed under the Apache
License, Version 2.0, and the MIT license, without any
additional terms or conditions.SPDX-License-Identifier: Apache-2.0 OR MIT
Package: discord-holo-api
discord-holo-apiRequirementsPython 3.6 and up -https://www.python.org/downloads/Installpip i discord-holo-apiorpip install discord-holo-apiHow to useimportDiscordHoloApiprint(DiscordHoloApi.random("art"))/*Availableendpoint["404, anal, art, ask, avatar, baka, bite, bj, blowjob, boobs, cry, cuddle, cum, dance, ego, ero, erofeet, erok, erokemo, eroyuri, feed, feet, feetg, fox_girl, futanari, glare, hentai_gif, highfive, holo, holoero, hololewd, hug, kemonomimi, kiss, kuni, les, lewd, lick, loli, meow, neko, ngif, nom, pat, poke, pressf, punch, pussy, pwankg, sex, slap, slappope, smug, solo, tickle, tits, trap, waifu, wallpaper, wasted, wink, woof, yuri"]*/LinksWebsiteApi statusGitHubDiscord
Package: discord.http
discord.httpPython library that handles interactions from Discord POST requests.InstallingYou needPython >=3.11to use this library.Install by usingpip install discord.httpin the terminal.
Ifpipdoes not work, there are other ways to install as well, most commonly:python -m pip install discord.httppython3 -m pip install discord.httppip3 install discord.httpQuick examplefromdiscord_httpimportContext,Clientclient=Client(token="Your bot token here",application_id="Bot application ID",public_key="Bot public key",sync=True)@client.command()asyncdefping(ctx:Context):""" A simple ping command """returnctx.response.send_message("Pong!")client.start()Need further help on how to make Discord API able to send requests to your bot?
Check outthe documentationfor more detailed information.ResourcesDocumentationsLibrary documentationDiscord API documentationDiscord serverAcknowledgementsThis library was inspired bydiscord.py, developed byRapptz.
We would like to express our gratitude for their amazing work, which has served as a foundation for this project.
Package: discordify
discordifyA Python package to retrieve detailed Spotify album images for Discord integration.example.pyimportdiscordfromdiscord.extimportcommandsfromdiscordifyimportSpotify,emojify_imagebot=commands.Bot(command_prefix=",",intents=discord.Intents.all(),allowed_mentions=discord.AllowedMentions.none())@bot.command(name="spotify")asyncdef_spotify(ctx:commands.Context,member:discord.Member=None):member=memberorctx.authorclient=Spotify(bot=bot,member=member)content,image,view=awaitclient.get()awaitctx.reply(content=content,file=image,view=view)@bot.command(name="emojify")asyncdef_emojify(ctx,url:Union[discord.Member,str],size:int=14):ifnotisinstance(url,str):url=url.display_avatar.urldefget_emojified_image():r=requests.get(url,stream=True)image=Image.open(r.raw).convert("RGB")res=emojify_image(image,size)ifsize>14:res=f"```{res}```"returnresresult=awaitbot.loop.run_in_executor(None,get_emojified_image)awaitctx.send(result)bot.run("token")Comparision:discordspotify mobile notificationEmojifyEmojify is directly taken and modified fromcodewithswastik/emojify-bot