Coder Social home page Coder Social logo

douglastaylorsupportgroup / einsteinbot Goto Github PK

View Code? Open in Web Editor NEW
20.0 3.0 12.0 806 KB

๐Ÿค– A Discord bot that allows you to access solutions to homework problems from Chegg.

License: Apache License 2.0

Python 100.00%
discord-bot bot homework requests scraping chegg chegg-answers chegg-bot

einsteinbot's Introduction

EinsteinBot Logo

๐Ÿค– A Discord bot that displays homework solutions from Chegg.com in a text channel.

Disclamer: We are not responsible for any problems that may occur with this bot. This includes but is not limited to: support for building/making the bot or banned accounts. We will however respond to any bugs/problems with the bot itself sending solutions. This bot was developed for private and educational purposes only. Please make sure you are not violating the EULA/TOS of Chegg before you start using this bot. We are not affiliated with Chegg and DTSG does not condone the illegal use of EinsteinBot.

EinsteinBot is a service that creates a super easy way to share Chegg answers with others using a Discord Bot. It only requires one Chegg account and everyone can use Chegg's service using the account. You only need the Chegg link, and EinsteinBot will send the solution provided by Chegg in the text channel.

EinsteinBot is pretty easy to deploy. Everything is open-source and free to use (except for the Chegg service itself, you will need your own account).

๐Ÿ“ท Screenshots

Sorted by answer types.

Normal Answers
  • Discord shows:
  • Chegg Website shows:
Image Answers
  • Discord shows:
  • Chegg Website shows:
Textbook Answers
  • Discord shows:
  • Chegg Website shows:

๐Ÿ“ Commands

  • help: Displays all commands of the bot.
  • ping: Pong! Displays the ping of the bot.
  • source: Displays the bot's GitHub repository.
  • search <url> : Searches for the solution of a problem from Chegg.

๐Ÿ”จ Setup

Requirements

  • A Discord account.
  • A Chegg account that has a paid subscription.
  • A computer that has Python 3.8 or higher (from python.org, not from Windows Store) installed.

Main Setup

Note: You will need to do all of these setup steps (Preferably in order).

Discord Bot Creation Setup

  1. Go to Discord Developer Portal website and create a new application by clicking on New Application.
  2. After creating the application, click the application and copy the Application ID by clicking on Copy and save it for later.
  3. Then on the left sidebar, click Bot.
  4. Create a new bot by clicking on Add Bot.
  5. Copy the token of the bot by clicking on Copy and save it for later.

Chegg Setup

  1. Download a web browser extension that allows you to download cookies.
  2. Go to Chegg.com and sign in.
  3. At the home page, click the browser extension downloaded in Step 1. Then click the button that says Export. Copy the cookies and paste them into a .txt file named cookie.txt.
  4. Get your user agent by going to a website called WhatMyUserAgent. We will only need the user agent from this site. Save this user agent somewhere as it is going to be used later.

Bot Setup

  1. Clone this repository.
  2. Go into the folder that you cloned and create a new file called config.json.
  3. Copy the following into the file:
{
    "prefix": "THE BOTS PREFIX GOES HERE (ANYTHING YOU WANT)",
    "token": "THE BOTS TOKEN GOES HERE (NOT THE CLIENT ID)",
    "userAgent": "YOUR USER AGENT GOES HERE (REFER TO STEP 4 FROM CHEGG SETUP)"
}
  1. Copy the cookie.txt file from step 3 of Chegg Setup into the folder that you cloned.
  2. Thats it! Run the bot in your command line from the folder you cloned using:
python -u bot.py
  1. You can invite the bot by putting your client id/application id in this link where it says YOURAPPIDHERE (this link already has all the permissions needed for the bot): https://discord.com/oauth2/authorize?client_id=YOURAPPIDHERE&scope=applications.commands%20bot&permissions=139586751552

Author

EinsteinBot ยฉ DTSG, Released under the Apache License 2.0.

Authored and maintained by DouglasTaylorSupportGroup.

einsteinbot's People

Contributors

jckli avatar lil-luzzi avatar okinahiru avatar the-brandon-tran avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

einsteinbot's Issues

