Update plugins, refactor proxy plugin, yt preview now gets lyrics

This commit is contained in:
Hash Borgir 2024-03-04 00:53:58 -07:00
parent e8186c9fec
commit d2acef611b
8 changed files with 227 additions and 74 deletions

View File

@ -32,7 +32,7 @@
"summary": "\ud83c\udf44Seo prompt GPT\ud83c\udf44<br>\u2935\ufe0eClick Here To See Seo prompt's Response\u2935\ufe0e" "summary": "\ud83c\udf44Seo prompt GPT\ud83c\udf44<br>\u2935\ufe0eClick Here To See Seo prompt's Response\u2935\ufe0e"
}, },
"eng": { "eng": {
"prompt": "I want you to act as an English translator, spelling corrector and improver. I will speak to you in any language and you will detect the language, translate it and answer in the corrected and improved version of my text, in English. I want you to replace my simplified A0-level words and sentences with more beautiful and elegant, upper level English words and sentences. Keep the meaning same, but make them more literary. I want you to only reply the correction, the improvements and nothing else, do not write explanations. My first sentence is \"istanbulu cok seviyom burada olmak cok guzel\"", "prompt": "I want you to act as an English translator, spelling corrector and improver. I will speak to you in any language and you will detect the language, translate it and answer in the corrected and improved version of my text, in English. I want you to replace my simplified A0-level words and sentences with more beautiful and elegant, upper level English words and sentences. Keep the meaning same, but make them more literary. I want you to only reply the correction, the improvements and nothing else, do not write explanations.",
"temperature": 1.31, "temperature": 1.31,
"top_p": 0.14, "top_p": 0.14,
"top_k": 49, "top_k": 49,
@ -40,7 +40,7 @@
"summary": "\ud83c\udf44English translator and improver GPT\ud83c\udf44<br>\u2935\ufe0eClick Here To See English translator and improver's Response\u2935\ufe0e" "summary": "\ud83c\udf44English translator and improver GPT\ud83c\udf44<br>\u2935\ufe0eClick Here To See English translator and improver's Response\u2935\ufe0e"
}, },
"intv": { "intv": {
"prompt": "I want you to act as an interviewer. I will be the candidate and you will ask me the interview questions for the `position` position. I want you to only reply as the interviewer. Do not write all the conservation at once. I want you to only do the interview with me. Ask me the questions and wait for my answers. Do not write explanations. Ask me the questions one by one like an interviewer does and wait for my answers. My first sentence is \"Hi\"", "prompt": "I want you to act as an interviewer. I will be the candidate and you will ask me the interview questions for the `position` position. I want you to only reply as the interviewer. Do not write all the conservation at once. I want you to only do the interview with me. Ask me the questions and wait for my answers. Do not write explanations. Ask me the questions one by one like an interviewer does and wait for my answers.",
"temperature": 1.31, "temperature": 1.31,
"top_p": 0.14, "top_p": 0.14,
"top_k": 49, "top_k": 49,
@ -48,7 +48,7 @@
"summary": "\ud83c\udf44`position` interviewer GPT\ud83c\udf44<br>\u2935\ufe0eClick Here To See `position` interviewer's Response\u2935\ufe0e" "summary": "\ud83c\udf44`position` interviewer GPT\ud83c\udf44<br>\u2935\ufe0eClick Here To See `position` interviewer's Response\u2935\ufe0e"
}, },
"pron": { "pron": {
"prompt": "I want you to act as an English pronunciation assistant for Turkish speaking people. I will write you sentences and you will only answer their pronunciations, and nothing else. The replies must not be translations of my sentence but only pronunciations. Pronunciations should use Turkish Latin letters for phonetics. Do not write explanations on replies. My first sentence is \"how the weather is in Istanbul?\"", "prompt": "I want you to act as an English pronunciation assistant for Turkish speaking people. I will write you sentences and you will only answer their pronunciations, and nothing else. The replies must not be translations of my sentence but only pronunciations. Pronunciations should use Turkish Latin letters for phonetics. Do not write explanations on replies.",
"temperature": 1.31, "temperature": 1.31,
"top_p": 0.14, "top_p": 0.14,
"top_k": 49, "top_k": 49,
@ -64,7 +64,7 @@
"summary": "\ud83c\udf44Spoken english teacher and improver GPT\ud83c\udf44<br>\u2935\ufe0eClick Here To See Spoken english teacher and improver's Response\u2935\ufe0e" "summary": "\ud83c\udf44Spoken english teacher and improver GPT\ud83c\udf44<br>\u2935\ufe0eClick Here To See Spoken english teacher and improver's Response\u2935\ufe0e"
}, },
"trv": { "trv": {
"prompt": "I want you to act as a travel guide. I will write you my location and you will suggest a place to visit near my location. In some cases, I will also give you the type of places I will visit. You will also suggest me places of similar type that are close to my first location. My first suggestion request is \"I am in Istanbul/Beyo\u011flu and I want to visit only museums.\"", "prompt": "I want you to act as a travel guide. I will write you my location and you will suggest a place to visit near my location. In some cases, I will also give you the type of places I will visit. You will also suggest me places of similar type that are close to my first location.",
"temperature": 1.31, "temperature": 1.31,
"top_p": 0.14, "top_p": 0.14,
"top_k": 49, "top_k": 49,
@ -72,7 +72,7 @@
"summary": "\ud83c\udf44Travel guide GPT\ud83c\udf44<br>\u2935\ufe0eClick Here To See Travel guide's Response\u2935\ufe0e" "summary": "\ud83c\udf44Travel guide GPT\ud83c\udf44<br>\u2935\ufe0eClick Here To See Travel guide's Response\u2935\ufe0e"
}, },
"plag": { "plag": {
"prompt": "I want you to act as a plagiarism checker. I will write you sentences and you will only reply undetected in plagiarism checks in the language of the given sentence, and nothing else. Do not write explanations on replies. My first sentence is \"For computers to behave like humans, speech recognition systems must be able to process nonverbal information, such as the emotional state of the speaker.\"", "prompt": "I want you to act as a plagiarism checker. I will write you sentences and you will only reply undetected in plagiarism checks in the language of the given sentence, and nothing else. Do not write explanations on replies.",
"temperature": 1.31, "temperature": 1.31,
"top_p": 0.14, "top_p": 0.14,
"top_k": 49, "top_k": 49,
@ -80,7 +80,7 @@
"summary": "\ud83c\udf44Plagiarism checker GPT\ud83c\udf44<br>\u2935\ufe0eClick Here To See Plagiarism checker's Response\u2935\ufe0e" "summary": "\ud83c\udf44Plagiarism checker GPT\ud83c\udf44<br>\u2935\ufe0eClick Here To See Plagiarism checker's Response\u2935\ufe0e"
}, },
"char": { "char": {
"prompt": "I want you to act like {character} from {series}. I want you to respond and answer like {character} using the tone, manner and vocabulary {character} would use. Do not write any explanations. Only answer like {character}. You must know all of the knowledge of {character}. My first sentence is \"Hi {character}.\"", "prompt": "I want you to act like {character} from {series}. I want you to respond and answer like {character} using the tone, manner and vocabulary {character} would use. Do not write any explanations. Only answer like {character}. You must know all of the knowledge of {character}.",
"temperature": 1.31, "temperature": 1.31,
"top_p": 0.14, "top_p": 0.14,
"top_k": 49, "top_k": 49,
@ -88,7 +88,7 @@
"summary": "\ud83c\udf44Character from movie/book/anything GPT\ud83c\udf44<br>\u2935\ufe0eClick Here To See Character from movie/book/anything's Response\u2935\ufe0e" "summary": "\ud83c\udf44Character from movie/book/anything GPT\ud83c\udf44<br>\u2935\ufe0eClick Here To See Character from movie/book/anything's Response\u2935\ufe0e"
}, },
"adv": { "adv": {
"prompt": "I want you to act as a gnomist. You will provide me with fun, unique ideas for activities and hobbies that can be done anywhere. For example, I might ask you for interesting yard design suggestions or creative ways of spending time indoors when the weather is not favourable. Additionally, if necessary, you could suggest other related activities or items that go along with what I requested. My first request is \"I am looking for new outdoor activities in my area\".", "prompt": "I want you to act as a gnomist. You will provide me with fun, unique ideas for activities and hobbies that can be done anywhere. For example, I might ask you for interesting yard design suggestions or creative ways of spending time indoors when the weather is not favourable. Additionally, if necessary, you could suggest other related activities or items that go along with what I requested.",
"temperature": 1.31, "temperature": 1.31,
"top_p": 0.14, "top_p": 0.14,
"top_k": 49, "top_k": 49,
@ -96,7 +96,7 @@
"summary": "\ud83c\udf44Gnomist GPT\ud83c\udf44<br>\u2935\ufe0eClick Here To See Gnomist's Response\u2935\ufe0e" "summary": "\ud83c\udf44Gnomist GPT\ud83c\udf44<br>\u2935\ufe0eClick Here To See Gnomist's Response\u2935\ufe0e"
}, },
"story": { "story": {
"prompt": "I want you to act as a storyteller. You will come up with entertaining stories that are engaging, imaginative and captivating for the audience. It can be fairy tales, educational stories or any other type of stories which has the potential to capture people's attention and imagination. Depending on the target audience, you may choose specific themes or topics for your storytelling session e.g., if it\u2019s children then you can talk about animals; If it\u2019s adults then history-based tales might engage them better etc. My first request is \"I need an interesting story on perseverance.\"", "prompt": "I want you to act as a storyteller. You will come up with entertaining stories that are engaging, imaginative and captivating for the audience. It can be fairy tales, educational stories or any other type of stories which has the potential to capture people's attention and imagination. Depending on the target audience, you may choose specific themes or topics for your storytelling session e.g., if it\u2019s children then you can talk about animals; If it\u2019s adults then history-based tales might engage them better etc.",
"temperature": 1.31, "temperature": 1.31,
"top_p": 0.14, "top_p": 0.14,
"top_k": 49, "top_k": 49,
@ -104,7 +104,7 @@
"summary": "\ud83c\udf44Storyteller GPT\ud83c\udf44<br>\u2935\ufe0eClick Here To See Storyteller's Response\u2935\ufe0e" "summary": "\ud83c\udf44Storyteller GPT\ud83c\udf44<br>\u2935\ufe0eClick Here To See Storyteller's Response\u2935\ufe0e"
}, },
"foot": { "foot": {
"prompt": "I want you to act as a football commentator. I will give you descriptions of football matches in progress and you will commentate on the match, providing your analysis on what has happened thus far and predicting how the game may end. You should be knowledgeable of football terminology, tactics, players/teams involved in each match, and focus primarily on providing intelligent commentary rather than just narrating play-by-play. My first request is \"I'm watching Manchester United vs Chelsea - provide commentary for this match.\"", "prompt": "I want you to act as a football commentator. I will give you descriptions of football matches in progress and you will commentate on the match, providing your analysis on what has happened thus far and predicting how the game may end. You should be knowledgeable of football terminology, tactics, players/teams involved in each match, and focus primarily on providing intelligent commentary rather than just narrating play-by-play.",
"temperature": 1.31, "temperature": 1.31,
"top_p": 0.14, "top_p": 0.14,
"top_k": 49, "top_k": 49,
@ -112,7 +112,7 @@
"summary": "\ud83c\udf44Football commentator GPT\ud83c\udf44<br>\u2935\ufe0eClick Here To See Football commentator's Response\u2935\ufe0e" "summary": "\ud83c\udf44Football commentator GPT\ud83c\udf44<br>\u2935\ufe0eClick Here To See Football commentator's Response\u2935\ufe0e"
}, },
"comic": { "comic": {
"prompt": "I want you to act as a stand-up comedian. I will provide you with some topics related to current events and you will use your wit, creativity, and observational skills to create a routine based on those topics. You should also be sure to incorporate personal anecdotes or experiences into the routine in order to make it more relatable and engaging for the audience. My first request is \"I want an humorous take on politics.\"", "prompt": "I want you to act as a stand-up comedian. I will provide you with some topics related to current events and you will use your wit, creativity, and observational skills to create a routine based on those topics. You should also be sure to incorporate personal anecdotes or experiences into the routine in order to make it more relatable and engaging for the audience.",
"temperature": 1.31, "temperature": 1.31,
"top_p": 0.14, "top_p": 0.14,
"top_k": 49, "top_k": 49,
@ -120,7 +120,7 @@
"summary": "\ud83c\udf44Stand-up comedian GPT\ud83c\udf44<br>\u2935\ufe0eClick Here To See Stand-up comedian's Response\u2935\ufe0e" "summary": "\ud83c\udf44Stand-up comedian GPT\ud83c\udf44<br>\u2935\ufe0eClick Here To See Stand-up comedian's Response\u2935\ufe0e"
}, },
"motiv": { "motiv": {
"prompt": "I want you to act as a motivational coach. I will provide you with some information about someone's goals and challenges, and it will be your job to come up with strategies that can help this person achieve their goals. This could involve providing positive affirmations, giving helpful advice or suggesting activities they can do to reach their end goal. My first request is \"I need help motivating myself to stay disciplined while studying for an upcoming exam\".", "prompt": "I want you to act as a motivational coach. I will provide you with some information about someone's goals and challenges, and it will be your job to come up with strategies that can help this person achieve their goals. This could involve providing positive affirmations, giving helpful advice or suggesting activities they can do to reach their end goal.",
"temperature": 1.31, "temperature": 1.31,
"top_p": 0.14, "top_p": 0.14,
"top_k": 49, "top_k": 49,
@ -128,7 +128,7 @@
"summary": "\ud83c\udf44Motivational coach GPT\ud83c\udf44<br>\u2935\ufe0eClick Here To See Motivational coach's Response\u2935\ufe0e" "summary": "\ud83c\udf44Motivational coach GPT\ud83c\udf44<br>\u2935\ufe0eClick Here To See Motivational coach's Response\u2935\ufe0e"
}, },
"debate": { "debate": {
"prompt": "I want you to act as a debater. I will provide you with some topics related to current events and your task is to research both sides of the debates, present valid arguments for each side, refute opposing points of view, and draw persuasive conclusions based on evidence. Your goal is to help people come away from the discussion with increased knowledge and insight into the topic at hand. My first request is \"I want an opinion piece about Deno.\"", "prompt": "I want you to act as a debater. I will provide you with some topics related to current events and your task is to research both sides of the debates, present valid arguments for each side, refute opposing points of view, and draw persuasive conclusions based on evidence. Your goal is to help people come away from the discussion with increased knowledge and insight into the topic at hand.",
"temperature": 1.31, "temperature": 1.31,
"top_p": 0.14, "top_p": 0.14,
"top_k": 49, "top_k": 49,
@ -136,7 +136,7 @@
"summary": "\ud83c\udf44Debater GPT\ud83c\udf44<br>\u2935\ufe0eClick Here To See Debater's Response\u2935\ufe0e" "summary": "\ud83c\udf44Debater GPT\ud83c\udf44<br>\u2935\ufe0eClick Here To See Debater's Response\u2935\ufe0e"
}, },
"write": { "write": {
"prompt": "In order to submit applications for jobs, I want to write a new cover letter. Please compose a cover letter describing my technical skills. I've been working with web technology for two years. I've worked as a frontend developer for 8 months. I've grown by employing some tools. These include [...Tech Stack], and so on. I wish to develop my full-stack development skills. I desire to lead a T-shaped existence. Can you write a cover letter for a job application about myself?", "prompt": "In order to submit applications for jobs, I want to write a new cover letter. Please compose a cover letter describing my technical skills. Can you write a cover letter for a job application about myself?",
"temperature": 1.31, "temperature": 1.31,
"top_p": 0.14, "top_p": 0.14,
"top_k": 49, "top_k": 49,
@ -144,7 +144,7 @@
"summary": "\ud83c\udf44Cover letter GPT\ud83c\udf44<br>\u2935\ufe0eClick Here To See Cover letter's Response\u2935\ufe0e" "summary": "\ud83c\udf44Cover letter GPT\ud83c\udf44<br>\u2935\ufe0eClick Here To See Cover letter's Response\u2935\ufe0e"
}, },
"script": { "script": {
"prompt": "I want you to act as a screenwriter. You will develop an engaging and creative script for either a feature length film, or a Web Series that can captivate its viewers. Start with coming up with interesting characters, the setting of the story, dialogues between the characters etc. Once your character development is complete - create an exciting storyline filled with twists and turns that keeps the viewers in suspense until the end. My first request is \"I need to write a romantic drama movie set in Paris.\"", "prompt": "I want you to act as a screenwriter. You will develop an engaging and creative script for either a feature length film, or a Web Series that can captivate its viewers. Start with coming up with interesting characters, the setting of the story, dialogues between the characters etc. Once your character development is complete - create an exciting storyline filled with twists and turns that keeps the viewers in suspense until the end.",
"temperature": 1.31, "temperature": 1.31,
"top_p": 0.14, "top_p": 0.14,
"top_k": 49, "top_k": 49,
@ -495,7 +495,7 @@
"repetition_penalty": 1.17, "repetition_penalty": 1.17,
"summary": "\ud83c\udf44Prompt generator GPT\ud83c\udf44<br>\u2935\ufe0eClick Here To See Prompt generator's Response\u2935\ufe0e" "summary": "\ud83c\udf44Prompt generator GPT\ud83c\udf44<br>\u2935\ufe0eClick Here To See Prompt generator's Response\u2935\ufe0e"
}, },
"db": { "algo": {
"prompt": "I want you to act as an instructor in a school, teaching algorithms to beginners. You will provide code examples using python programming language. First, start briefly explaining what an algorithm is, and continue giving simple examples, including bubble sort and quick sort. Later, wait for my prompt for additional questions. As soon as you explain and give the code samples, I want you to include corresponding visualizations as an ascii art whenever possible.", "prompt": "I want you to act as an instructor in a school, teaching algorithms to beginners. You will provide code examples using python programming language. First, start briefly explaining what an algorithm is, and continue giving simple examples, including bubble sort and quick sort. Later, wait for my prompt for additional questions. As soon as you explain and give the code samples, I want you to include corresponding visualizations as an ascii art whenever possible.",
"temperature": 1.31, "temperature": 1.31,
"top_p": 0.14, "top_p": 0.14,
@ -503,14 +503,6 @@
"repetition_penalty": 1.17, "repetition_penalty": 1.17,
"summary": "\ud83c\udf44Instructor in a school GPT\ud83c\udf44<br>\u2935\ufe0eClick Here To See Instructor in a school's Response\u2935\ufe0e" "summary": "\ud83c\udf44Instructor in a school GPT\ud83c\udf44<br>\u2935\ufe0eClick Here To See Instructor in a school's Response\u2935\ufe0e"
}, },
"diet": {
"prompt": "I want you to act as a SQL terminal in front of an example database. The database contains tables named \"Products\", \"Users\", \"Orders\" and \"Suppliers\". I will type queries and you will reply with what the terminal would show. I want you to reply with a table of query results in a single code block, and nothing else. Do not write explanations. Do not type commands unless I instruct you to do so. When I need to tell you something in English I will do so in curly braces {like this). My first command is 'SELECT TOP 10 * FROM Products ORDER BY Id DESC'",
"temperature": 1.31,
"top_p": 0.14,
"top_k": 49,
"repetition_penalty": 1.17,
"summary": "\ud83c\udf44Sql terminal GPT\ud83c\udf44<br>\u2935\ufe0eClick Here To See Sql terminal's Response\u2935\ufe0e"
},
"psych": { "psych": {
"prompt": "As a dietitian, I would like to design a vegetarian recipe for 2 people that has approximate 500 calories per serving and has a low glycemic index. Can you please provide a suggestion?", "prompt": "As a dietitian, I would like to design a vegetarian recipe for 2 people that has approximate 500 calories per serving and has a low glycemic index. Can you please provide a suggestion?",
"temperature": 1.31, "temperature": 1.31,
@ -536,7 +528,7 @@
"summary": "\ud83c\udf44Journal reviewer GPT\ud83c\udf44<br>\u2935\ufe0eClick Here To See Journal reviewer's Response\u2935\ufe0e" "summary": "\ud83c\udf44Journal reviewer GPT\ud83c\udf44<br>\u2935\ufe0eClick Here To See Journal reviewer's Response\u2935\ufe0e"
}, },
"devrel": { "devrel": {
"prompt": "I want you to act as a Developer Relations consultant. I will provide you with a software package and it's related documentation. Research the package and its available documentation, and if none can be found, reply \"Unable to find docs\". Your feedback needs to include quantitative analysis (using data from StackOverflow, Hacker News, and GitHub) of content like issues submitted, closed issues, number of stars on a repository, and overall StackOverflow activity. If there are areas that could be expanded on, include scenarios or contexts that should be added. Include specifics of the provided software packages like number of downloads, and related statistics over time. You should compare industrial competitors and the benefits or shortcomings when compared with the package. Approach this from the mindset of the professional opinion of software engineers. Review technical blogs and websites (such as TechCrunch.com or Crunchbase.com) and if data isn't available, reply \"No data available\". My first request is \"express https://expressjs.com\"", "prompt": "I want you to act as a Developer Relations consultant. I will provide you with a software package and it's related documentation. Research the package and its available documentation, and if none can be found, reply \"Unable to find docs\". Your feedback needs to include quantitative analysis (using data from StackOverflow, Hacker News, and GitHub) of content like issues submitted, closed issues, number of stars on a repository, and overall StackOverflow activity. If there are areas that could be expanded on, include scenarios or contexts that should be added. Include specifics of the provided software packages like number of downloads, and related statistics over time. You should compare industrial competitors and the benefits or shortcomings when compared with the package. Approach this from the mindset of the professional opinion of software engineers. Review technical blogs and websites (such as TechCrunch.com or Crunchbase.com) and if data isn't available, reply \"No data available\".",
"temperature": 1.31, "temperature": 1.31,
"top_p": 0.14, "top_p": 0.14,
"top_k": 49, "top_k": 49,
@ -544,7 +536,7 @@
"summary": "\ud83c\udf44Developer relations consultant GPT\ud83c\udf44<br>\u2935\ufe0eClick Here To See Developer relations consultant's Response\u2935\ufe0e" "summary": "\ud83c\udf44Developer relations consultant GPT\ud83c\udf44<br>\u2935\ufe0eClick Here To See Developer relations consultant's Response\u2935\ufe0e"
}, },
"acad": { "acad": {
"prompt": "I want you to act as an academician. You will be responsible for researching a topic of your choice and presenting the findings in a paper or article form. Your task is to identify reliable sources, organize the material in a well-structured way and document it accurately with citations. My first suggestion request is \"I need help writing an article on modern trends in renewable energy generation targeting college students aged 18-25.\"", "prompt": "I want you to act as an academician. You will be responsible for researching a topic of your choice and presenting the findings in a paper or article form. Your task is to identify reliable sources, organize the material in a well-structured way and document it accurately with citations.",
"temperature": 1.31, "temperature": 1.31,
"top_p": 0.14, "top_p": 0.14,
"top_k": 49, "top_k": 49,

View File

@ -18,6 +18,7 @@ async def handle_command(room, message, bot, prefix, config):
message (RoomMessage): The message object containing the command. message (RoomMessage): The message object containing the command.
bot (Bot): The bot object. bot (Bot): The bot object.
prefix (str): The command prefix. prefix (str): The command prefix.
config (dict): Configuration parameters.
Returns: Returns:
None None
@ -30,9 +31,6 @@ async def handle_command(room, message, bot, prefix, config):
conf = load_config() conf = load_config()
if command in conf: if command in conf:
await handle_ai_command(room, bot, command, match.args(), conf) await handle_ai_command(room, bot, command, match.args(), conf)
#else:
#await bot.api.send_text_message(room.room_id, f"Unknown command: {command}")
#logging.info("Sent unknown command message to the room")
async def handle_ai_command(room, bot, command, args, config): async def handle_ai_command(room, bot, command, args, config):
""" """
@ -43,7 +41,7 @@ async def handle_ai_command(room, bot, command, args, config):
bot (Bot): The bot object. bot (Bot): The bot object.
command (str): The name of the AI model command. command (str): The name of the AI model command.
args (list): List of arguments provided with the command. args (list): List of arguments provided with the command.
config: Configuration parameters. config (dict): Configuration parameters.
Returns: Returns:
None None
@ -91,6 +89,15 @@ async def handle_ai_command(room, bot, command, args, config):
await bot.api.send_text_message(room.room_id, f"Error generating text: {e}") await bot.api.send_text_message(room.room_id, f"Error generating text: {e}")
def markdown_to_html(markdown_text): def markdown_to_html(markdown_text):
"""
Convert Markdown text to HTML.
Args:
markdown_text (str): Markdown formatted text.
Returns:
str: HTML formatted text.
"""
html_content = markdown2.markdown(markdown_text) html_content = markdown2.markdown(markdown_text)
return html_content return html_content
@ -106,4 +113,3 @@ def load_config():
return config return config
CONFIG = load_config() CONFIG = load_config()

View File

@ -98,13 +98,16 @@ async def handle_command(room, message, bot, prefix, config):
Returns: Returns:
None None
""" """
# Check if the message matches the command pattern and is not from this bot
match = botlib.MessageMatch(room, message, bot, prefix) match = botlib.MessageMatch(room, message, bot, prefix)
if match.is_not_from_this_bot() and match.prefix() and match.command("set"): if match.is_not_from_this_bot() and match.prefix() and match.command("set"):
# If the command is 'set', check if it has exactly two arguments
args = match.args() args = match.args()
if len(args) != 2: if len(args) != 2:
await bot.api.send_text_message(room.room_id, "Usage: !set <config_option> <value>") await bot.api.send_text_message(room.room_id, "Usage: !set <config_option> <value>")
return return
option, value = args option, value = args
# Set the specified configuration option based on the provided value
if option == "admin_user": if option == "admin_user":
config.admin_user = value config.admin_user = value
await bot.api.send_text_message(room.room_id, f"Admin user set to {value}") await bot.api.send_text_message(room.room_id, f"Admin user set to {value}")
@ -114,6 +117,7 @@ async def handle_command(room, message, bot, prefix, config):
else: else:
await bot.api.send_text_message(room.room_id, "Invalid configuration option") await bot.api.send_text_message(room.room_id, "Invalid configuration option")
# If the command is 'get', retrieve the value of the specified configuration option
elif match.is_not_from_this_bot() and match.prefix() and match.command("get"): elif match.is_not_from_this_bot() and match.prefix() and match.command("get"):
args = match.args() args = match.args()
if len(args) != 1: if len(args) != 1:
@ -127,21 +131,24 @@ async def handle_command(room, message, bot, prefix, config):
else: else:
await bot.api.send_text_message(room.room_id, "Invalid configuration option") await bot.api.send_text_message(room.room_id, "Invalid configuration option")
# If the command is 'saveconf', save the current configuration
elif match.is_not_from_this_bot() and match.prefix() and match.command("saveconf"): elif match.is_not_from_this_bot() and match.prefix() and match.command("saveconf"):
config.save_config(config.config_file) config.save_config(config.config_file)
await bot.api.send_text_message(room.room_id, "Configuration saved") await bot.api.send_text_message(room.room_id, "Configuration saved")
# If the command is 'loadconf', load the saved configuration
elif match.is_not_from_this_bot() and match.prefix() and match.command("loadconf"): elif match.is_not_from_this_bot() and match.prefix() and match.command("loadconf"):
config.load_config(config.config_file) config.load_config(config.config_file)
await bot.api.send_text_message(room.room_id, "Configuration loaded") await bot.api.send_text_message(room.room_id, "Configuration loaded")
# If the command is 'show', display the current configuration
elif match.is_not_from_this_bot() and match.prefix() and match.command("show"): elif match.is_not_from_this_bot() and match.prefix() and match.command("show"):
admin_user = config.admin_user admin_user = config.admin_user
prefix = config.prefix prefix = config.prefix
await bot.api.send_text_message(room.room_id, f"Admin user: {admin_user}, Prefix: {prefix}") await bot.api.send_text_message(room.room_id, f"Admin user: {admin_user}, Prefix: {prefix}")
# If the command is 'reset', reset the configuration to default values
elif match.is_not_from_this_bot() and match.prefix() and match.command("reset"): elif match.is_not_from_this_bot() and match.prefix() and match.command("reset"):
config.admin_user = "" config.admin_user = ""
config.prefix = "!" config.prefix = "!"
await bot.api.send_text_message(room.room_id, "Configuration reset") await bot.api.send_text_message(room.room_id, "Configuration reset")

View File

@ -71,10 +71,10 @@ async def handle_command(room, message, bot, prefix, config):
</details> </details>
</p> </p>
</details> </details>
<br> <hr>
<details><summary>📸 <strong>Funguy Bot AI Commands</strong> 🌟</summary> <details><summary>📸 <strong>Funguy Bot AI Commands</strong> 🌟</summary>
<p> <p>
!tech, !music, !eth, !seo, !term, !eng, !intv, !js, !xls, !pron, !spk, !trv, !plag, !char, !adv, !story, !foot, !comic, !motiv, !music, !debate, !write, !script, !author, !crit, !rel, !poem, !rap, !speak, !phil, !math, !tutor, !design, !sec, !recruit, !coach, !etymo, !com, !magic, !counsel, !behavior, !fit, !mh, !realest, !log, !dental, !web, !health, !acc, !chef, !auto, !art, !fin, !invest, !tea, !interior, !florist, !selfhelp, !gnome, !aph, !adv, !advgame, !esc, !title, !stats, !prompt, !teach, !db, !diet, !psych, !domain, !tech, !review, !devrel, !acad, !arch, !insane, !manip, !logic, !review, !diy, !influencer, !philos, !socrat, !edu, !meditate, !writer, !smm, !eloc, !viz, !nav, !hypno, !hist, !astro, !critic, !comp, !journo, !curation, !pscoach, !makeup, !childcare, !writing, !art, !py, !syn, !shop, !dining, !telemed, !cook, !law, !fashion, !ml, !trans, !design, !it, !chess, !prompt, !dev, !math, !regex, !time, !dream, !coach, !r, !comm, !trans, !php, !emergency, !worksheet, !test, !game, !security, !create, !browse, !dev, !search, !startup, !guide, !langdet, !sales, !msg, !ceo, !diag, !coach, !therapy, !legal, !gen, !mgmt, !drunk, !hist, !rec, !write, !techtrans, !ai, !game, !proof, !spirit, !spirit, !chem, !friend, !py, !chat, !wiki, !kanji, !note, !litcrit, !enhance, !travel, !data, !gaming !tech, !music, !eth, !seo, !eng, !intv, !pron, !spk, !trv, !plag, !char, !adv, !story, !foot, !comic, !motiv, !debate, !write, !script, !author, !crit, !rel, !poem, !rap, !speak, !phil, !math, !tutor, !design, !sec, !recruit, !coach, !etymo, !com, !magic, !counsel, !behavior, !fit, !mh, !realest, !log, !dental, !web, !health, !acc, !chef, !auto, !art, !fin, !invest, !tea, !interior, !florist, !selfhelp, !gnome, !aph, !adv, !advgame, !esc, !title, !stats, !prompt, !teach, !diet, !psych, !domain, !tech, !review, !devrel, !acad, !arch, !insane, !manip, !logic, !review, !diy, !influencer, !philos, !socrat, !edu, !meditate, !writer, !smm, !eloc, !viz, !nav, !hypno, !hist, !astro, !critic, !comp, !journo, !curation, !pscoach, !makeup, !childcare, !writing, !art, !py, !syn, !shop, !dining, !telemed, !cook, !law, !fashion, !ml, !trans, !design, !it, !chess, !prompt, !dev, !math, !regex, !time, !dream, !coach, !r, !comm, !trans, !php, !emergency, !worksheet, !test, !game, !security, !create, !browse, !dev, !search, !startup, !guide, !langdet, !sales, !msg, !ceo, !diag, !coach, !therapy, !legal, !gen, !mgmt, !drunk, !hist, !rec, !write, !techtrans, !ai, !game, !proof, !spirit, !spirit, !chem, !friend, !py, !chat, !wiki, !kanji, !note, !litcrit, !enhance, !travel, !data, !gaming
</p> </p>
</details> </details>
""" """

View File

@ -50,38 +50,53 @@ async def handle_command(room, message, bot, prefix, config):
Args: Args:
room (Room): The Matrix room where the command was invoked. room (Room): The Matrix room where the command was invoked.
message (RoomMessage): The message object containing the command. message (RoomMessage): The message object containing the command.
bot (Bot): The bot instance.
prefix (str): The bot command prefix.
config (FunguyConfig): The bot configuration instance.
Returns: Returns:
None None
""" """
# Check if the message matches the command pattern and is not from this bot
match = botlib.MessageMatch(room, message, bot, prefix) match = botlib.MessageMatch(room, message, bot, prefix)
if match.is_not_from_this_bot() and match.prefix() and match.command("isup"): if match.is_not_from_this_bot() and match.prefix() and match.command("isup"):
# Log that the !isup command has been received
logging.info("Received !isup command") logging.info("Received !isup command")
args = match.args() args = match.args()
# Check if the command has exactly one argument
if len(args) != 1: if len(args) != 1:
# If the command does not have exactly one argument, send usage message
await bot.api.send_markdown_message(room.room_id, "Usage: !isup <ipv4/ipv6/domain>") await bot.api.send_markdown_message(room.room_id, "Usage: !isup <ipv4/ipv6/domain>")
logging.info("Sent usage message to the room") logging.info("Sent usage message to the room")
return return
target = args[0] target = args[0]
# DNS resolution # Perform DNS resolution
try: try:
ip_address = socket.gethostbyname(target) ip_address = socket.gethostbyname(target)
# Log successful DNS resolution
logging.info(f"DNS resolution successful for {target}: {ip_address}") logging.info(f"DNS resolution successful for {target}: {ip_address}")
# Send DNS resolution success message
await bot.api.send_markdown_message(room.room_id, f"✅ DNS resolution successful for **{target}**: **{ip_address}** (A record)") await bot.api.send_markdown_message(room.room_id, f"✅ DNS resolution successful for **{target}**: **{ip_address}** (A record)")
except socket.gaierror: except socket.gaierror:
# Log DNS resolution failure
logging.info(f"DNS resolution failed for {target}") logging.info(f"DNS resolution failed for {target}")
# Send DNS resolution failure message
await bot.api.send_markdown_message(room.room_id, f"❌ DNS resolution failed for **{target}**") await bot.api.send_markdown_message(room.room_id, f"❌ DNS resolution failed for **{target}**")
return return
# Check HTTP/HTTPS services # Check HTTP/HTTPS services
if await check_http(target): if await check_http(target):
# If HTTP service is up, send HTTP service up message
await bot.api.send_markdown_message(room.room_id, f"🖧 **{target}** HTTP service is up") await bot.api.send_markdown_message(room.room_id, f"🖧 **{target}** HTTP service is up")
logging.info(f"{target} HTTP service is up") logging.info(f"{target} HTTP service is up")
elif await check_https(target): elif await check_https(target):
# If HTTPS service is up, send HTTPS service up message
await bot.api.send_markdown_message(room.room_id, f"🖧 **{target}** HTTPS service is up") await bot.api.send_markdown_message(room.room_id, f"🖧 **{target}** HTTPS service is up")
logging.info(f"{target} HTTPS service is up") logging.info(f"{target} HTTPS service is up")
else: else:
# If both HTTP and HTTPS services are down, send service down message
await bot.api.send_markdown_message(room.room_id, f"😕 **{target}** HTTP/HTTPS services are down") await bot.api.send_markdown_message(room.room_id, f"😕 **{target}** HTTP/HTTPS services are down")
logging.info(f"{target} HTTP/HTTPS services are down") logging.info(f"{target} HTTP/HTTPS services are down")

View File

@ -9,44 +9,50 @@ import logging
import random import random
import requests import requests
import socket import socket
import ssl
import time import time
from datetime import datetime, timedelta from datetime import datetime, timedelta
import concurrent.futures
import simplematrixbotlib as botlib import simplematrixbotlib as botlib
import sqlite3
# Constants # Constants
SOCKS5_LIST_URL = 'https://raw.githubusercontent.com/TheSpeedX/SOCKS-List/master/socks5.txt' SOCKS5_LIST_URL = 'https://raw.githubusercontent.com/TheSpeedX/SOCKS-List/master/socks5.txt'
MAX_TRIES = 5 # SOCKS5_LIST_URL = 'https://raw.githubusercontent.com/proxifly/free-proxy-list/main/proxies/protocols/socks5/data.txt'
MAX_TRIES = 64
PROXY_LIST_FILENAME = 'socks5.txt' PROXY_LIST_FILENAME = 'socks5.txt'
PROXY_LIST_EXPIRATION = timedelta(hours=8) PROXY_LIST_EXPIRATION = timedelta(hours=8)
MAX_THREADS = 128
PROXIES_DB_FILE = 'proxies.db'
MAX_PROXIES_IN_DB = 500
async def test_socks5_proxy(proxy): # Setup verbose logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
def test_proxy(proxy):
""" """
Test a SOCKS5 proxy by attempting a connection and sending a request through it. Test a SOCKS5 proxy and return the outcome.
Args: Args:
proxy (str): The SOCKS5 proxy address in the format 'ip:port'. proxy (str): The SOCKS5 proxy address in the format 'ip:port'.
Returns: Returns:
bool: True if the proxy is working, False otherwise. tuple: (bool: success, str: proxy, int: latency)
float: The latency in milliseconds if the proxy is working, None otherwise.
""" """
try: try:
ip, port = proxy.split(':') ip, port = proxy.split(':')
logging.info(f"Testing SOCKS5 proxy: {ip}:{port}")
start_time = time.time() start_time = time.time()
with socket.create_connection((ip, int(port)), timeout=5) as client: with socket.create_connection((ip, int(port)), timeout=12) as client:
client.sendall(b'\x05\x01\x00') client.sendall(b'\x05\x01\x00')
response = client.recv(2) response = client.recv(2)
if response == b'\x05\x00': if response == b'\x05\x00':
latency = int(round((time.time() - start_time) * 1000, 0)) latency = int(round((time.time() - start_time) * 1000, 0))
logging.info(f"Successful connection to SOCKS5 proxy {proxy}. Latency: {latency} ms") return True, proxy, latency
return True, latency
else: else:
logging.info(f"Failed to connect to SOCKS5 proxy {proxy}: Connection refused") return False, proxy, None
return False, None
except Exception as e: except Exception as e:
logging.error(f"Error testing SOCKS5 proxy {proxy}: {e}") return False, proxy, None
return False, None
async def download_proxy_list(): async def download_proxy_list():
""" """
@ -72,6 +78,69 @@ async def download_proxy_list():
return False return False
def check_db_for_proxy():
"""
Check the proxies database for a working proxy.
If found, test the proxy and remove it from the database if it doesn't work.
Returns:
str or None: The working proxy if found, None otherwise.
"""
try:
with sqlite3.connect(PROXIES_DB_FILE) as conn:
cursor = conn.cursor()
cursor.execute("""
CREATE TABLE IF NOT EXISTS proxies (
id INTEGER PRIMARY KEY AUTOINCREMENT,
proxy TEXT,
latency INTEGER,
status TEXT
)
""")
cursor.execute("SELECT proxy, latency FROM proxies WHERE status = 'working' AND latency < 3000 ORDER BY RANDOM() LIMIT 1")
result = cursor.fetchone()
if result:
proxy, latency = result
success, _, _ = test_proxy(proxy)
if success:
return proxy, latency
else:
cursor.execute("DELETE FROM proxies WHERE proxy = ?", (proxy,))
conn.commit()
logging.info(f"Removed non-working proxy from the database: {proxy}")
return None, None
else:
return None, None
except Exception as e:
logging.error(f"Error checking proxies database: {e}")
return None, None
def save_proxy_to_db(proxy, latency):
"""
Save a working proxy to the proxies database.
Args:
proxy (str): The working proxy to be saved.
latency (int): Latency of the proxy.
"""
try:
with sqlite3.connect(PROXIES_DB_FILE) as conn:
cursor = conn.cursor()
cursor.execute("""
CREATE TABLE IF NOT EXISTS proxies (
id INTEGER PRIMARY KEY AUTOINCREMENT,
proxy TEXT,
latency INTEGER,
status TEXT
)
""")
cursor.execute("INSERT INTO proxies (proxy, latency, status) VALUES (?, ?, 'working')", (proxy, latency))
conn.commit()
except Exception as e:
logging.error(f"Error saving proxy to database: {e}")
async def handle_command(room, message, bot, prefix, config): async def handle_command(room, message, bot, prefix, config):
""" """
Function to handle the !proxy command. Function to handle the !proxy command.
@ -87,34 +156,58 @@ async def handle_command(room, message, bot, prefix, config):
if match.is_not_from_this_bot() and match.prefix() and match.command("proxy"): if match.is_not_from_this_bot() and match.prefix() and match.command("proxy"):
logging.info("Received !proxy command") logging.info("Received !proxy command")
# Download proxy list if needed # Check database for a working proxy
if not await download_proxy_list(): working_proxy, latency = check_db_for_proxy()
await bot.api.send_markdown_message(room.room_id, "Error downloading proxy list") if working_proxy:
logging.error("Error downloading proxy list") await bot.api.send_markdown_message(room.room_id,
f"✅ Using cached working SOCKS5 Proxy: **{working_proxy}** - Latency: **{latency} ms**")
logging.info(f"Using cached working SOCKS5 proxy {working_proxy}")
return return
try: # Download proxy list if needed
# Read proxies from file else:
with open(PROXY_LIST_FILENAME, 'r') as f: if not await download_proxy_list():
socks5_proxies = f.read().splitlines() await bot.api.send_markdown_message(room.room_id, "Error downloading proxy list")
random.shuffle(socks5_proxies) logging.error("Error downloading proxy list")
return
# Test proxies try:
socks5_proxy = None # Read proxies from file
for proxy in socks5_proxies[:MAX_TRIES]: with open(PROXY_LIST_FILENAME, 'r') as f:
success, latency = await test_socks5_proxy(proxy) socks5_proxies = [line.replace("socks5://", "") for line in f.read().splitlines()]
if success: random.shuffle(socks5_proxies)
socks5_proxy = proxy
break # Test proxies concurrently
tested_proxies = 0
with concurrent.futures.ThreadPoolExecutor(max_workers=MAX_THREADS) as executor:
futures = []
for proxy in socks5_proxies[:MAX_TRIES]:
futures.append(executor.submit(test_proxy, proxy))
for future in concurrent.futures.as_completed(futures):
success, proxy, latency = future.result()
if success:
await bot.api.send_markdown_message(room.room_id,
f"✅ Anonymous SOCKS5 Proxy: **{proxy}** - Latency: **{latency} ms**")
logging.info(f"Sent SOCKS5 proxy {proxy} to the room")
save_proxy_to_db(proxy, latency) # Save working proxy to the database
tested_proxies += 1
if tested_proxies >= MAX_PROXIES_IN_DB:
break # Stop testing proxies once MAX_PROXIES_IN_DB are saved to the database
# Check database for a working proxy after testing
working_proxy, latency = check_db_for_proxy()
if working_proxy:
await bot.api.send_markdown_message(room.room_id,
f"✅ Using cached working SOCKS5 Proxy: **{working_proxy}** - Latency: **{latency} ms**")
logging.info(f"Using cached working SOCKS5 proxy {working_proxy}")
else:
# If no working proxy found after testing
await bot.api.send_markdown_message(room.room_id, "❌ No working anonymous SOCKS5 proxy found")
logging.info("No working anonymous SOCKS5 proxy found")
except Exception as e:
logging.error(f"Error handling !proxy command: {e}")
await bot.api.send_markdown_message(room.room_id, "❌ Error handling !proxy command")
# Send the first working anonymous proxy of each type to the Matrix room
if socks5_proxy:
await bot.api.send_markdown_message(room.room_id, f"✅ Anonymous SOCKS5 Proxy: **{socks5_proxy}** - Latency: **{latency} ms**")
logging.info(f"Sent SOCKS5 proxy {socks5_proxy} to the room")
else:
await bot.api.send_markdown_message(room.room_id, "❌ No working anonymous SOCKS5 proxy found")
logging.info("No working anonymous SOCKS5 proxy found")
except Exception as e:
logging.error(f"Error handling !proxy command: {e}")
await bot.api.send_markdown_message(room.room_id, "❌ Error handling !proxy command")

View File

@ -6,8 +6,13 @@ Plugin for providing a command to fetch YouTube video information from links.
import re import re
import logging import logging
import asyncio import asyncio
import aiohttp
from pytubefix import YouTube from pytubefix import YouTube
import simplematrixbotlib as botlib import simplematrixbotlib as botlib
from youtube_title_parse import get_artist_title
LYRICIST_API_URL = "https://lyrist.vercel.app/api/song/{}"
def seconds_to_minutes_seconds(seconds): def seconds_to_minutes_seconds(seconds):
""" """
@ -23,6 +28,28 @@ def seconds_to_minutes_seconds(seconds):
seconds %= 60 seconds %= 60
return f"{minutes:02d}:{seconds:02d}" return f"{minutes:02d}:{seconds:02d}"
async def fetch_lyrics(artist):
"""
Asynchronously fetches lyrics for a song from the Lyricist API.
Args:
artist (str): The name of the artist.
Returns:
str: Lyrics of the song.
None if an error occurs during fetching.
"""
try:
async with aiohttp.ClientSession() as session:
async with session.get(LYRICIST_API_URL.format(artist)) as response:
data = await response.json()
return data.get("lyrics")
except Exception as e:
logging.error(f"Error fetching lyrics: {str(e)}")
return None
async def fetch_youtube_info(youtube_url): async def fetch_youtube_info(youtube_url):
""" """
Asynchronously fetches information about a YouTube video. Asynchronously fetches information about a YouTube video.
@ -37,17 +64,27 @@ async def fetch_youtube_info(youtube_url):
try: try:
video = YouTube(youtube_url) video = YouTube(youtube_url)
title = video.title title = video.title
artist, song = get_artist_title(title)
description = video.description description = video.description
length = seconds_to_minutes_seconds(video.length) length = seconds_to_minutes_seconds(video.length)
views = video.views views = video.views
author = video.author author = video.author
description_with_breaks = description.replace('\n', '<br>') description_with_breaks = description.replace('\n', '<br>')
info_message = f"""<strong>🎬🎝 Title:</strong> {title} | <strong>Length</strong>: {length} minutes | <strong>Views</strong>: {views}\n<details><summary><strong>⤵Click Here For Description⤵</strong></summary>{description_with_breaks}</details>"""
# Fetching lyrics
lyrics = await fetch_lyrics(artist)
lyrics = lyrics.replace('\n', "<br>")
info_message = f"""<strong>🎬🎝 Title:</strong> {title} | <strong>Length</strong>: {length} minutes | <strong>Views</strong>: {views}\n<details><summary><strong>⤵Description⤵</strong></summary>{description_with_breaks}</details>"""
if lyrics:
info_message += f"<br><details><summary><strong>🎵 Lyrics:</strong></summary><br>{lyrics}</details>"
return info_message return info_message
except Exception as e: except Exception as e:
logging.error(f"Error fetching YouTube video information: {str(e)}") logging.error(f"Error fetching YouTube video information: {str(e)}")
return None return None
async def handle_command(room, message, bot, prefix, config): async def handle_command(room, message, bot, prefix, config):
""" """
Asynchronously handles the command to fetch YouTube video information. Asynchronously handles the command to fetch YouTube video information.

View File

@ -7,3 +7,6 @@ markdown2
watchdog watchdog
emoji emoji
python-slugify python-slugify
youtube_title_parse