Skip to main content

Introduction

Documentation can be found here

CIFReplTalk is a repl.it talk bot framework intended for making high-quality asyncio-based bots, This project was inspired by IreTheBOT, a repl.it talk bot made by IreTheKID which now uses the CIFReplTalk framework.

Getting Started

This section is dedicated to getting started with the CIFReplTalk bot framework.

Installation

To install the framework you can either follow the tutorial on the homepage to install the full cif framework or if you would prefer to only install the CIFReplTalk framework by itself read on.

Git

To install CIFReplTalk via the git CLI use the command that follows.

git clone https://github.com/@CIFProject/repltalk

Then cd into your new repltalk directory and run pip install -r requirements.txt to install the necessary dependencies and finally python setup.py install to install the cifrepltalk package for use in your python projects.

Repl.it

It is recommended to use the repl located here to grab your copy of CIFReplTalk from the cifrepltalk and paste it into a cifrepltalk in your own project.

A Simple Bot

Now, let us make a simple repl.it talk bot that responds to a few commands.

import cifrepltalk # import the cifrepltalk package
from datetime import datetime # for time stuff

client = cifrepltalk.Bot(prefix='$[<your prefix here>]') # create an instance of the 'Bot' class

signer = cifrepltalk.Signer('<your bot account's repl.it username>', '<your bot account password>')
token = signer.sign('<your repl.it username>') # get the token

async def hello(ctx, *args):
    return 'hello!'

async def echo(ctx, *args):
    return ' '.join(list(args))

async def date(ctx, *args):
    return str(datetime.now())

client.login(token)
client.handler.assign('hello' hello)
client.handler.assign('echo', echo)
client.handler.assign('date', date)
client.run('<a post id here>')

Let us name this file as examplebot.py, don't name it cifrepltalk or it will conflict with the library.

Here is what this code does:

1. The first line imports the cifrepltalk module for use in the script.

2. The second line imports datetime from the python starndard library datetime for the time command.

3. Next, we create an instance of the Bot class with our chosen prefix and store it in a variable called client.

4. Then, we need to create an instance of the Signer class with our bot's repl.it account username and password and store it in the signer variable.

5. Now we get the token from our signer object by supplying our repl.it username and store it in token.

6. In these nest few lines we define an async function called hello with the required arguments of ctx and the positional arguments gatherer *args, with a return value of 'hello!'.

7. Next, we make another async function called echo with the same required arguments but, this time it returns all of the arguments as a joint string.

8. For this function we make another async function with the same args and a return value of datetime.now() to get the current time.

9. In this line we login with the token stored in token.

10. Next we use client.handler.assign() to assign 'hello' to the function hello.

11. Then we repeat the same step but for 'echo' and echo.

12. Again the same step but for 'date' and date.

13. Finally, we run the bot on a post by id. ( Note: By default CIFReplTalk only runs on a single post, this can be changed. See Custom Handlers )

Now we have made the bot we have to run it.

cmd:

python3 examplebot.py

powershell

py -3 examplebot.py

bash and others:

python3 examplebot.py

Now play around with the bot.

Metadata

Release files for cifrepltalk 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cifrepltalk 0.0.1
File Size Uploaded
cifrepltalk-0.0.1.tar.gz 4.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cifrepltalk 0.0.1
File Interpreter ABI Platform
cifrepltalk-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 9.9 kB

Release files / cifrepltalk-0.0.1.tar.gz

Download URL cifrepltalk-0.0.1.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e706302c0692d0b0c4570e3e0b9f564a31604a63931e3a7e5df89152a2ab1ef1
BLAKE2b-256 checksum
How to use checksums
06daf82e1c77b854f06a60b3654709761b2fcfb4c18ef9f2a928ab6809def6e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.8.0 tqdm/4.46.0 CPython/3.8.3

Release files / cifrepltalk-0.0.1-py3-none-any.whl

Download URL cifrepltalk-0.0.1-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
305e6a5877087c68a47ac292f1e523a74cf3895d7bb44fa1e0c7f294a8babb03
BLAKE2b-256 checksum
How to use checksums
43826b3acb5d029bf8e6cf7563b2a00096f2a49107233a63c7131ad93a8c0fe6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.8.0 tqdm/4.46.0 CPython/3.8.3

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page