Saravanan666/pypi-org huggingface dataset:
Package: interaction
InteractionInteraction is a Python package for creating nice and colourful progress bars using the map() and apply() method as well as for loops.ProgressBarTo use a progress bar you need to initiate a ProgressBar object with the maximum progress amount (total) and call the show method of the object with the amount to update the progress bar.frominteractionimportProgressBarfromtimeimportsleepbar=ProgressBar(total=100)foriinrange(100):sleep(0.05)bar.show(amount=i+1)You can also add your own text to the progress bar.frominteractionimportProgressBarfromtimeimportsleepbar=ProgressBar(total=100)foriinrange(100):sleep(0.05)bar.show(amount=i+1,text=f'working on{i}')mapYou can also use the ProgressBar's map method instead of Python's map method. The output is an iterable. As soon as you turn the iterable object into a list the progress bar will be displayed.frominteractionimportProgressBarfromtimeimportsleeplist1=list(range(100))defwait_and_double(x,wait_time):sleep(wait_time)returnx*2# this will not make the progress bar appeariterable2=ProgressBar.map(function=lambdax:wait_and_double(x=x,wait_time=0.05),iterable=list1)# this will make the progress bar appearlist2=list(iterable2)applyProgressBar also works with Panda's DataFrame and Series objects.frominteractionimportProgressBarfromtimeimportsleepfrompandasimportDataFramedata=DataFrame({'name':['Arminius','Boudica','Alaric','Attila','Genseric'],'ethnicity':['German','Celt','Goth','Hun','Vandal']})data['name_and_ethnicity']=ProgressBar.apply(data=data,function=lambdax:x['name']+' the '+x['ethnicity'])data['name_lower']=ProgressBar.apply(series=data['name'],function=lambdax:x.lower())iterateYou can also use ProgressBar to for iterating over iterable objects, especiallyforloops.frominteractionimportiterateforiiniterate(range(100)):# do somethingpass
Package: interaction-engine
READMEA framework for turn-taking interactions.ExampleThis is fromexample.py, using the terminal interface, and demonstrates several things:A plan-based structure that uses graphs to direct content flowTextual variation, including ordered variation in for the pschology questionsWriting user input to a databaseReading from the database to populate textError checking through tests that are run on data input, including automatically
displaying an error message, if the user gives an invalid inputConfirmation of valid user input, which is achieved by specifying a boolean argument
when creating the messageThe use of a generic interface class that is extended to make this interaction display
on the terminal=====================
Hola
 0. Hi
>>> 0
=====================
What's your name?
>>> AJ
=====================
'AJ', right?
 0. Yes
 1. No
>>> 1
=====================
What's your name?
>>> Audrow
=====================
'Audrow', right?
 0. Yes
 1. No
>>> 0
=====================
Alright, Audrow, how old are you?
>>> 1000
=====================
Enter a number between 0 and 200
 0. Okay
 1. Oops
>>> 0
=====================
Alright, Audrow, how old are you?
>>> 27
=====================
How are you?
 0. Good
 1. Okay
 2. Bad
>>> 0
=====================
How do you feel about the following statement? 'I am the life of the party'
 0. Strongly agree
 1. Agree
 2. Neutral
 3. disagree
 4. Strongly disagree
>>> 1
=====================
How do you feel about the following statement? 'I am always prepared'
 0. Strongly agree
 1. Agree
 2. Neutral
 3. disagree
 4. Strongly disagree
>>> 1
=====================
How do you feel about the following statement? 'I get stressed out easily'
 0. Strongly agree
 1. Agree
 2. Neutral
 3. disagree
 4. Strongly disagree
>>> 3
=====================
Bye
 0. Bye
 1. See ya!
>>> 1
=========================
Currently in the database
{'answers': ['Agree',
             'Agree',
             'disagree'],
 'question_idx': 3,
 'user_age': 27.0,
 'user_name': 'Audrow'}SetupOption 1: Clone the repositoryBest if you want to modify or view the code - note that you can do the following inside of a virtual environmentgit clone https://github.com/robotpt/interaction-engineAn easy way to setup the repository with its dependencies and with your Python path
