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?
ChatBot/Station.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
49 lines (35 sloc)
2.13 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 discord | |
import asyncio | |
from discord.ext import commands | |
bot_token = # | |
client = discord.Client() | |
"""These are the 'subfeatures' the train/bus station feature for Coventry Friendly Bot will have""" | |
nearest_train_station = "'!nearestTrainStation' - this command gives you the nearest train station based on your location" | |
nearest_bus_station = "'!nearestBusStation' - this command gives you the nearest bus station based on your location" | |
how_to_get_there = "'!howToGetThere' - this command gives lets you plan the best method to get somewhere" | |
timetables = "'!timetable' - this command gives you information on timetables" | |
live_departures = "'!liveDepartures' = this command gives you information live departures" | |
fares = "'!fare' - this command gives you information of fares" | |
sub_features_list = str(nearest_train_station) + "\n\n" + str(nearest_bus_station) + "\n\n" + str(how_to_get_there) + "\n\n" + str(timetables) + "\n\n" + str(live_departures) + "\n\n" + str(fares) | |
sub_features = "This is all you can get from this feature:\n\n" + sub_features_list | |
feature_in_dev = "This feature is still in development....." | |
@client.event | |
async def on_message(message): | |
if message.author == client.user: | |
return | |
if message.content.startswith('!station'): | |
"""Greets the User and shows the 'subfeatures' for this feature""" | |
msg = "Hello again, {0.author.mention}".format(message) + "! Welcome to my train/bus station feature!\n\n\n" + str(sub_features) | |
await client.send_message(message.author, msg) | |
elif message.content.startswith("!nearestTrainStation") or message.content.startswith("!nearestBusStation") or message.content.startswith("!howToGetThere") or message.content.startswith("!timetable") or message.content.startswith("!liveDepartures") or message.content.startswith("!fare"): | |
"""As I still haven't programmed the features, the User will receive a message saying the features are still in development""" | |
await client.send_message(message.author, feature_in_dev) | |
else: | |
pass | |
client.run(bot_token) | |
@client.event | |
async def on_ready(): | |
print('Logged in as') | |
print(client.user.name) | |
print(client.user.id) | |
print('------') |