not working

Bot is online
Ignoring exception in on_message
Traceback (most recent call last):
File "C:\Users\nitin\AppData\Roaming\Python\Python38\site-packages\discord\ext\commands\core.py", line 179, in wrapped
ret = await coro(args, **kwargs)
File "C:\Users\nitin\OneDrive\New folder\bot\EinsteinBot\cogs\main.py", line 35, in search
answerRaw = await cheinsteinpy.answer(url, self.cookie, self.userAgent)
File "C:\Users\nitin\AppData\Roaming\Python\Python38\site-packages\cheinsteinpy\api.py", line 47, in answer
htmlRaw = requestPage.requestChapter(url, cookieStr, userAgent, htmlData)
File "C:\Users\nitin\AppData\Roaming\Python\Python38\site-packages\cheinsteinpy\requestPage.py", line 42, in requestChapter
chapter_id = str(re.search(r'?id=(\d+).
?isbn', html).group(1))
AttributeError: 'NoneType' object has no attribute 'group'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Users\nitin\AppData\Roaming\Python\Python38\site-packages\discord\client.py", line 352, in _run_event
await coro(*args, **kwargs)
File "C:\Users\nitin\AppData\Roaming\Python\Python38\site-packages\discord\ext\commands\bot.py", line 375, in on_message
await self.process_commands(message)
File "C:\Users\nitin\AppData\Roaming\Python\Python38\site-packages\discord\ext\commands\bot.py", line 372, in process_commands
await self.invoke(ctx)
File "C:\Users\nitin\AppData\Roaming\Python\Python38\site-packages\discord\ext\commands\bot.py", line 339, in invoke
await ctx.command.dispatch_error(ctx, exc)
File "C:\Users\nitin\AppData\Roaming\Python\Python38\site-packages\discord\ext\commands\core.py", line 537, in dispatch_error
await injected(cog, ctx, error)
File "C:\Users\nitin\AppData\Roaming\Python\Python38\site-packages\discord\ext\commands\core.py", line 165, in wrapped
ret = await coro(*args, **kwargs)
File "C:\Users\nitin\OneDrive\New folder\bot\EinsteinBot\cogs\main.py", line 122, in searchError
raise error
File "C:\Users\nitin\AppData\Roaming\Python\Python38\site-packages\discord\ext\commands\bot.py", line 335, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\nitin\AppData\Roaming\Python\Python38\site-packages\discord\ext\commands\core.py", line 916, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\nitin\AppData\Roaming\Python\Python38\site-packages\discord\ext\commands\core.py", line 188, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'group'

TypeError

I have an issue, which I am not sure how to fix
Traceback (most recent call last):
File "C:\Users\name\Desktop\EinsteinBot-master\bot.py", line 13, in
bot = commands.Bot(
TypeError: init() missing 1 required keyword-only argument: 'intents'

Issue when trying to first start

I have tried pip install -r requirements.txt and followed all the steps. I am running on a raspberry pi 4 with python 3.8 installed. I am getting this:

Traceback (most recent call last):
File "bot.py", line 3, in
import discord
ModuleNotFoundError: No module named 'discord'

Let me know what I can do.

Stage 3

I've struggling to follow the Bot steps when to comes to cloning the folder - which folder is it that needs to be cloned and what file needs to be made?

Hi, I am facing a problem

Hi, i tried to run bot.py but got this error, may i know how to solve it? Thanks

C:\EinsteinBot-master>python -u bot.py
Traceback (most recent call last):
File "C:\EinsteinBot-master\bot.py", line 3, in
import discord
ModuleNotFoundError: No module named 'discord' @jckli

The application did not respond

Hi! I keep running into this issue where none of the commands work, I've installed the requirements and followed the tutorial. This is the error I'm getting.
image

and,
image

Slash Command not appearing

I managed to get the bot to join the server and be online but now my issues is that the slash command do not appear

Daily limit

Hi,

Just to check on it does this bot have limit or will my premium account will be banned or suspend if I use this discord and if yes chances of getting this problem. Thanks for your effort it been easy to use when I need answer of course if I where use it I do not want it lead to account problem.

Application Command raised an exception: AttributeError: 'str' object has no attribute 'send'

Hi,

after the bot is online and trying to use command /search, from the terminal side there was an error happened:

root@78:/codingProject/EinsteinBot# python3 -u bot.py
Bot is online
Ignoring exception in on_interaction
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/discord/commands/core.py", line 126, in wrapped
ret = await coro(arg)
File "/usr/local/lib/python3.8/dist-packages/discord/commands/core.py", line 852, in _invoke
await self.callback(self.cog, ctx, **kwargs)
File "/codingProject/EinsteinBot/cogs/slashCommands.py", line 32, in search_slash
await callCommand(main.Commands.search, self, ctx, urlReal)
File "/codingProject/EinsteinBot/core/utils.py", line 45, in callCommand
await command(ctx, parameter)
File "/usr/local/lib/python3.8/dist-packages/discord/ext/commands/core.py", line 498, in call
return await self.callback(context, *args, **kwargs) # type: ignore
File "/codingProject/EinsteinBot/cogs/main.py", line 109, in search
await sendDefer(ctx, argError, True)
File "/codingProject/EinsteinBot/core/utils.py", line 33, in sendDefer
await ctx.send(embed=message)
AttributeError: 'str' object has no attribute 'send'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/discord/client.py", line 382, in _run_event
await coro(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/discord/bot.py", line 1045, in on_interaction
await self.process_application_commands(interaction)
File "/usr/local/lib/python3.8/dist-packages/discord/bot.py", line 737, in process_application_commands
await self.invoke_application_command(ctx)
File "/usr/local/lib/python3.8/dist-packages/discord/bot.py", line 997, in invoke_application_command
await ctx.command.dispatch_error(ctx, exc)
File "/usr/local/lib/python3.8/dist-packages/discord/commands/core.py", line 385, in dispatch_error
await injected(cog, ctx, error)
File "/usr/local/lib/python3.8/dist-packages/discord/commands/core.py", line 106, in wrapped
ret = await coro(*args, **kwargs)
File "/codingProject/EinsteinBot/cogs/slashCommands.py", line 44, in search_slash_error
raise error
File "/usr/local/lib/python3.8/dist-packages/discord/bot.py", line 993, in invoke_application_command
await ctx.command.invoke(ctx)
File "/usr/local/lib/python3.8/dist-packages/discord/commands/core.py", line 357, in invoke
await injected(ctx)
File "/usr/local/lib/python3.8/dist-packages/discord/commands/core.py", line 134, in wrapped
raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: AttributeError: 'str' object has no attribute 'send'

Command not found

Hello, when i try to run the bot it gives me this error:

2023-06-23 16:08:01 ERROR discord.ext.commands.bot Ignoring exception in command None
discord.ext.commands.errors.CommandNotFound: Command "search" is not found

can anyone help me solve it?

I want to test my order, it gives AuthenticationError: binance {"code":-2008,"msg":"Invalid Api-Key ID."}.But the Connecting has established i confirmed by use exception handling(try and except).

Code:

import ccxt

exchange = ccxt.binance({
'apiKey': '',
'secret': '
',
'enableRateLimit': True,
})

symbol = 'BNB/BTC'
type = 'limit' # or 'market'
side = 'sell' # or 'buy'
amount = 1.0
price = 0.060154 # or None
params = {
'test': True, # test if it's valid, but don't actually place it
}

order = exchange.create_order(symbol, type, side, amount, price, params)

print(order)

error:


HTTPError Traceback (most recent call last)
~\Anaconda3\lib\site-packages\ccxt\base\exchange.py in fetch(self, url, method, headers, body)
659 self.logger.debug("%s %s, Response: %s %s %s", method, url, http_status_code, headers, http_response)
--> 660 response.raise_for_status()
661

~\Anaconda3\lib\site-packages\requests\models.py in raise_for_status(self)
959 if http_error_msg:
--> 960 raise HTTPError(http_error_msg, response=self)
961

HTTPError: 400 Client Error: for url: https://api.binance.com/sapi/v1/capital/config/getall?timestamp=1647611424066&recvWindow=5000&signature=b344cc04e426751ea5a347b9caf02c400b934e56d79c0df442572a3bfa65722c

During handling of the above exception, another exception occurred:

AuthenticationError Traceback (most recent call last)
in
18 }
19
---> 20 order = exchange.create_order(symbol, type, side, amount, price, params)
21
22 print(order)

~\Anaconda3\lib\site-packages\ccxt\binance.py in create_order(self, symbol, type, side, amount, price, params)
2594
2595 def create_order(self, symbol, type, side, amount, price=None, params={}):
-> 2596 self.load_markets()
2597 market = self.market(symbol)
2598 defaultType = self.safe_string_2(self.options, 'createOrder', 'defaultType', 'spot')

~\Anaconda3\lib\site-packages\ccxt\base\exchange.py in load_markets(self, reload, params)
1514 currencies = None
1515 if self.has['fetchCurrencies'] is True:
-> 1516 currencies = self.fetch_currencies()
1517 markets = self.fetch_markets(params)
1518 return self.set_markets(markets, currencies)

~\Anaconda3\lib\site-packages\ccxt\binance.py in fetch_currencies(self, params)
1243 if apiBackup is not None:
1244 return None
-> 1245 response = self.sapiGetCapitalConfigGetall(params)
1246 result = {}
1247 for i in range(0, len(response)):

~\Anaconda3\lib\site-packages\ccxt\base\exchange.py in inner(_self, params, context)
500 if context is not None:
501 inner_kwargs['context'] = params
--> 502 return entry(_self, **inner_kwargs)
503 return inner
504 to_bind = partialer()

~\Anaconda3\lib\site-packages\ccxt\binance.py in request(self, path, api, method, params, headers, body, config, context)
4988
4989 def request(self, path, api='public', method='GET', params={}, headers=None, body=None, config={}, context={}):
-> 4990 response = self.fetch2(path, api, method, params, headers, body, config, context)
4991 # a workaround for {"code":-2015,"msg":"Invalid API-key, IP, or permissions for action."}
4992 if (api == 'private') or (api == 'wapi'):

~\Anaconda3\lib\site-packages\ccxt\base\exchange.py in fetch2(self, path, api, method, params, headers, body, config, context)
547 self.lastRestRequestTimestamp = self.milliseconds()
548 request = self.sign(path, api, method, params, headers, body)
--> 549 return self.fetch(request['url'], request['method'], request['headers'], request['body'])
550
551 def request(self, path, api='public', method='GET', params={}, headers=None, body=None, config={}, context={}):

~\Anaconda3\lib\site-packages\ccxt\base\exchange.py in fetch(self, url, method, headers, body)
674 except HTTPError as e:
675 details = ' '.join([self.id, method, url])
--> 676 skip_further_error_handling = self.handle_errors(http_status_code, http_status_text, url, method, headers, http_response, json_response, request_headers, request_body)
677 if not skip_further_error_handling:
678 self.handle_http_status_code(http_status_code, http_status_text, url, method, http_response)

~\Anaconda3\lib\site-packages\ccxt\binance.py in handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody)
4966 # binanceusdm {"code":-4046,"msg":"No need to change margin type."}
4967 raise MarginModeAlreadySet(feedback)
-> 4968 self.throw_exactly_matched_exception(self.exceptions['exact'], error, feedback)
4969 raise ExchangeError(feedback)
4970 if not success:

~\Anaconda3\lib\site-packages\ccxt\base\exchange.py in throw_exactly_matched_exception(self, exact, string, message)
565 def throw_exactly_matched_exception(self, exact, string, message):
566 if string in exact:
--> 567 raise exactstring
568
569 def throw_broadly_matched_exception(self, broad, string, message):

AuthenticationError: binance {"code":-2008,"msg":"Invalid Api-Key ID."}

Setup

How to set up the code can expalin anyone thank you in advance:)

Help fixing missing files.

Import "discord" could not be resolved
Import "discord.ext" could not be resolved
Import "validators" could not be resolved
Import "cheinsteinpy" could not be resolved

I'm new when it comes to this stuff so some help would be amazing LOL.
Also I love that you're providing this to everyone. Thank you for ur work <3

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.