Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Impersonation-bot/help.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
executable file
75 lines (69 sloc)
3.62 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
#I learned and used how to get the date and time from https://docs.python.org/3/library/datetime.html | |
def time(): | |
now = datetime.datetime.now() | |
if now.hour >= 12: | |
return ("The time is currently " + str(now.hour) + ":" + str(now.minute) + " pm") | |
else: | |
return ("The time is currently " + str(now.hour) + ":" + str(now.minute) + " am") | |
def dateShorthand(): #the date in just numbers | |
now = datetime.datetime.now() | |
return ("The date is " + str(now.day) + "/" + str(now.month) + "/" + str(now.year)) | |
def dateLonghand(): #the date in numbers and words (more fancy) | |
months = {1:"January",2:"febuary",3:"March",4:"April",5:"May",6:"June", | |
7:"July",8:"August",9:"September",10:"October",11:"November", | |
12:"December"} | |
now = datetime.datetime.now() | |
if len(str(now.day)) == 2 and str(now.day)[0] == 1: | |
return ("The date is the " + str(now.day) + "th of " + months[now.month] + " " + str(now.year)) | |
else: | |
if str(now.day)[-1] == "1": | |
return ("The date is the " + str(now.day) + "st of " + months[now.month] + " " + str(now.year)) | |
elif str(now.day)[-1] == "2": | |
return ("The date is the " + str(now.day) + "nd of " + months[now.month] + " " + str(now.year)) | |
elif str(now.day)[-1] == "3": | |
return ("The date is the " + str(now.day) + "rd of " + months[now.month] + " " + str(now.year)) | |
else: | |
return ("The date is the " + str(now.day) + "th of " + months[now.month] + " " + str(now.year)) | |
def help(): | |
thingsToDo = ["- small talk (how are you)","- weather","- date","- time" | |
,"- number of cases of covid-19"] | |
string = ("Things you can ask about:") | |
for i in range(len(thingsToDo)): | |
string += ("\n" + thingsToDo[i]) | |
return string | |
def extraHelp(): #same as help but you can rearange the order of the help list | |
thingsToDo = ["- small talk (how are you)","- weather","- date","- time" | |
,"- number of cases of covid-19","- arranging the help list"] | |
return ("Things you can ask about:") | |
for i in range(len(thingsToDo)): | |
return (thingsToDo[i]) | |
choice = input("What would you like to do? ") #get this throught discord normally | |
if choice == "arrange help" or choice == "arrange list" or choice == "arranging the help list": | |
choice2 = input("would you like to arrange it alphabetically, length order or date created?") | |
if "alphabet" in choice2: | |
alphabet = "abcdefghijklmnopqrstuvwxyz" | |
counter = 0 | |
while counter != len(thingsToDo)-1: | |
counter = 0 # uses a bubble sort to arrange alphabetically | |
for i in range(len(thingsToDo)-1): | |
if alphabet.index(thingsToDo[i][2]) > alphabet.index(thingsToDo[i+1][2]): | |
holder = thingsToDo[i] | |
thingsToDo[i] = thingsToDo[i+1] | |
thingsToDo[i+1] = holder | |
else: | |
counter +=1 | |
elif "length" in choice2: | |
for i in range(len(thingsToDo)): | |
holder = i # uses a selection sort to arrange by length | |
for j in range(i,len(thingsToDo)): | |
if len(thingsToDo[j]) < len(thingsToDo[holder]): | |
holder = j | |
holder2 = thingsToDo[i] | |
thingsToDo[i] = thingsToDo[holder] | |
thingsToDo[holder] = holder2 | |
elif "date" in choice2 or "create" in choice2: | |
extraHelp() | |
return ("Things you can ask about:") | |
for i in range(len(thingsToDo)): | |
return (thingsToDo[i]) |