-
Notifications
You must be signed in to change notification settings - Fork 0
/
vending_machine.py
32 lines (24 loc) · 1.18 KB
/
vending_machine.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import discord
from discord.ext import commands
import os
import io
import random
import asyncio
script_path = os.path.dirname(__file__)
@commands.command()
async def vending_machine(ctx):
"""Buy an item from the vending machine."""
with open(script_path + "/data/vending_machine.txt", "r", encoding="utf8") as vending_machine_file:
the_prize = random.choice(vending_machine_file.readlines())
with open(script_path + "/data/titles.txt","r", encoding="utf8") as tf:
the_title = random.choice(tf.readlines())
embed = discord.Embed(title="_You insert a coin in the vending machine..._", color=0x47e18a)
message = await ctx.send(content="", embed=embed)
await asyncio.sleep(3) # DRAMATIC TENSION
embed2=discord.Embed(title="**" + the_title + "**", color=0x47e18a)
embed2.set_thumbnail(url="https://media.discordapp.net/attachments/280298381807714304/776122672898768956/vending_machine.png")
embed2.add_field(name="_ _", value= the_prize, inline=False)
embed2.set_footer(text="VoidCorp™")
await message.edit(content="", embed=embed2)
async def setup(bot):
await bot.add_command(vending_machine(bot))