mirror of
https://gitlab.com/MisterBiggs/multi-bot-tutorial.git
synced 2025-06-16 07:06:51 +00:00
first workable version of discord bot
This commit is contained in:
parent
f2fcc040fe
commit
8553f45ab5
@ -1,4 +1,5 @@
|
|||||||
import discord
|
import discord
|
||||||
|
from functions import nextLaunch
|
||||||
|
|
||||||
client = discord.Client()
|
client = discord.Client()
|
||||||
|
|
||||||
@ -10,11 +11,23 @@ async def on_ready():
|
|||||||
|
|
||||||
@client.event
|
@client.event
|
||||||
async def on_message(message):
|
async def on_message(message):
|
||||||
|
|
||||||
|
# Prevent bot from replying to itself
|
||||||
if message.author == client.user:
|
if message.author == client.user:
|
||||||
return
|
return
|
||||||
|
|
||||||
if message.content.startswith("$hello"):
|
if message.content.startswith("/launch"):
|
||||||
await message.channel.send("Hello!")
|
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")
|
client.run("your token here")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user