diff --git a/DjangoProject/Chatbot/__pycache__/__init__.cpython-37.pyc b/DjangoProject/Chatbot/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000..0016a05 Binary files /dev/null and b/DjangoProject/Chatbot/__pycache__/__init__.cpython-37.pyc differ diff --git a/DjangoProject/Chatbot/__pycache__/admin.cpython-37.pyc b/DjangoProject/Chatbot/__pycache__/admin.cpython-37.pyc new file mode 100644 index 0000000..f56d87b Binary files /dev/null and b/DjangoProject/Chatbot/__pycache__/admin.cpython-37.pyc differ diff --git a/DjangoProject/Chatbot/__pycache__/apps.cpython-37.pyc b/DjangoProject/Chatbot/__pycache__/apps.cpython-37.pyc new file mode 100644 index 0000000..10cd77a Binary files /dev/null and b/DjangoProject/Chatbot/__pycache__/apps.cpython-37.pyc differ diff --git a/DjangoProject/Chatbot/__pycache__/models.cpython-37.pyc b/DjangoProject/Chatbot/__pycache__/models.cpython-37.pyc new file mode 100644 index 0000000..c53ecd2 Binary files /dev/null and b/DjangoProject/Chatbot/__pycache__/models.cpython-37.pyc differ diff --git a/DjangoProject/Chatbot/__pycache__/urls.cpython-37.pyc b/DjangoProject/Chatbot/__pycache__/urls.cpython-37.pyc new file mode 100644 index 0000000..23498ea Binary files /dev/null and b/DjangoProject/Chatbot/__pycache__/urls.cpython-37.pyc differ diff --git a/DjangoProject/Chatbot/__pycache__/views.cpython-37.pyc b/DjangoProject/Chatbot/__pycache__/views.cpython-37.pyc new file mode 100644 index 0000000..ad26982 Binary files /dev/null and b/DjangoProject/Chatbot/__pycache__/views.cpython-37.pyc differ diff --git a/DjangoProject/Chatbot/admin.py b/DjangoProject/Chatbot/admin.py new file mode 100644 index 0000000..ea5d68b --- /dev/null +++ b/DjangoProject/Chatbot/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/DjangoProject/Chatbot/apps.py b/DjangoProject/Chatbot/apps.py new file mode 100644 index 0000000..8cb6a35 --- /dev/null +++ b/DjangoProject/Chatbot/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class ChatbotConfig(AppConfig): + name = 'Chatbot' diff --git a/DjangoProject/Chatbot/migrations/__pycache__/__init__.cpython-37.pyc b/DjangoProject/Chatbot/migrations/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000..144abd1 Binary files /dev/null and b/DjangoProject/Chatbot/migrations/__pycache__/__init__.cpython-37.pyc differ diff --git a/DjangoProject/Chatbot/models.py b/DjangoProject/Chatbot/models.py new file mode 100644 index 0000000..fd18c6e --- /dev/null +++ b/DjangoProject/Chatbot/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/DjangoProject/Chatbot/static/ContactIcon.png b/DjangoProject/Chatbot/static/ContactIcon.png new file mode 100644 index 0000000..9f7cd73 Binary files /dev/null and b/DjangoProject/Chatbot/static/ContactIcon.png differ diff --git a/DjangoProject/Chatbot/static/DiscordIcon.png b/DjangoProject/Chatbot/static/DiscordIcon.png new file mode 100644 index 0000000..ba8f06f Binary files /dev/null and b/DjangoProject/Chatbot/static/DiscordIcon.png differ diff --git a/DjangoProject/Chatbot/static/css/style.css b/DjangoProject/Chatbot/static/css/style.css new file mode 100644 index 0000000..73508dd --- /dev/null +++ b/DjangoProject/Chatbot/static/css/style.css @@ -0,0 +1,139 @@ +body +{ + background-color:#dedede; + color: #000000; +} + +#container { + width: 1200px; + height: 1100px; + margin: auto; + border:thick blue solid; + background-color: black; +} + +#title { + font-family: 'Times New Roman', Times, serif; + width: 1300px; + height: 50px; + text-align: center; +} + +#TextContainer { + background-color: black; + border: thick solid black; + font-family: 'Times New Roman', Times, serif; + width: 910px; + height: 362px; + float: right; +} + +#nav { + height: 40px; + border-bottom: thick #03BAFC solid; +} +nav { + margin: 0; + padding: 0; + background: #03BAFC url(nav_bg.jpg) 0 0 repeat-x; + width: 100%; + float: left; + border: 1px solid black; + border-width: 1px 0; +} +nav li { + display:inline; + padding:0; + margin:0; +} + nav a:link, + nav a:visited { + color: white; + background: #03BAFC; + padding: 20px 180px 10px 180px; + float: left; + width: auto; + border-right: 1px solid black; + text-decoration: none; + font: bold 1em/1em Arial, Helvetica, sans-serif; + text-transform: uppercase; + text-shadow: 2px 2px 2px #555; + } +nav a:hover { + color:white; + background:black; +} +nav li:first-child a { + border-left:1px solid black; +} +#home #nav-home a, +#about #nav-about a, +#archive #nav-archive a, +#lab #nav-lab a, +#reviews #nav-reviews a, +#contact #nav-contact a { + background:Black; + color:#fff; + text-shadow:none; +} +#home #nav-home a:hover, +#about #nav-about a:hover, +#archive #nav-archive a:hover, +#lab #nav-lab a:hover, +#reviews #nav-reviews a:hover, +#contact #nav-contact a:hover { + background:black; +} +nav a:active { + background: White; + color: #fff; +} + +input[type=text], input[type=password] { + width: 100%; + padding: 12px 20px; + margin: 8px 0; + display: inline-block; + border: 1px solid #ccc; + box-sizing: border-box; +} + +button { + background-color: #03BAFC; + color: white; + padding: 14px 20px; + margin: 8px 0; + border: none; + cursor: pointer; + width: 100%; +} + +.loginbutn { + width: 100%; +} + +.cancelbtn { + padding: 14px 20px; + background-color: #f44336; +} + +.cancelbtn, .signupbtn { + float: left; + width: 50%; +} + +.clearfix::after { + content: ""; + clear: both; + display: table; +} + +.spaceforlogin { + padding: 16px; +} + +@media screen and (max-width: 300px) { + .cancelbtn, .signupbtn { + width: 100%; + } +} diff --git a/DjangoProject/Chatbot/templates/webpages/StudentLogin.html b/DjangoProject/Chatbot/templates/webpages/StudentLogin.html new file mode 100644 index 0000000..171c79a --- /dev/null +++ b/DjangoProject/Chatbot/templates/webpages/StudentLogin.html @@ -0,0 +1,51 @@ +{% load static from staticfiles%} + + + + + + + + + Student Login + + + + +
+ Student Login +
+ + +
+
+ + + + + + + + + + Remember me +
+ Not a user ? .Click Here +
+ + + + + + \ No newline at end of file diff --git a/DjangoProject/Chatbot/templates/webpages/StudentReg.html b/DjangoProject/Chatbot/templates/webpages/StudentReg.html new file mode 100644 index 0000000..a439460 --- /dev/null +++ b/DjangoProject/Chatbot/templates/webpages/StudentReg.html @@ -0,0 +1,75 @@ +{% load static from staticfiles%} + + + + + + + + + Student Registration + + + + +
+ Student Registration +
+ + +
+
+
+ + + + + + + + + + + + + + Remember me +

By creating an account you agree to our Terms & Privacy.

+
+ +
+ + +
+
+ + + + \ No newline at end of file diff --git a/DjangoProject/Chatbot/templates/webpages/TeacherLogin.html b/DjangoProject/Chatbot/templates/webpages/TeacherLogin.html new file mode 100644 index 0000000..e00a9cf --- /dev/null +++ b/DjangoProject/Chatbot/templates/webpages/TeacherLogin.html @@ -0,0 +1,51 @@ +{% load static from staticfiles%} + + + + + + + + + Teacher Login + + + + +
+ Teacher Login +
+ + +
+
+ + + + + + + + + + Remember me +
+ Not a user ? .Click Here +
+ + + + + + \ No newline at end of file diff --git a/DjangoProject/Chatbot/templates/webpages/TeacherReg.html b/DjangoProject/Chatbot/templates/webpages/TeacherReg.html new file mode 100644 index 0000000..56cbb96 --- /dev/null +++ b/DjangoProject/Chatbot/templates/webpages/TeacherReg.html @@ -0,0 +1,58 @@ +{% load static from staticfiles%} + + + + + + + + + Teacher Registration + + + + + +
+ Teacher Registration +
+ + +
+
+ + + + + + + + + + + + + + Remember me +

By creating an account you agree to our Terms & Privacy.

+
+ +
+ + +
+ + + + \ No newline at end of file diff --git a/DjangoProject/Chatbot/templates/webpages/TeacherRequest.html b/DjangoProject/Chatbot/templates/webpages/TeacherRequest.html new file mode 100644 index 0000000..1f11463 --- /dev/null +++ b/DjangoProject/Chatbot/templates/webpages/TeacherRequest.html @@ -0,0 +1,39 @@ +{% load static from staticfiles%} + + + + + + + + + Teacher Request + + + +
+ Teacher Request +
+ + +
+
+ +
+ + +
+ + + + + + \ No newline at end of file diff --git a/DjangoProject/Chatbot/templates/webpages/TermsAndPolicy.html b/DjangoProject/Chatbot/templates/webpages/TermsAndPolicy.html new file mode 100644 index 0000000..47f9fae --- /dev/null +++ b/DjangoProject/Chatbot/templates/webpages/TermsAndPolicy.html @@ -0,0 +1,94 @@ +{% load static from staticfiles%} + + + + + + + + + Terms And Policy + + +
+ Terms And Policy +
+ + +
+ +Teaching Portal Terms of Service +
+
+ +1. Terms +
+
+By accessing the website at http://www.TeachingPortal.com, you are agreeing to be bound by these terms of service, all applicable laws and regulations, and agree that you are responsible for compliance with any applicable local laws. If you do not agree with any of these terms, you are prohibited from using or accessing this site. The materials contained in this website are protected by applicable copyright and trademark law. +
+
+ +2. Use License +
+
+Permission is granted to temporarily download one copy of the materials (information or software) on Teaching Portal's website for personal, non-commercial transitory viewing only. This is the grant of a license, not a transfer of title, and under this license you may not: +modify or copy the materials; +use the materials for any commercial purpose, or for any public display (commercial or non-commercial); +attempt to decompile or reverse engineer any software contained on Teaching Portal's website; +remove any copyright or other proprietary notations from the materials; or +transfer the materials to another person or "mirror" the materials on any other server. +This license shall automatically terminate if you violate any of these restrictions and may be terminated by Teaching Portal at any time. Upon terminating your viewing of these materials or upon the termination of this license, you must destroy any downloaded materials in your possession whether in electronic or printed format. +
+
+ +3. Disclaimer +
+
+The materials on Teaching Portal's website are provided on an 'as is' basis. Teaching Portal makes no warranties, expressed or implied, and hereby disclaims and negates all other warranties including, without limitation, implied warranties or conditions of merchantability, fitness for a particular purpose, or non-infringement of intellectual property or other violation of rights. +Further, Teaching Portal does not warrant or make any representations concerning the accuracy, likely results, or reliability of the use of the materials on its website or otherwise relating to such materials or on any sites linked to this site. +
+
+ +4. Limitations +
+
+In no event shall Teaching Portal or its suppliers be liable for any damages (including, without limitation, damages for loss of data or profit, or due to business interruption) arising out of the use or inability to use the materials on Teaching Portal's website, even if Teaching Portal or a Teaching Portal authorized representative has been notified orally or in writing of the possibility of such damage. Because some jurisdictions do not allow limitations on implied warranties, or limitations of liability for consequential or incidental damages, these limitations may not apply to you. +
+
+ +5. Accuracy of materials +
+
+The materials appearing on Teaching Portal's website could include technical, typographical, or photographic errors. Teaching Portal does not warrant that any of the materials on its website are accurate, complete or current. Teaching Portal may make changes to the materials contained on its website at any time without notice. However Teaching Portal does not make any commitment to update the materials. +
+
+ +6. Links +
+
+Teaching Portal has not reviewed all of the sites linked to its website and is not responsible for the contents of any such linked site. The inclusion of any link does not imply endorsement by Teaching Portal of the site. Use of any such linked website is at the user's own risk. +
+
+ +7. Modifications +
+
+Teaching Portal may revise these terms of service for its website at any time without notice. By using this website you are agreeing to be bound by the then current version of these terms of service. +
+
+ +8. Governing Law +
+
+These terms and conditions are governed by and construed in accordance with the laws of Birmingham and you irrevocably submit to the exclusive jurisdiction of the courts in that State or location. + +
+ + + \ No newline at end of file diff --git a/DjangoProject/Chatbot/templates/webpages/index.html b/DjangoProject/Chatbot/templates/webpages/index.html new file mode 100644 index 0000000..9e50b37 --- /dev/null +++ b/DjangoProject/Chatbot/templates/webpages/index.html @@ -0,0 +1,44 @@ +{% load static from staticfiles%} + + + + + + + + + Home Page + + +
+ Teaching Portal +
+ + +
+ + Welcome to our teaching portal, our services provide a stronger relathionship between teachers and students. If students have any queries regarding a certain subject or topic you are able to use this portal in order to submit or search for any questions. +
+
+ +
+
+ Discord: +
+ +
+
+ Email Us: +
+ +
+ + + + \ No newline at end of file diff --git a/DjangoProject/Chatbot/tests.py b/DjangoProject/Chatbot/tests.py new file mode 100644 index 0000000..de8bdc0 --- /dev/null +++ b/DjangoProject/Chatbot/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/DjangoProject/Chatbot/urls.py b/DjangoProject/Chatbot/urls.py new file mode 100644 index 0000000..89b343a --- /dev/null +++ b/DjangoProject/Chatbot/urls.py @@ -0,0 +1,13 @@ +from django.urls import path +from . import views + +urlpatterns = [ + path('', views.index, name = "index"), + path('StudentLogin/', views.StudentLogin, name = "StudentLogin"), + path('StudentReg/', views.StudentReg, name = "StudentReg"), + path('TeacherLogin/', views.TeacherLogin, name = "TeacherLogin"), + path('TeacherReg/', views.TeacherReg, name = "TeacherReg"), + path('TeacherRequest/', views.TeacherRequest, name = "TeacherRequest"), + path('TermsAndPolicy/', views.TermsAndPolicy, name = "TermsAndPolicy"), +] + diff --git a/DjangoProject/Chatbot/views.py b/DjangoProject/Chatbot/views.py new file mode 100644 index 0000000..85cb4a3 --- /dev/null +++ b/DjangoProject/Chatbot/views.py @@ -0,0 +1,27 @@ +from django.shortcuts import render +from django.http import HttpResponse +# Create your views here. + +def home(request): + return HttpResponse("

Hello

") + +def index(request): + return render(request, 'webpages/index.html') + +def StudentLogin(request): + return render(request, 'webpages/StudentLogin.html') + +def StudentReg(request): + return render(request, 'webpages/StudentReg.html') + +def TeacherLogin(request): + return render(request, 'webpages/TeacherLogin.html') + +def TeacherReg(request): + return render(request, 'webpages/TeacherReg.html') + +def TeacherRequest(request): + return render(request, 'webpages/TeacherRequest.html') + +def TermsAndPolicy(request): + return render(request, 'webpages/TermsAndPolicy.html') \ No newline at end of file diff --git a/DjangoProject/DjangoProject/__pycache__/__init__.cpython-37.pyc b/DjangoProject/DjangoProject/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000..01c6c09 Binary files /dev/null and b/DjangoProject/DjangoProject/__pycache__/__init__.cpython-37.pyc differ diff --git a/DjangoProject/DjangoProject/__pycache__/settings.cpython-37.pyc b/DjangoProject/DjangoProject/__pycache__/settings.cpython-37.pyc new file mode 100644 index 0000000..cdc5d10 Binary files /dev/null and b/DjangoProject/DjangoProject/__pycache__/settings.cpython-37.pyc differ diff --git a/DjangoProject/DjangoProject/__pycache__/urls.cpython-37.pyc b/DjangoProject/DjangoProject/__pycache__/urls.cpython-37.pyc new file mode 100644 index 0000000..99d482d Binary files /dev/null and b/DjangoProject/DjangoProject/__pycache__/urls.cpython-37.pyc differ diff --git a/DjangoProject/DjangoProject/__pycache__/wsgi.cpython-37.pyc b/DjangoProject/DjangoProject/__pycache__/wsgi.cpython-37.pyc new file mode 100644 index 0000000..7052ac5 Binary files /dev/null and b/DjangoProject/DjangoProject/__pycache__/wsgi.cpython-37.pyc differ diff --git a/DjangoProject/DjangoProject/settings.py b/DjangoProject/DjangoProject/settings.py new file mode 100644 index 0000000..1b18718 --- /dev/null +++ b/DjangoProject/DjangoProject/settings.py @@ -0,0 +1,125 @@ +""" +Django settings for DjangoProject project. + +Generated by 'django-admin startproject' using Django 2.2.6. + +For more information on this file, see +https://docs.djangoproject.com/en/2.2/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/2.2/ref/settings/ +""" + +import os + +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'w=_-q7g+v1!ywsbgyqj^v^&agc^%9m2qq=%sbeas@*0eu4o=ys' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = [ + 'Chatbot.apps.ChatbotConfig', + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', +] + +MIDDLEWARE = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +] + +ROOT_URLCONF = 'DjangoProject.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'DjangoProject.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/2.2/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + } +} + + +# Password validation +# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + + +# Internationalization +# https://docs.djangoproject.com/en/2.2/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/2.2/howto/static-files/ + +STATIC_URL = '/static/css/' + +STATICFILES_DIRS = [ + os.path.join(BASE_DIR,"Chatbot/static/css/files") +] diff --git a/DjangoProject/DjangoProject/urls.py b/DjangoProject/DjangoProject/urls.py new file mode 100644 index 0000000..cfa0aa7 --- /dev/null +++ b/DjangoProject/DjangoProject/urls.py @@ -0,0 +1,25 @@ +"""DjangoProject URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/2.2/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: path('', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.urls import include, path + 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) +""" +from django.contrib import admin +from django.urls import path, include +from django.contrib.staticfiles.urls import staticfiles_urlpatterns + +urlpatterns = [ + path('admin/', admin.site.urls), + path('', include("Chatbot.urls")), + ] + +urlpatterns += staticfiles_urlpatterns() diff --git a/DjangoProject/DjangoProject/wsgi.py b/DjangoProject/DjangoProject/wsgi.py new file mode 100644 index 0000000..afc1411 --- /dev/null +++ b/DjangoProject/DjangoProject/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for DjangoProject project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'DjangoProject.settings') + +application = get_wsgi_application() diff --git a/DjangoProject/manage.py b/DjangoProject/manage.py new file mode 100644 index 0000000..5ab2319 --- /dev/null +++ b/DjangoProject/manage.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python +"""Django's command-line utility for administrative tasks.""" +import os +import sys + + +def main(): + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'DjangoProject.settings') + try: + from django.core.management import execute_from_command_line + except ImportError as exc: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) from exc + execute_from_command_line(sys.argv) + + +if __name__ == '__main__': + main() diff --git a/my-site/Webpages/Bot/SQLite.db b/my-site/Webpages/Bot/SQLite.db new file mode 100644 index 0000000..20ff750 Binary files /dev/null and b/my-site/Webpages/Bot/SQLite.db differ diff --git a/my-site/Webpages/Bot/cosgraph.png b/my-site/Webpages/Bot/cosgraph.png new file mode 100644 index 0000000..b5cab6a Binary files /dev/null and b/my-site/Webpages/Bot/cosgraph.png differ diff --git a/my-site/Webpages/Bot/jsonTest.json b/my-site/Webpages/Bot/jsonTest.json new file mode 100644 index 0000000..ecb58e7 --- /dev/null +++ b/my-site/Webpages/Bot/jsonTest.json @@ -0,0 +1,20 @@ +{ + "conversion":[ + { + "cmm":"float(numTo) / 100", + "feetm":"float(numTo) * 0.3048", + "inchesm":"float(numTo) * 0.0254", + "inchescm":"float(numTo) * 2.54", + "cmkm":"float(numTo) / 1000", + "cmmm":"float(numTo) * 10", + "mcm":"float(numTo) * 100", + "cminches":"float(numTo) / 2.54", + "cf":"1.8 * float(numTo) + 32", + "fc":"(float(numTo)- 32)/ 1.8", + "stkg":"round(float(numTo) * 6.35029)", + "lbkg":"round(float(numTo) * 0.453592)", + "kgst":"round(float(numTo) * 0.157473)", + "kglb":"round(float(numTo) * 0.157473)" + } + ] +} \ No newline at end of file diff --git a/my-site/Webpages/Bot/newGraph.png b/my-site/Webpages/Bot/newGraph.png new file mode 100644 index 0000000..6a57615 Binary files /dev/null and b/my-site/Webpages/Bot/newGraph.png differ diff --git a/my-site/Webpages/Bot/pythBot (3).py b/my-site/Webpages/Bot/pythBot (3).py new file mode 100644 index 0000000..982db46 --- /dev/null +++ b/my-site/Webpages/Bot/pythBot (3).py @@ -0,0 +1,370 @@ +import discord +from discord.ext import commands +import math +import string +import matplotlib.pyplot as plt +from discord.utils import get +import sqlite3 +import time +import json +from datetime import datetime +import numpy as np + +try: + conn = sqlite3.connect('SQLite.db') + print("Connected") + +except Exception as e: + print("Error connecting",str(e)) + +sqlclean = ["(",")",",","'"] + +client = commands.Bot(command_prefix = '') +lengthStr = 0 +contents = '' +msgAuth = '' +inQuiz = False +topic = '' +cursor = conn.cursor() +numbers = ["", ""] +questions = [] +counter = 0 +topicsIn = [] +questNum = 0 +questionsAns = 0; +userInQuiz = '' +longTpc = False +operatorPass = '' +lastDigit = False +topicCount = 0 +inConvert = False +inQuiz = False +timeSinceLast = 0 +cursor = conn.cursor() +cursor2 = conn.cursor() +questions = [] +answers = [] +questionNum = -1 +score = 0 +units = ["cm", "m", "f", "c", "kg", "st", "lb", "inches", "feet"] +sendToTeach = False +aggScore = 0 +numOfQs = 0 + +def writeToFile(user, question): + cursor.execute("INSERT INTO tbl_userQuestions (Question,User) VALUES (?,?)", (question,user)) + conn.commit() + + + +def scoreFunc(user, scorePass): + global timeSinceLast + currentScore = 0 + nowScore = cursor.execute("SELECT Score FROM tbl_users WHERE UserID = '{}'".format(str(user))) + nowScore = str(cursor.fetchone()) + for char in string.punctuation: + nowScore = nowScore.replace(char, '') + + print(timeSinceLast) + if time.time() > timeSinceLast + 5: + currentScore = int(nowScore) + scorePass + timeSinceLast = time.time() + cursor.execute('''UPDATE tbl_users SET Score = ? WHERE UserID = ?''', (str(currentScore), str(user))) + conn.commit() + +async def serverCreate(server, auth, channel): + await server.create_role(name="Teacher", colour=discord.Colour(0xffe600)) + await server.create_role(name="Student", colour=discord.Colour(0x00fffb)) + await channel.delete() + await server.create_text_channel("General") + await server.create_text_channel("Discussion") + await server.create_text_channel("Help") + + +async def convertFunc(numTo, unitFrom, unitTo, author): + ans = 0 + with open("jsonTest.json") as json_file: + data = json.load(json_file) + for p in data['conversion']: + print(p[unitFrom + unitTo]) + ans = eval(p[unitFrom + unitTo]) + print(ans) + await author.send(ans) + +async def startQuiz(topic,ctx): + global questionNum + global maxrows + global numOfQs + maxrows = cursor.execute("SELECT COUNT(*) FROM tbl_questions WHERE Topic = '{}'".format(topic)) + maxrows =str(cursor.fetchone()) + for char in string.punctuation: + maxrows = maxrows.replace(char, '') + maxrows = int(maxrows) + numberofquestions = maxrows + if questionNum == -1: + questionNum += 1 + numOfQs = maxrows + await ctx.send('Loading {} Test with {} questions'.format(topic,numberofquestions)) + + results = cursor.execute("SELECT Question FROM tbl_questions WHERE Topic = '{}' ORDER BY RANDOM() LIMIT {}".format(topic,numberofquestions)) + for x in range(0,numberofquestions): + results=str(cursor.fetchone()) + for punctuation in sqlclean: + results = results.replace(punctuation, '') + questions.append(results) +## await ctx.send('Question {}: {}?'.format(x+1,results)) + + answer = cursor2.execute("SELECT Answer FROM tbl_questions WHERE Question = '{}'".format(results)) + answer=str(cursor2.fetchone()) + for punctuation in sqlclean: + answer = answer.replace(punctuation, '') +## print(answer) + answers.append(answer) + await ctx.send(questions[questionNum]) + conn.commit() + global inQuiz + inQuiz = True + return(numOfQs, inQuiz) + +async def newQuestion(user, question): + results = conn.execute("SELECT * FROM tbl_questions") + splitQuest = question.split(" ") + userFound = False + print(results) + for row in results: + if str(user) in row and "Teacher" in row: + userFound = True + if userFound == True: + cursor.execute("INSERT INTO quizQuestions(Question,Answer,Topic) VALUES (?,?,?)", (splitQuest[2],splitQuest[3],splitQuest[4])) + await user.send("Question added to quiz") + else: + await user.send("Sorry, you do not have the correct permissions to add questions") + conn.commit() + +async def sinGraph(author): + with open('singraph.png', 'rb') as fp: + await author.send(file=discord.File(fp, 'singraph.png')) + +async def cosGraph(author): + with open('cosgraph.png', 'rb') as fp: + await author.send(file=discord.File(fp, 'cosgraph.png')) + +async def calculator(operator, numbers, author): + if operator == "+": + await author.send(float(numbers[0]) + float(numbers[1])) + if operator == "-": + await author.send(float(numbers[0]) - float(numbers[1])) + if operator == "*": + await author.send(float(numbers[0]) * float(numbers[1])) + if operator == "/": + await author.send(float(numbers[0]) / float(numbers[1])) + +testStr = "" +@client.event +async def on_ready(): + print('Bot is ready.') + + +@client.event +async def on_member_join(member): + students = cursor.execute("SELECT UserID FROM tbl_users WHERE AccountType = 'Student'") + students = cursor.fetchall() + role = get(member.guild.roles, name='Student') + for row in students: + print(row) + if str(member) in row: + await member.add_roles(role) + return() + else: + print("Failes") + await member.guild.kick(member) + await member.send("Sorry, you are not registered, please visit the website to sign up.") + + +@client.event +async def on_message(message): # event that happens per any message. + print(f"{message.channel}: {message.author}: {message.author.name}: {message.content}") + global inQuiz + global sendToTeach + global numOfQs + if "create server" in message.content.lower(): + await serverCreate(message.guild, message.author, message.channel) + if message.author == client.user: + return + if "convert" in message.content.lower(): + numTo = 0 + unitTo = "" + unitFrom = "" + posNum = 0 + foundNum = False + foundUnit = False + conStr = message.content.lower().split(" ") + for i in range(0, len(conStr)): + if conStr[i].isdigit() == True and foundNum == False: + numTo = float(conStr[i]) + foundNum = True + if conStr[i] in units: + if posNum < i and foundUnit == False: + unitNum = i + unitFrom = conStr[i] + foundUnit = True + else: + unitTo = conStr[i] + if numTo == 0 or unitTo == "" or unitFrom == "": + await message.author.send("Sorry, I could convert that.") + else: + await convertFunc(numTo, unitFrom, unitTo, message.author) + if "sin" in message.content.lower() and "graph" in message.content.lower(): + await sinGraph(message.author) + scoreFunc(message.author, 1) + return() + if "cos" in message.content.lower() and "graph" in message.content.lower(): + await cosGraph(message.author) + scoreFunc(message.author, 1) + return() + if sendToTeach == True: + global questionToAsk + if "yes" in message.content.lower(): + writeToFile(str(message.author), str(questionToAsk)) + await message.channel.send("Sending question to teacher.") + else: + await message.channel.send("Okay, not sending question to teacher") + sendToTeach = False + return(sendToTeach) + if inQuiz == True: + global questionNum + global score + global topic + userAnswer = message.content + if userAnswer == (answers[questionNum]): + await message.channel.send('Correct') + if questionNum >= (numOfQs - 1): + await message.channel.send('End of Test') + inQuiz = False + questionNum = -1 + storescore = conn.execute("INSERT into tbl_scores (Username,Score,TestType) VALUES (?,?,?)",(str(message.author),score,topic)) + score = score+1 + await message.channel.send("You scored " + str(score) + " out of " + str(numOfQs)) + conn.commit() + scoreFunc(message.author, score) + return(questionNum, inQuiz) + else: + questionNum += 1 + score = score+1 + await startQuiz(topic, message.channel) + else: + await message.channel.send('Incorrect') + if questionNum >= (numOfQs - 1): + await message.channel.send('End of Test') + inQuiz = False + questionNum = -1 + storescore = conn.execute("INSERT into tbl_scores (Username,Score,TestType) VALUES (?,?,?)",(str(message.author),score,topic)) + await message.channel.send("You scored " + str(score) + " out of " + str(numOfQs)) + conn.commit() + scoreFunc(message.author, score) + return(questionNum, inQuiz) + else: + questionNum +=1 + await startQuiz(topic, message.channel) + print("wrong") + if "graph" in message.content.lower(): + msg = message.content.lower() + newMsg = msg.split(" ") + lenYArg = newMsg[len(newMsg) - 1] + yValue = lenYArg[2:len(lenYArg)] + fig = plt.figure() + x = np.linspace(2*-np.pi, 2*np.pi, 100) + y = eval(yValue) + ax = plt.gca() + ax.plot(x, y) + ax.grid(True) + ax.spines['left'].set_position('zero') + ax.spines['right'].set_color('none') + ax.spines['bottom'].set_position('zero') + ax.spines['top'].set_color('none') + plt.xlim(2*-np.pi,2*np.pi) + plt.savefig("newGraph.png") + with open('newGraph.png', 'rb') as fp: + await message.author.send(file=discord.File(fp, 'newGraph.png')) + scoreFunc(message.author, 5) + return() + if "new" in message.content.lower() and "question" in message.content.lower(): + await newQuestion(message.author, message.content.lower()) + return() + if "+" in message.content.lower() or "-" in message.content.lower() or "/" in message.content.lower() or "*" in message.content.lower(): + global operatorPass + global lastDigit + msg = message.content.lower() + global numbers + author = message.author + numbers[0] = 0 + lastDigit = False + numbers[1] = 0 + count = 0 + numberList = 0 + done = False + while done == False: + if count >= len(msg) - 1: + done = True + if msg[count] == "+" or msg[count] == "-" or msg[count] == "*" or msg[count] == "/" : + operatorPass = msg[count] + numberList = 1 + if msg[count].isdigit() == True: + if lastDigit == True: + numbers[numberList] += msg[count] + else: + numbers[numberList] = msg[count] + lastDigit = True + elif msg[count] == ".": + numbers[numberList] += "." + lastDigit = True + else: + lastDigit = False + count += 1 + await calculator(operatorPass, numbers, author) + scoreFunc(message.author, 2) + return() + if "specific" in message.content.lower() and "question" in message.content.lower(): + inQuestion = message.content + askedQ = "" + inStringQ = inQuestion.split(" ") + userQuestion = inStringQ[2:len(inStringQ)] + for i in range(0, len(userQuestion)): + askedQ += userQuestion[i] + " " + specQuestion = cursor.execute("SELECT Answer FROM tbl_specQuestions WHERE Question = '{}'".format(askedQ)) + specQuestion = cursor.fetchone(); + if askedQ == specQuestion: + await message.channel.send(specQuestion) + else: + await message.channel.send("Sorry, I don't know the answer to that, would you like me to send a question to the teacher?") + sendToTeach = True + questionToAsk = askedQ + return(sendToTeach, questionToAsk) + if "what is" in message.content.lower() or "how" in message.content.lower(): + print(str(message.content)) + writeToFile(str(message.author), str(message.content)) + await message.channel.send("Question sent to the teacher.") + if "quiz" in message.content.lower() and "i want" in message.content.lower(): + inString = message.content + quizStr = inString.split(" ") + topics = cursor.execute("SELECT Topic FROM tbl_questions") + topics = cursor.fetchall() + topics = ["Maths","Science"] + for i in range(0,len(quizStr)): + if quizStr[i] in topics: + topic = quizStr[i] + await startQuiz(topic, message.channel) + await message.channel.send("Sorry, we don't have that quiz available.") + + +#@client.command() +#async def question(ctx, a: str): +# f= open("questions.txt","a+") +# f.write (str(ctx.message.author) + " " + a + "\n") +# f.close() +# await ctx.send(a) +#NjM4NTczNjcyMDAwNTIwMjAy.XbesHA.FNpICJ4J23UHubFxw5aXOE_y-9w +#NjM0NzIwNjY5NTAyMDEzNDcx.XbN_AA.yEuduzPPFeWep_gZ14948pWW2Ig +#NjMwNDYyMjk4NjExNTE1Mzkz.XciB-w.XF2Are-iPoYn9jbRkh1N7oGQEmM +client.run('NjM4NTczNjcyMDAwNTIwMjAy.XbesHA.FNpICJ4J23UHubFxw5aXOE_y-9w') + diff --git a/my-site/Webpages/Bot/pythjJson.py b/my-site/Webpages/Bot/pythjJson.py new file mode 100644 index 0000000..ff5c390 --- /dev/null +++ b/my-site/Webpages/Bot/pythjJson.py @@ -0,0 +1,6 @@ +import json + +with open("jsonTest.json") as json_file: + data = json.load(json_file) + for p in data['conversion']: + print(p[unitFrom + unitTo]) diff --git a/my-site/Webpages/Bot/singraph.png b/my-site/Webpages/Bot/singraph.png new file mode 100644 index 0000000..7a7621f Binary files /dev/null and b/my-site/Webpages/Bot/singraph.png differ diff --git a/my-site/Webpages/Bot/tesDb.db b/my-site/Webpages/Bot/tesDb.db new file mode 100644 index 0000000..b8294bf Binary files /dev/null and b/my-site/Webpages/Bot/tesDb.db differ diff --git a/my-site/Webpages/Bot/wrongFunc.py b/my-site/Webpages/Bot/wrongFunc.py new file mode 100644 index 0000000..4dc40da --- /dev/null +++ b/my-site/Webpages/Bot/wrongFunc.py @@ -0,0 +1,390 @@ +import discord +from discord.ext import commands +import math +import string +'import matplotlib.pyplot as plt' +import sqlite3 +import time +from datetime import datetime +#import numpy as np + +try: + conn = sqlite3.connect('SQLite.db') + print("Connected") + +except Exception as e: + print("Error connecting",str(e)) + +sqlclean = ["(",")",",","'"] + +client = commands.Bot(command_prefix = '') +lengthStr = 0 +contents = '' +msgAuth = '' +inQuiz = False +topic = '' +cursor = conn.cursor() +numbers = ["", ""] +questions = [] +counter = 0 +topicsIn = [] +questNum = 0 +questionsAns = 0; +userInQuiz = '' +longTpc = False +operatorPass = '' +lastDigit = False +topicCount = 0 +inQuiz = False +timeSinceLast = 0 +cursor = conn.cursor() +cursor2 = conn.cursor() +questions = [] +answers = [] +questionNum = -1 +score = 0 +sendToTeach = False +aggScore = 0 +numOfQs = 0 + +def writeToFile(user, question): +## cursor.execute("INSERT INTO tbl_Questions (Question,User) VALUES (?,?)", (question,user)) + conn.commit() +def scoreFunc(user, scorePass): + global timeSinceLast + currentScore = 0 + nowScore = cursor.execute("SELECT Score FROM tbl_users WHERE UserID = '{}'".format(str(user))) + nowScore = str(cursor.fetchone()) + for char in string.punctuation: + nowScore = nowScore.replace(char, '') + + print(timeSinceLast) + if time.time() > timeSinceLast + 5: + currentScore = int(nowScore) + scorePass + timeSinceLast = time.time() + cursor.execute('''UPDATE tbl_users SET Score = ? WHERE UserID = ?''', (str(currentScore), str(user))) + conn.commit() + +async def startQuiz(topic,ctx): + global questionNum + global maxrows + global numOfQs + maxrows = cursor.execute("SELECT COUNT(*) FROM tbl_questions WHERE Topic = '{}'".format(topic)) + maxrows =str(cursor.fetchone()) + for char in string.punctuation: + maxrows = maxrows.replace(char, '') + maxrows = int(maxrows) + numberofquestions = maxrows + if questionNum == -1: + questionNum += 1 + numOfQs = maxrows + await ctx.send('Loading {} Test with {} questions'.format(topic,numberofquestions)) + + results = cursor.execute("SELECT Question FROM tbl_questions WHERE Topic = '{}' ORDER BY RANDOM() LIMIT {}".format(topic,numberofquestions)) + for x in range(0,numberofquestions): + results=str(cursor.fetchone()) + for punctuation in sqlclean: + results = results.replace(punctuation, '') + questions.append(results) +## await ctx.send('Question {}: {}?'.format(x+1,results)) + + answer = cursor2.execute("SELECT Answer FROM tbl_questions WHERE Question = '{}'".format(results)) + answer=str(cursor2.fetchone()) + for punctuation in sqlclean: + answer = answer.replace(punctuation, '') +## print(answer) + answers.append(answer) + await ctx.send(questions[questionNum]) + conn.commit() + global inQuiz + inQuiz = True + return(numOfQs, inQuiz) + +async def newQuestion(user, question): + results = conn.execute("SELECT * FROM tbl_questions") + splitQuest = question.split(" ") + userFound = False + print(results) + for row in results: + if str(user) in row and "Teacher" in row: + userFound = True + if userFound == True: + cursor.execute("INSERT INTO quizQuestions(Question,Answer,Topic) VALUES (?,?,?)", (splitQuest[2],splitQuest[3],splitQuest[4])) + await user.send("Question added to quiz") + else: + await user.send("Sorry, you do not have the correct permissions to add questions") + conn.commit() + +async def sinGraph(author): + with open('singraph.png', 'rb') as fp: + await author.send(file=discord.File(fp, 'singraph.png')) + +async def cosGraph(author): + with open('cosgraph.png', 'rb') as fp: + await author.send(file=discord.File(fp, 'cosgraph.png')) + +async def calculator(operator, numbers, author): + if operator == "+": + await author.send(float(numbers[0]) + float(numbers[1])) + if operator == "-": + await author.send(float(numbers[0]) - float(numbers[1])) + if operator == "*": + await author.send(float(numbers[0]) * float(numbers[1])) + if operator == "/": + await author.send(float(numbers[0]) / float(numbers[1])) + +testStr = "" +@client.event +async def on_ready(): + print('Bot is ready.') + +@client.event +async def on_message(message): # event that happens per any message. + print(f"{message.channel}: {message.author}: {message.author.name}: {message.content}") + global inQuiz + global sendToTeach + global numOfQs + if message.author == client.user: + return + if "sin" in message.content.lower() and "graph" in message.content.lower(): + await sinGraph(message.author) + scoreFunc(message.author, 1) + return() + if "cos" in message.content.lower() and "graph" in message.content.lower(): + await cosGraph(message.author) + scoreFunc(message.author, 1) + return() + if sendToTeach == True: + global questionToAsk + if "yes" in message.content.lower(): + writeToFile(str(message.author), str(questionToAsk)) + await message.channel.send("Sending question to teacher.") + else: + await message.channel.send("Okay, not sending question to teacher") + sendToTeach = False + return(sendToTeach) + if inQuiz == True: + global questionNum + global score + global topic + userAnswer = message.content + if userAnswer == (answers[questionNum]): + await message.channel.send('Correct') + if questionNum >= (numOfQs - 1): + await message.channel.send('End of Test') + inQuiz = False + questionNum = -1 + storescore = conn.execute("INSERT into tbl_scores (Username,Score,TestType) VALUES (?,?,?)",(str(message.author),score,topic)) + score = score+1 + await message.channel.send("You scored " + str(score) + " out of " + str(numOfQs)) + conn.commit() + scoreFunc(message.author, score) + return(questionNum, inQuiz) + else: + questionNum += 1 + score = score+1 + await startQuiz(topic, message.channel) + else: + await message.channel.send('Incorrect') + if questionNum >= (numOfQs - 1): + await message.channel.send('End of Test') + inQuiz = False + questionNum = -1 + storescore = conn.execute("INSERT into tbl_scores (Username,Score,TestType) VALUES (?,?,?)",(str(message.author),score,topic)) + await message.channel.send("You scored " + str(score) + " out of " + str(numOfQs)) + conn.commit() + scoreFunc(message.author, score) + return(questionNum, inQuiz) + else: + questionNum +=1 + await startQuiz(topic, message.channel) + print("wrong") + if "graph" in message.content.lower(): + msg = message.content.lower() + newMsg = msg.split(" ") + lenYArg = newMsg[len(newMsg) - 1] + yValue = lenYArg[2:len(lenYArg)] + fig = plt.figure() + x = np.linspace(2*-np.pi, 2*np.pi, 100) + y = eval(yValue) + ax = plt.gca() + ax.plot(x, y) + ax.grid(True) + ax.spines['left'].set_position('zero') + ax.spines['right'].set_color('none') + ax.spines['bottom'].set_position('zero') + ax.spines['top'].set_color('none') + plt.xlim(2*-np.pi,2*np.pi) + plt.savefig("newGraph.png") + with open('newGraph.png', 'rb') as fp: + await message.author.send(file=discord.File(fp, 'newGraph.png')) + scoreFunc(message.author, 5) + return() + if "new" in message.content.lower() and "question" in message.content.lower(): + await newQuestion(message.author, message.content.lower()) + return() + if "+" in message.content.lower() or "-" in message.content.lower() or "/" in message.content.lower() or "*" in message.content.lower(): + global operatorPass + global lastDigit + msg = message.content.lower() + global numbers + author = message.author + numbers[0] = 0 + lastDigit = False + numbers[1] = 0 + count = 0 + numberList = 0 + done = False + while done == False: + if count >= len(msg) - 1: + done = True + if msg[count] == "+" or msg[count] == "-" or msg[count] == "*" or msg[count] == "/" : + operatorPass = msg[count] + numberList = 1 + if msg[count].isdigit() == True: + if lastDigit == True: + numbers[numberList] += msg[count] + else: + numbers[numberList] = msg[count] + lastDigit = True + elif msg[count] == ".": + numbers[numberList] += "." + lastDigit = True + else: + lastDigit = False + count += 1 + await calculator(operatorPass, numbers, author) + scoreFunc(message.author, 2) + return() + if "specific" in message.content.lower() and "question" in message.content.lower(): + inQuestion = message.content + askedQ = "" + inStringQ = inQuestion.split(" ") + userQuestion = inStringQ[2:len(inStringQ)] + for i in range(0, len(userQuestion)): + askedQ += userQuestion[i] + " " + specQuestion = cursor.execute("SELECT Answer FROM tbl_specQuestions WHERE Question = '{}'".format(askedQ)) + specQuestion = cursor.fetchone(); + if askedQ == specQuestion: + await message.channel.send(specQuestion) + else: + await message.channel.send("Sorry, I don't know the answer to that, would you like me to send a question to the teacher?") + sendToTeach = True + questionToAsk = askedQ + return(sendToTeach, questionToAsk) + if "what is" in message.content.lower() or "how" in message.content.lower(): + print(str(message.content)) + writeToFile(str(message.author), str(message.content)) + await message.channel.send("Question sent to the teacher.") + if "show me the progress of" in message.content.lower(): + await message.channel.send("Loading Student Progress") + progressmsg = message.content + studentid = progressmsg.replace('show me the progress of ','') + print (progressmsg) + results = cursor.execute("SELECT Score, TestDate FROM tbl_scores WHERE Username = '{}'".format(studentid)) + results = cursor.fetchall() + await message.channel.send(results) + + + if "quiz" in message.content.lower() and "i want" in message.content.lower(): + inString = message.content + quizStr = inString.split(" ") + topics = cursor.execute("SELECT Topic FROM tbl_questions") + topics = cursor.fetchall() + topics = ["Maths","Science"] + for i in range(0,len(quizStr)): + if quizStr[i] in topics: + topic = quizStr[i] + await startQuiz(topic, message.channel) + await message.channel.send("Sorry, we don't have that quiz available.") + + if "convert" in message.content.lower(): + await message.channel.send("Do you want to: \n1.Convert Centigrade to Farenheit \n2.Convert Farenheit to Centigrade \n3.Convert Stones to KG \n4.Convert Pounds to KG \n5.Convert KG to Stones \n6.Convert KG to Pounds \n7.Convert Feet to Meters \n8.Convert Inches to Meters \n9.Run a Basic Compound Interest Calculator \n10.Run a Complex Compound Interest Calculator \n11.Exit\n") + condition = True + while condition == True: + ConverterOption = message.content + if "1" in ConverterOption: + print("Hello") + await message.channel.send("You have chosen to Convert Centigrade to Farenheit") + await message.channel.send("Input the weather in Centigrade") + C = message.content.lower() + F = 1.8 * C + 32 + await message.channel.send("Amount of Faren " + str(F)) + condition = False + + elif "2" in ConverterOption: + await message.channel.send("You have chosen to Convert Farenheit to Centigrade") + await message.channel.send("Input the weather in Farenheit") + C = (F- 32)/ 1.8 + await message.channel.send("Amount of Centigrade " + str(C)) + + elif "3" in ConverterOption: + await message.channel.send("You have choose to Convert Stones to KG") + await message.channel.send("How much stones do you weight?") + StoneToKg = round(stone * 6.35029) + await message.channel.send("You weight {0} Kg".format(StoneToKg)) + + elif "4" in ConverterOption: + await message.channel.send("You have choose to Convert Pounds to KG") + pounds = float(input("How much pounds do you weight?")) + PoundsToKg = round(pounds * 0.453592) + await message.channel.send("You weight {0} Kg".format(PoundsToKg)) + + elif "5" in ConverterOption: + await message.channel.send("You have choose to Convert KG to Stones") + kg = float(input("How much Kg do you weight?")) + KgToStone = round(kg * 0.157473) + await message.channel.send("You weight {0} Kg".format(KgToStone)) + + elif "6" in ConverterOption: + await message.channel.send("You have choose to Convert KG to Pounds") + kg = float(input("How much Kg do you weight?")) + KgToPounds = round(kg * 2.20462) + await message.channel.send("You weight {0} Kg".format(KgToPounds)) + + elif "7" in ConverterOption: + await message.channel.send("You have chosen to Convert Feet to Meters") + Feet_Value = input("Input the amount of Feet you want to convert to Meters") + MetersToFeet = float(Feet_Value) * 0.3048 + await message.channel.send("You are {0} Feet tall".format(MetersToFeet)) + + elif "8" in ConverterOption: + await message.channel.send("You have chosen to Convert Inches to Meters ") + Inches_Value = input("Input the amount of Inches you want to convert to Meters") + InchesToFeet = float(Inches_Value) * 0.0254 + await message.channel.send("You are {0} Feet tall".format(InchesToFeet)) + + elif "9" in ConverterOption: + await message.channel.send("You have chosen to Run a Basic Compound Interest Calculator") + deposit = int(input("How much money do you want to deposit in the account?")) + interest = int(input("What is the variable interest rate?")) + years = int(input("How many years is the money going to be deposited in the account?")) + value = (deposit * (((1 + interest /100)** years))) + await message.channel.send(value) + + elif "10" in ConverterOption: + await message.channel.send("You have chosen to Run a Complex Compound Interest Calculator") + deposit = int(input("How much money do you want to deposit in the account?")) + interest = int(input("What is the variable interest rate for the first set of years?")) + years = int(input("For the first set of years, how many years is the money going to be deposited in the account?")) + interest2 = int(input("What is the variable interest rate for the second set of years?")) + years2 = int(input("For the second set of years, how many years is the money going to be deposited in the account?")) + value = (deposit * (1 + interest/100)** years) + (deposit * (1 + interest2/100)**years2) + await message.channel.send(value) + + elif "11" in ConverterOption: + await message.channel.send("Bye") + condition = False + + +#@client.command() +#async def question(ctx, a: str): +# f= open("questions.txt","a+") +# f.write (str(ctx.message.author) + " " + a + "\n") +# f.close() +# await ctx.send(a) +#NjM4NTczNjcyMDAwNTIwMjAy.XbesHA.FNpICJ4J23UHubFxw5aXOE_y-9w +#NjI2MDc5MjgwODM2NjQwNzY4.XcVzpA.YIP5Rs77FJJgS6mkBqcG9KCRoig - mbot +#NjM0NzIwNjY5NTAyMDEzNDcx.XbN_AA.yEuduzPPFeWep_gZ14948pWW2Ig +client.run('NjM0NzIwNjY5NTAyMDEzNDcx.XbN_AA.yEuduzPPFeWep_gZ14948pWW2Ig') + diff --git a/my-site/Webpages/CenterOriginMatplotlib01.png b/my-site/Webpages/CenterOriginMatplotlib01.png new file mode 100644 index 0000000..58da6b5 Binary files /dev/null and b/my-site/Webpages/CenterOriginMatplotlib01.png differ diff --git a/my-site/Webpages/ContactIcon.png b/my-site/Webpages/ContactIcon.png new file mode 100644 index 0000000..9f7cd73 Binary files /dev/null and b/my-site/Webpages/ContactIcon.png differ diff --git a/my-site/Webpages/DiscordIcon.png b/my-site/Webpages/DiscordIcon.png new file mode 100644 index 0000000..ba8f06f Binary files /dev/null and b/my-site/Webpages/DiscordIcon.png differ diff --git a/my-site/Webpages/StudentLogin.html b/my-site/Webpages/StudentLogin.html new file mode 100644 index 0000000..c252cb0 --- /dev/null +++ b/my-site/Webpages/StudentLogin.html @@ -0,0 +1,49 @@ + + + + + + + + Student Login + + + + +
+ Student Login +
+ + +
+
+ + + + + + + + + + Remember me +
+ Not a user ? .Click Here +
+ + + + + + \ No newline at end of file diff --git a/my-site/Webpages/StudentReg.html b/my-site/Webpages/StudentReg.html new file mode 100644 index 0000000..118a517 --- /dev/null +++ b/my-site/Webpages/StudentReg.html @@ -0,0 +1,73 @@ + + + + + + + + Student Registration + + + + +
+ Student Registration +
+ + +
+
+
+ + + + + + + + + + + + + + Remember me +

By creating an account you agree to our Terms & Privacy.

+
+ +
+ + +
+
+ + + + \ No newline at end of file diff --git a/my-site/Webpages/TeacherLogin.html b/my-site/Webpages/TeacherLogin.html new file mode 100644 index 0000000..81edd8e --- /dev/null +++ b/my-site/Webpages/TeacherLogin.html @@ -0,0 +1,49 @@ + + + + + + + + Teacher Login + + + + +
+ Teacher Login +
+ + +
+
+ + + + + + + + + + Remember me +
+ Not a user ? .Click Here +
+ + + + + + \ No newline at end of file diff --git a/my-site/Webpages/TeacherReg.html b/my-site/Webpages/TeacherReg.html new file mode 100644 index 0000000..ae5415b --- /dev/null +++ b/my-site/Webpages/TeacherReg.html @@ -0,0 +1,56 @@ + + + + + + + + Teacher Registration + + + + + +
+ Teacher Registration +
+ + +
+
+ + + + + + + + + + + + + + Remember me +

By creating an account you agree to our Terms & Privacy.

+
+ +
+ + +
+ + + + \ No newline at end of file diff --git a/my-site/Webpages/TeacherRequest.html b/my-site/Webpages/TeacherRequest.html new file mode 100644 index 0000000..afb1ef2 --- /dev/null +++ b/my-site/Webpages/TeacherRequest.html @@ -0,0 +1,37 @@ + + + + + + + + Teacher Request + + + +
+ Teacher Request +
+ + +
+
+ +
+ + +
+ + + + + + \ No newline at end of file diff --git a/my-site/Webpages/TermsAndPolicy.html b/my-site/Webpages/TermsAndPolicy.html new file mode 100644 index 0000000..2301623 --- /dev/null +++ b/my-site/Webpages/TermsAndPolicy.html @@ -0,0 +1,92 @@ + + + + + + + + Terms And Policy + + +
+ Terms And Policy +
+ + +
+ +Teaching Portal Terms of Service +
+
+ +1. Terms +
+
+By accessing the website at http://www.TeachingPortal.com, you are agreeing to be bound by these terms of service, all applicable laws and regulations, and agree that you are responsible for compliance with any applicable local laws. If you do not agree with any of these terms, you are prohibited from using or accessing this site. The materials contained in this website are protected by applicable copyright and trademark law. +
+
+ +2. Use License +
+
+Permission is granted to temporarily download one copy of the materials (information or software) on Teaching Portal's website for personal, non-commercial transitory viewing only. This is the grant of a license, not a transfer of title, and under this license you may not: +modify or copy the materials; +use the materials for any commercial purpose, or for any public display (commercial or non-commercial); +attempt to decompile or reverse engineer any software contained on Teaching Portal's website; +remove any copyright or other proprietary notations from the materials; or +transfer the materials to another person or "mirror" the materials on any other server. +This license shall automatically terminate if you violate any of these restrictions and may be terminated by Teaching Portal at any time. Upon terminating your viewing of these materials or upon the termination of this license, you must destroy any downloaded materials in your possession whether in electronic or printed format. +
+
+ +3. Disclaimer +
+
+The materials on Teaching Portal's website are provided on an 'as is' basis. Teaching Portal makes no warranties, expressed or implied, and hereby disclaims and negates all other warranties including, without limitation, implied warranties or conditions of merchantability, fitness for a particular purpose, or non-infringement of intellectual property or other violation of rights. +Further, Teaching Portal does not warrant or make any representations concerning the accuracy, likely results, or reliability of the use of the materials on its website or otherwise relating to such materials or on any sites linked to this site. +
+
+ +4. Limitations +
+
+In no event shall Teaching Portal or its suppliers be liable for any damages (including, without limitation, damages for loss of data or profit, or due to business interruption) arising out of the use or inability to use the materials on Teaching Portal's website, even if Teaching Portal or a Teaching Portal authorized representative has been notified orally or in writing of the possibility of such damage. Because some jurisdictions do not allow limitations on implied warranties, or limitations of liability for consequential or incidental damages, these limitations may not apply to you. +
+
+ +5. Accuracy of materials +
+
+The materials appearing on Teaching Portal's website could include technical, typographical, or photographic errors. Teaching Portal does not warrant that any of the materials on its website are accurate, complete or current. Teaching Portal may make changes to the materials contained on its website at any time without notice. However Teaching Portal does not make any commitment to update the materials. +
+
+ +6. Links +
+
+Teaching Portal has not reviewed all of the sites linked to its website and is not responsible for the contents of any such linked site. The inclusion of any link does not imply endorsement by Teaching Portal of the site. Use of any such linked website is at the user's own risk. +
+
+ +7. Modifications +
+
+Teaching Portal may revise these terms of service for its website at any time without notice. By using this website you are agreeing to be bound by the then current version of these terms of service. +
+
+ +8. Governing Law +
+
+These terms and conditions are governed by and construed in accordance with the laws of Birmingham and you irrevocably submit to the exclusive jurisdiction of the courts in that State or location. + +
+ + + \ No newline at end of file diff --git a/my-site/Webpages/testFile.php b/my-site/Webpages/testFile.php new file mode 100644 index 0000000..2e5511f --- /dev/null +++ b/my-site/Webpages/testFile.php @@ -0,0 +1,30 @@ +open('Bot/tesDb.db'); + } +} + +$db = new MyDB(); +if(!$db) +{ + echo $db->lastErrorMsg(); +} +$discordID = $_POST['Username']; +$password = $_POST['psw']; +echo $_REQUEST['Username']; + +$prepare = $db->prepare("INSERT INTO users (discordID,password, accountType) VALUES (?,?,?)"); +$prepare->bindParam(1, $Question); +$prepare->bindParam(2, $passwordPass); +$prepare->bindParam(3, $accountType); + +$accountType = 'Teacher'; +$Question = $discordID; +$passwordPass = $password; +$prepare->execute(); +$prepare->close(); +?> \ No newline at end of file diff --git a/my-site/index.html b/my-site/index.html new file mode 100644 index 0000000..730e141 --- /dev/null +++ b/my-site/index.html @@ -0,0 +1,42 @@ + + + + + + + + Home Page + + +
+ Teaching Portal +
+ + +
+ + Welcome to our teaching portal where we ..... +
+
+ +
+
+ Discord: +
+ +
+
+ Email Us: +
+ +
+ + + + \ No newline at end of file diff --git a/my-site/style.css b/my-site/style.css new file mode 100644 index 0000000..711227a --- /dev/null +++ b/my-site/style.css @@ -0,0 +1,138 @@ +body +{ + background-color:#2A3132; +} + +#container { + width: 1200px; + height: 1100px; + margin: auto; + border:thick blue solid; + background-color: black; +} + +#title { + font-family: 'Times New Roman', Times, serif; + width: 1300px; + height: 50px; + text-align: center; +} + +#TextContainer { + background-color: black; + border: thick solid black; + font-family: 'Times New Roman', Times, serif; + width: 910px; + height: 362px; + float: right; +} + +#nav { + height: 40px; + border-bottom: thick blue solid; +} +nav { + margin: 0; + padding: 0; + background: blue url(nav_bg.jpg) 0 0 repeat-x; + width: 100%; + float: left; + border: 1px solid blue; + border-width: 1px 0; +} +nav li { + display:inline; + padding:0; + margin:0; +} + nav a:link, + nav a:visited { + color: #000; + background: blue; + padding: 20px 180px 10px 180px; + float: left; + width: auto; + border-right: 1px solid black; + text-decoration: none; + font: bold 1em/1em Arial, Helvetica, sans-serif; + text-transform: uppercase; + text-shadow: 2px 2px 2px #555; + } +nav a:hover { + color:#fff; + background:black; +} +nav li:first-child a { + border-left:1px solid black; +} +#home #nav-home a, +#about #nav-about a, +#archive #nav-archive a, +#lab #nav-lab a, +#reviews #nav-reviews a, +#contact #nav-contact a { + background:Black; + color:#fff; + text-shadow:none; +} +#home #nav-home a:hover, +#about #nav-about a:hover, +#archive #nav-archive a:hover, +#lab #nav-lab a:hover, +#reviews #nav-reviews a:hover, +#contact #nav-contact a:hover { + background:black; +} +nav a:active { + background: White; + color: #fff; +} + +input[type=text], input[type=password] { + width: 100%; + padding: 12px 20px; + margin: 8px 0; + display: inline-block; + border: 1px solid #ccc; + box-sizing: border-box; +} + +button { + background-color: #4CAF50; + color: white; + padding: 14px 20px; + margin: 8px 0; + border: none; + cursor: pointer; + width: 100%; +} + +.loginbutn { + width: 100%; +} + +.cancelbtn { + padding: 14px 20px; + background-color: #f44336; +} + +.cancelbtn, .signupbtn { + float: left; + width: 50%; +} + +.clearfix::after { + content: ""; + clear: both; + display: table; +} + +.spaceforlogin { + padding: 16px; +} + +@media screen and (max-width: 300px) { + .cancelbtn, .signupbtn { + width: 100%; + } +} diff --git a/my-site/website.py b/my-site/website.py new file mode 100644 index 0000000..75fac48 --- /dev/null +++ b/my-site/website.py @@ -0,0 +1,20 @@ +from http.server import HTTPServer, BaseHTTPRequestHandler + + +class Serv(BaseHTTPRequestHandler): + + def do_GET(self): + if self.path == '/': + self.path = '/index.html' + try: + file_to_open = open(self.path[1:]).read() + self.send_response(200) + except: + file_to_open = "File not found" + self.send_response(404) + self.end_headers() + self.wfile.write(bytes(file_to_open, 'utf-8')) + + +httpd = HTTPServer(('localhost', 8080), Serv) +httpd.serve_forever()