1
0
mirror of https://gitlab.com/MisterBiggs/multi-bot-tutorial.git synced 2025-06-16 07:06:51 +00:00
Multi-Bot-Tutorial/discordBot.py

35 lines
841 B
Python

import discord
from functions import nextLaunch
client = discord.Client()
@client.event
async def on_ready():
print("We have logged in as {0.user}".format(client))
@client.event
async def on_message(message):
# Prevent bot from replying to itself
if message.author == client.user:
return
if message.content.startswith("/launch"):
launch = nextLaunch()
embed = discord.Embed(
title=f"Mission: {launch['mission']}",
description=f"Rocket: {launch['rocket']}",
color=0x069AD2,
)
embed.add_field(name="Launch Date", value=launch["date"], inline=False)
embed.add_field(
name="Countdown to Launch", value=launch["countdown"], inline=False
)
await message.channel.say(embed=embed)
client.run("your token here")