fastdc 1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
fastdc-1.0/PKG-INFO ADDED
@@ -0,0 +1,13 @@
1
+ Metadata-Version: 2.1
2
+ Name: fastdc
3
+ Version: 1.0
4
+ Summary: FastDC: A fast, modular, and AI-integrated Discord bot framework.
5
+ Home-page: UNKNOWN
6
+ Author: Arya Wiratama
7
+ Author-email: aryawiratama2401@gmail.com
8
+ License: UNKNOWN
9
+ Platform: UNKNOWN
10
+ Requires-Python: >=3.10
11
+
12
+ UNKNOWN
13
+
fastdc-1.0/README.md ADDED
@@ -0,0 +1,2 @@
1
+ # fastdc
2
+
@@ -0,0 +1,3 @@
1
+ from .bot import FastBot
2
+
3
+ __all__ = ['FastBot']
@@ -0,0 +1,61 @@
1
+ import discord
2
+ from discord.ext import commands
3
+ from .trainer import FastdcTrainer
4
+
5
+ class FastBot:
6
+ def __init__(self, token: str, prefix: str = "!"):
7
+ self.token = token
8
+ self.bot = commands.Bot(command_prefix=prefix, intents=discord.Intents.all())
9
+ self.trainer = FastdcTrainer()
10
+ self.trainer.train()
11
+
12
+ def auto_reply(self, trigger, response):
13
+ @self.bot.event
14
+ async def on_message(message):
15
+ if message.author.bot:
16
+ return
17
+ if trigger.lower() in message.content.lower():
18
+ await message.channel.send(response)
19
+ await self.bot.process_commands(message)
20
+
21
+ def ai_chat(self, api_key_usr):
22
+ from groq import Groq
23
+
24
+ @self.bot.command()
25
+ async def ai(ctx, *, prompt):
26
+
27
+ client = Groq(api_key=api_key_usr)
28
+
29
+ chat_completion = client.chat.completions.create(
30
+
31
+ messages=[
32
+ {
33
+ "role": "system",
34
+ "content": "you are a helpful assistant."
35
+ },
36
+
37
+ {
38
+ "role": "user",
39
+ "content": prompt,
40
+ }
41
+ ],
42
+
43
+ model="llama-3.3-70b-versatile",
44
+ temperature=0.5,
45
+ max_completion_tokens=1024,
46
+ top_p=1,
47
+ stop=None,
48
+ stream=False,
49
+ )
50
+
51
+ await ctx.send(chat_completion.choices[0].message.content)
52
+
53
+ def train_bot(self):
54
+ @self.bot.command()
55
+ async def askbot(ctx, *, message):
56
+ response = self.trainer.get_response(message)
57
+ await ctx.send(response)
58
+
59
+ def run(self):
60
+ self.bot.run(self.token)
61
+
@@ -0,0 +1,27 @@
1
+ from chatterbot import ChatBot
2
+ from chatterbot.trainers import ListTrainer
3
+ import os
4
+ import spacy
5
+
6
+ try:
7
+ spacy.load("en_core_web_sm")
8
+ except OSError:
9
+ from spacy.cli import download
10
+ print("🔧 Downloading 'en_core_web_sm' model...")
11
+ download("en_core_web_sm")
12
+
13
+ class FastdcTrainer:
14
+ def __init__(self, name="FastdcBot", data_path="data_train.txt"):
15
+ self.chatbot = ChatBot(name)
16
+ self.data_path = data_path
17
+
18
+ def train(self):
19
+ trainer = ListTrainer(self.chatbot)
20
+ if not os.path.exists(self.data_path):
21
+ raise FileNotFoundError(f"Training data file '{self.data_path}' not found.")
22
+ with open(self.data_path, "r", encoding="utf-8") as file:
23
+ conversation = file.read().split("\n")
24
+ trainer.train(conversation)
25
+
26
+ def get_response(self, message):
27
+ return str(self.chatbot.get_response(message))
@@ -0,0 +1,13 @@
1
+ Metadata-Version: 2.1
2
+ Name: fastdc
3
+ Version: 1.0
4
+ Summary: FastDC: A fast, modular, and AI-integrated Discord bot framework.
5
+ Home-page: UNKNOWN
6
+ Author: Arya Wiratama
7
+ Author-email: aryawiratama2401@gmail.com
8
+ License: UNKNOWN
9
+ Platform: UNKNOWN
10
+ Requires-Python: >=3.10
11
+
12
+ UNKNOWN
13
+
@@ -0,0 +1,10 @@
1
+ README.md
2
+ setup.py
3
+ fastdc/__init__.py
4
+ fastdc/bot.py
5
+ fastdc/trainer.py
6
+ fastdc.egg-info/PKG-INFO
7
+ fastdc.egg-info/SOURCES.txt
8
+ fastdc.egg-info/dependency_links.txt
9
+ fastdc.egg-info/requires.txt
10
+ fastdc.egg-info/top_level.txt
@@ -0,0 +1,5 @@
1
+ chatterbot
2
+ discord.py
3
+ groq
4
+ python-dotenv
5
+ spacy
@@ -0,0 +1 @@
1
+ fastdc
fastdc-1.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
fastdc-1.0/setup.py ADDED
@@ -0,0 +1,19 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ setup(
4
+ name='fastdc',
5
+ version='1.0',
6
+ author='Arya Wiratama',
7
+ author_email='aryawiratama2401@gmail.com',
8
+ description='FastDC: A fast, modular, and AI-integrated Discord bot framework.',
9
+ packages=find_packages(),
10
+ package_data={"fastdc": ["*.py"]},
11
+ install_requires=[
12
+ 'discord.py',
13
+ 'chatterbot',
14
+ 'spacy',
15
+ 'python-dotenv',
16
+ 'groq',
17
+ ],
18
+ python_requires='>=3.10',
19
+ )