is to usepip.pip install -e interaction-engineTests can be run with the following commands.cd interaction-engine
python3 -m unittestOption 2: Use PipBest if you just want to use itpython3 -m pip install interaction_engine
Package: interactionfreepy
InteractionFree for PythonInteractionFreeis a remote procedure call (RPC) protocol based onZeroMQ. It allows the developers to build their own distributed and cross-languige program easily. The protocol is config-less and extremly easy to use. Currently,Msgpackis used for binary serialization. InteractionFree implementation is already available in various languages (including Scala, Javascript, Arduino). More infomation will be available soon.InteractionFree specification: to be drafted.Quick StartInstall$pipinstallinteractionfreepyStart the serverfrominteractionfreepyimportIFBrokerbroker=IFBroker('tcp://*:port')IFLoop.join()replaceportto any port number that is available.IFLoop.join()is a utility function to prevent the program from finishing.Start a workerfrominteractionfreepyimportIFWorkerclassTarget():deftick(self,message):return"tack%s"%messageworker=IFWorker('tcp://address:port','TargetService',Target())IFLoop.join()replaceaddressandportto the server's net address and port.Start a clientfrominteractionfreepyimportIFWorkerclient=IFWorker('tcp://address:port')print(client.TargetService.tick('now'))
Package: interactiongrader
interaction-graderPython package to help grade test questions (interactions) using fuzzy match and phoneme replacement.The Answer class can be used to check if an answer is basically identical to the desired answer except
for misspellings.frominteractiongraderimportAnswerans=Answer('Joaquim Phoenix')ifans.is_misspelling('Joakim Pheonix'):print('Correct Answer')Package Dependencies:fuzzywuzzypython-Levenshteinnumpypandasrandomenum
Package: interactions-cooldowns
installingpip install interactions.cooldownscooldownsThis is a quickstart and api docs for this moduleQuickstartimportinteractionsimportinteractions.ext.cooldownsguild_id=0token=""#create botbot=interactions.Client(token=token)#create function on cooldown failasyncdeferror(ctx,t):awaitctx.send(f"Wait{t}secconds")#command@bot.command(name="test",description="This is the first command I made!",scope=guild_id,)#define cooldown function and time of cooldown@cooldowns.cooldown(error,10,"user")asyncdefmy_first_command(ctx:interactions.CommandContext):awaitctx.send("Hi there!")#start botbot.start()apicooldown.cooldown()errorerror function, leaveNonefor placeholdertimetime of cooldowntypeguilduserchannel_clean_timerscleans all timers
Package: interactions-dbl
interactions-dblDBL (Discord Bot Lists) extension library for discord-py-interactions.Find the supported bot listingshere.FeaturesUpdate server count on most of the bot listings.Installationpipinstallinteractions-dblExamplesUsingbot.pyimportinteractionsfrominteractions.ext.dblimportDBLClientfromconfigimportBOT_TOKEN,TOPGG_TOKEN,DBL_TOKENif__name__=='__main__':bot=interactions.Client(token=BOT_TOKEN,intents=interactions.Intents.DEFAULT)@bot.eventasyncdefon_ready():auth={"top.gg":TOPGG_TOKEN,"discordbotlist.com":DBL_TOKEN}DBLClient(bot,auth=auth)bot.start()Using cogsimportinteractionsfrominteractions.ext.dblimportDBLClientfromconfigimportTOPGG_TOKEN,DBL_TOKENclassUpdateCount(interactions.Extension):def__init__(self,bot):self.bot:interactions.Extension=botauth={"top.gg":TOPGG_TOKEN,"discordbotlist.com":DBL_TOKEN}DBLClient(self.bot,auth=auth)defsetup(client):UpdateCount(client)
Package: interactions-dynamic-help
Dynamic HelpDescriptionA dynamically generated help command for interactions.py that allows for >100 character command descriptionsUsageInstall via pypipipinstallinteractions-dynamic-helpThen load the extension into your botfrominteractionsimportClientbot=Client()...bot.load_extension("interactions.ext.dynhelp")bot.start("Token")Using longer descriptionsLonger description is done with a docstring.If you are using a docstring longer than 100 chars, you MUST provide a description in the slash_command,
otherwise the docstring will be used as the descriptionfrominteractionsimportClient,slash_commandbot=Client()@slash_command(name="test",description="This is a test command",)asyncdeftest(ctx):"""This is a test command (parsed as a short description and ignored if a long description is provided)This is a longer description that will be used in the help command and is longer than 100 chars- this is parsed as part of the long description"""awaitctx.respond("Test")bot.load_extension("interactions.ext.dynhelp")bot.start("Token")You can specify to combine the short and long description by addingcombine=Trueto the decoratorbot.load_extension("interactions.ext.dynhelp",combine=True)Skipping commands and/or optionsBy defualt thectxandbotparameters are skipped, but you can skip more by addingskip_comsadnskip_optsto
the decoratorbot.load_extension("interactions.ext.dynhelp",skip_coms=["test"],skip_opts=["test"])Custom args to the paginatorThese can be added by addingpaginator_argsto the decorator, your args will be added to the default args which are{"ephemeral":true,"delete_after":60}bot.load_extension("interactions.ext.dynhelp",paginator_args={"timeout":60})
Package: interactions-fastapi
FastAPI wrapper for interactions.pyAn Extension library to add Fast API for your interactions.py bot .Installationpip install git+https://github.com/Damego/interactions-fastapi.gitExamplesimportinteractionsfrominteractions.ext.apiimportsetupclient=interactions.Client(...)api=setup(client)@api.route("GET","/")asyncdefindex():return{"status":"success"}client.start()Server will run on127.0.0.1:32512(host and port modifiable)More examples inexamplesfolder.
Package: interactions-files
interactions-filesAn extension library for interactions.py allowing files in interaction responses.Table of ContentsInstallationInformationQuickstartDocumentationInstallationpipinstall-Uinteractions-filesInformationThis isinteractions-files, an extension library for interactions.py allowing files in interaction responses.By default, interactions.py does not allow you to send files inCommandContextandComponentContext. This extension exists to solve that problem by addingfilesfield to the.send()and.edit().QuickstartYou can loadinteractions-fileslike every other Extension by using:client.load('interactions.ext.files')After that, you can start sending files in Context. For example of doing this, go tothis.Alternatively, you can use the functions provided by the Extension. Take a look at an example below:importioimportinteractionsfrominteractions.ext.filesimportcommand_sendclient=interactions.Client(token="Pfft!")@client.command(name="file",description="Send a file.",)asyncdef_test(ctx:interactions.CommandContext):txt=io.StringIO("This is a text file.")file=interactions.File(filename="file.txt",fp=txt)awaitcommand_send(ctx,"Below is a file.",files=file)client.start()For more information on the fuctions, check out the documentation.Documentation
Package: interactions-help
interactions-helpWIP: This extension is currently work-in-progress, which means it might not function well.InstallationInstall from PyPipip install -U interactions-helpInstall from githubpip install git+https://github.com/ItsRqtl/interactions-help.gitBuild from sourcegit clone https://github.com/ItsRqtl/interactions-help.gitcdinteractions-help
pip install .UsageLoading the extensionfrominteractionsimportClientclient=Client(token="...")client.load("interactions.ext.help")client.start()Default configurationConfigurate the help commandTo configurate the help command, simply pass the values when you load the extension.client.load("interactions.ext.help",embed_color=0x00FF00,ephemeral=True,subcommands=True)PaginationDo you have a long list of commands? Now you can paginate it withdinteractions-paginator!
To paginate the help command, putpagination=Truewhen you load the extension.client.load("interactions.ext.help",pagination=True)To customize the paginator, do the following:frominteractions.ext.helpimportPaginatorFormat...client.load("interactions.ext.help",pagination=True,paginator_format=PaginatorFormat(...))PaginatorFormat has exactly the same params asPaginatorexcept:it does not takefunc_before_editandfunc_after_edituse_selectis forced to be False (the title is the same across pages)clientandctxwill be applied itselfParameters for client.loadParameterTypeDescriptionDefault valueconsider_scopeOptional[bool]Only show commands that is available in guildTrueconsider_permissionsOptional[bool]Only show commands that the user can useTrueembed_titleOptional[str]Title of the embedHelpembed_descriptionOptional[str]Description of the embedHere is a list of all commandsembed_colorOptional[int]Color of the embed0x000000embed_footerOptional[EmbedFooter]Footer of the embedNoneembed_timestampOptional[bool]Whether to add a timestamp to the embedFalseephemeralOptional[bool]Whether the response is ephemeral (ignored if pagination is enabled)FalsesubcommandsOptional[bool]Whether to show subcommandsTrueignore_classOptional[List[str]]List of names of extension class to ignore[]ignore_commandOptional[list[str]]List of names of commands to ignore[]paginationOptional[bool]Whether to paginate the help commandFalsepaginator_formatOptional[PaginatorFormat]Format of the paginator (ignored if pagination is disabled)PaginatorFormat()no_categoryOptional[str]Name of the category for commands with no category (not in a class)No category
Package: interactions-i18n
interactions-i18nAdd localization support to your interactions.py botInstallationpip uninstall discord-py-interactionspip install git+https://github.com/interactions-py/library.git@4.4.0-beta.1pip install --upgrade interactions-i18nUsageimportinteractionsfrominteractions.ext.i18nimportsetupclient=interactions.Client(...)# Load an i18n extensioni18n=setup(client)...# your cool commands and cogs loads# Load a folder with localizationi18n.load("./locales/de")client.start()Usage in ExtensionfrominteractionsimportExtensionfrominteractions.ext.i18nimportLocalizationclassMyExt(Extension):def__init__(self,client):self.client=clientself.i18n:Localization=self.client.i18nCreating localization filesChoose a language you want and find their code in theDiscord Locales DocsCreate a[CODE]folder with found code and put it in the folder with locales.Create two files. First iscommands.jsonfor your commands and second iscustom.jsonfor anything you wantExampleLet's create a command with nameinfowith some subcommands@client.command()asyncdefinfo(ctx:interactions.CommandContext):...@info.group()asyncdefmy_group(ctx:interactions.CommandContext):...@my_group.subcommand()@interactions.option()asyncdefuser(ctx:interactions.CommandContext,member:interactions.Member):loc=i18n.get_translate("some_key",ctx.locale)awaitctx.send(loc)Structure of json fileslocales/de/commands.jsonThis file will contain localizations for your commands{"info":{// command name"name":"...",// localized name"description":"...",// localized description"options":{// options of command. Command groups and subcommands are options btw"my_group":{"name":"...","description":"...","options":{"user":{"name":"...","description":"...","options":{"member":{"name":"...","description":"...",// if your option have choices you can do:"choices":{"choice_name":"..."}}}}}}}}}locales/de/custom.jsonThis file will contain your custom localizations for anything{"SOME_KEY":"Some value"}Automatic file generationIt seems difficult to write every command in the json, so you can generate file with your commands.
You need to only fill empty strings with your languagefrominteractionsimportClient,Localefrominteractions.ext.i18nimportsetupbot=Client(...)i18n=setup(bot)# i18n.load("./locales/de")...# your cool commands# call this function in the end of main filei18n.generate_files(Locale.GERMAN,"./locales/")# bot.start()  # comment line where starts your bot
Package: interactions-lavalink
interactions-lavalinkInstallationDownload ext viapip install --upgrade interactions-lavalinkConfiguring own lavalink serverDownload Java SE if you don't have itDownload lavalink fromthis repoConfigureapplication.ymlfile likehereRun lavalink server viajava -jar Lavalink.jarin same folder withapplication.ymlfile.UsageCreate bot like example and run it.Main file:frominteractionsimportClient# Creating bot variableclient=Client()# Loading your extensionclient.load("exts.music")# Starting botclient.start("TOKEN")Extension file:exts/music.pyfrominteractionsimportExtension,SlashContext,listen,slash_command,slash_optionfrominteractions_lavalinkimportLavalinkfrominteractions_lavalink.eventsimportTrackStartclassMusic(Extension):def__init__(self,client):self.client=clientself.lavalink:Lavalink|None=None@listen()asyncdefon_startup(self):# Initializing lavalink instance on bot startupself.lavalink:Lavalink=Lavalink(self.client)# Connecting to local lavalink serverself.lavalink.add_node("127.0.0.1",43421,"your_password","eu")@listen()asyncdefon_track_start(self,event:TrackStart):print("Track started",event.track.title)@slash_command()@slash_option("query","The search query or url",opt_type=3,required=True)asyncdefplay(self,ctx:SlashContext,query:str):awaitctx.defer()# Getting user's voice statevoice_state=ctx.author.voiceifnotvoice_stateornotvoice_state.channel:returnawaitctx.send("You're not connected to the voice channel!")# Connecting to voice channel and getting player instanceplayer=awaitself.lavalink.connect(voice_state.guild.id,voice_state.channel.id)# Getting tracks from youtubetracks=awaitplayer.search_youtube(query)track=tracks[0]# Adding track to the queueplayer.add(requester=int(ctx.author.id),track=track)# Check if player is already playingifplayer.is_playing:returnawaitctx.send(f"Added to queue: `{track.title}`")# Starting playing trackawaitplayer.play()awaitctx.send(f"Now playing: `{track.title}`")@slash_command()asyncdefleave(self,ctx:SlashContext):# Disconnecting from voice channelawaitself.lavalink.disconnect(ctx.guild.id)awaitctx.send("Disconnected",ephemeral=True)EventsTo listen lavalink event you have to use@listendecorator.frominteractionsimportExtension,listenfrominteractions_lavalinkimportTrackStart,TrackEnd,QueueEndclassMusicExt(Extension):...# Some your cool music commands# There are many useful events for you. You can use other events if you want it.@listen()asyncdefon_track_start(self,event:TrackStart):"""Fires when track starts"""print(f"Track{event.track.title}started")@listen()asyncdefon_track_end(self,event:TrackEnd):"""Fires when track ends"""@listen()asyncdefon_queue_end(self,event:QueueEnd):"""Fires when queue ends"""More events you could find in thelavalink.pydocumentationDocumentationlavalink.py documentationlavalink.py repository
Package: interactions-message-commands
interactions-message-commandsMessage commands extension for discord-py-interactionsREADME IS NOT FINISHED YET BUT IT IS A GOOD STARTInstallationpip install -U interactions-message-commandsUsageHere is the example code for how to use message commands:importinteractionsfrominteractions.ext.message_commandsimportMessageCommands,MessageContextbot=interactions.Client(token="token here")cmd=MessageCommands(bot,"!")@cmd.message()asyncdefping(ctx):awaitctx.send("pong")@cmd.message(name="hello")asyncdefhi(ctx:MessageContext,name:str):awaitctx.send(f"Hello,{name}!")bot.start()First, you need to initialize your client.Next, you need to initializeMessageCommands().Multiple string prefixes in a list, tuple, or set is also allowed!Then, you need to register your message commands.@cmd.message(): register a message commandOnly keyword argument at the time isnameto override function namenameis optional, if not specified, the function name will be usedIn the function,ctxis required.You can have as many arguments and keyword arguments as you want!*argsis supported, but not**kwargs. However,*,is supported.Finally, start the bot.Use message commands in the Discord chat, and the bot will respond!Example:!pingor!hello JohnThere is alsowhen_mentioned()andwhen_mentioned_or()for the prefix:frominteractions.ext.message_commandsimportMessageCommands,when_mentioned_orcmd=MessageCommands(bot,when_mentioned_or("!","?"))
Package: interactions-molter
Molter for interactions.py.An extension library for interactions.py to add prefixed (AKA text-based or 'message') commands. This is a demonstration ofthe Molter framework, a framework for adding prefixed commands into Discord Python libraries.This attempts to make the prefixed command experience much likediscord.py's prefixed commands, though it isnot1:1 on purpose.NOTE: This extension is primarily developed byAstrea49.Installationpip install interactions-molterDocumentationDocumentation, including examples and an API reference, for themainbranch (and so the latest PyPI version) can be found atits respective Github Page.For documentation for the other branches, you can look for the respective documentationon the home page.Branch ExplanationThemainbranch is the PyPI version - this branch will never deviate from it. This is done to make sure the PyPI page's example links link to the right code.Thebetabranch is code considered code that is stable enough to use in daily use, though it is not perfect. This branch also will target any beta, pre-release, or release candidate version ofinteractions.py, if possible.Thedevbranch mirrorsinteractions.py'sunstablebranch, and is also a general testing ground for new and experimental changes.Bugs are common on this branch. If you decide to use this branch, I highly suggest pinning to a specific commit you know is stable.Thegh-pagesbranch powers the documentation website, and has no Molter-related code in it.CreditThanks to bothNAFFandToricane'sinteractions-message-commandsfor a decent part of this! They both had a huge influence over how this port was designed.
Package: interactions-persistence
PersistenceAn extension for interactions.py that dynamically places and returns objects in and from Discord'scustom_idsso you don't have to. Check thewikito learn how to use it!How it worksThe most popularinteractions.pyextension,Wait-Foris an easy and effective way to simplify complex component chains by preserving the objects used during interaction.
However, this means that any components created before the bot restarts become unresponsive.
This could be solved by saving all previous needed interaction details to the disk, but that may not be an ideal solution for everyone. Luckily, there is another option.The solutionThe solution, originally conceived and executed byToricane, was to place information in Discord's custom_ids. In the vanilla library, this requires someon_componentoron_modallogic.Enhancedsimplifies this by addingstartswithandregexargs to thebot.componentandbot.modaldecorators. However, even this is more complicated than necessary.Further abstractionInteractions-Persistence further simplifies placing objects in custom_ids using the json and allowing str, int, float, dict and list. The extension also encrypts custom_ids so it isn't obvious what they are doing. Using this ext is not only incredibly simple, but also reliable and lightweight. Taking a similar approach toEnhanced, Persistence useson_componentandon_modallisteners to identify and properly call persistent decorators.Enjoy!