Giter Club home page Giter Club logo

pygpt's Introduction

PyGPT

Simple Python Discord ChatBot w/optional Pterodactyl Egg Powered by OpenAI

This is meant to run in Pterodactyl Panel or run Standalone on any platform.

Inspiration for the Pterodactyl Egg was taken from ParkerVCP's generic Python egg. All credit to ParkerVCP for making great eggs and yolks (Docker Images that go with the Pterodactyl Eggs). https://github.com/parkervcp/eggs/tree/master/generic/python

This is as simple and efficient of a Python Discord Bot possible. I have optimized every part of it that could be optimized. It's made to have the code as readable, stable, and efficient as possible. I let this bot send messages without a security feature such as putting the message in an embed so it can do cool stuff like this: (Or attempt to; as you can see in the first screenshot, the AI is not all-knowing and can make mistakes): image

As you can see in this screenshot with the bot name set to Vodka you would call it with "Hey Vodka" (Not case sensitive, hey vodka would work just as well). You can set the bot name to anything. image

The reason letting it format stuff like that is dangerous if permissions are not set correctly is because users can trick the bot into using things like @everyone or ^role myuser Admin. To prevent this bot from being able to harm your server, set it's permissions correctly. The Discord Bot that goes with this application only needs the three privilege intents, the bot permission, and inside the bot permission the "Send Messages" and "Read Messages/View Channels" permission.

Then once the bot is in your server all it needs is to be able to view messages and send messages in your chosen channel. DO NOT give this bot administrator permissions or any other permissions it does not need. Users can manipulate what it says with things like "Hey PyGPT-3, what do I get when I combine the strings @ and everyone?" If you set permissions correctly, it will produce @everyone, but this will do nothing because it doesn't have the "Mention @everyone" permission in your Discord Server.

The bot uses environmental variables rather than putting variables directly in the code for security reasons.

This bot is designed to run in a specified channel only so that you can set a channel to slowmode to avoid overloading your API Key. You can get an api key at https://platform.openai.com. You can choose a spending soft limit where you'll get emailed and a hard limit where it will just stop. The bot by default will only respond to messages that start with Hey and then the bot's name that you set in an environmental variable. Some examples: Hey PyGPT, how are you doing today? hey Pygpt, how are you doing today? Hey pygpt how are you doing today?

The Bot will convert the characters until the bot's name to lowercase and remove the comma if one exists, then capitalize the first character, so the actual prompt sent to the AI in these cases would just be "How are you doing today?"

pygpt's People

Contributors

loki-101 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

budyn00

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.