Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import asyncio
- import random
- import json
- import time
- import discord
- from discord.ext.commands import Bot
- BOT_PREFIX = "k!"
- TOKEN = "NjExNDQyNzU3OTkwNDgxOTIx.XVT4wQ.SE3bxqpifkDzVCTC8DoC6A1wqlc"
- client = Bot(command_prefix=BOT_PREFIX)
- bot = Bot(command_prefix=BOT_PREFIX)
- rolling = 1
- @client.event
- async def on_ready():
- print(f'We have logged in as {client.user}') # notification of login.
- print(discord.__version__)
- # @client.event
- # async def on_message(message): # event that happens per any message.
- # print(f"{message.channel}: {message.author}: {message.author.name}: {message.content}")
- # if (message.content == "k!roll")
- @client.command()
- async def roulette(ctx, wager: int):
- global rolling
- if rolling == 1:
- rolling = 0
- anim = 7
- direction = random.randint(0, 7)
- arrows = [
- ":arrow_up:",
- ":arrow_upper_right:",
- ":arrow_right:",
- ":arrow_lower_right:",
- ":arrow_down:",
- ":arrow_lower_left:",
- ":arrow_left:",
- ":arrow_upper_left:"
- ]
- e = discord.Embed(title="Roulette Wheel", description="Wager: " + str(wager), color=0x00AD83)
- e.add_field(name="----------------",
- value="0.5x | 3x | 0x\n1.5x |" + arrows[direction] + "| 2x\n0.3x | 2x | 0x",
- inline=False)
- updatedembed = discord.Embed(title="Roulette Wheel", description="Wager: " + str(wager), color=0x00AD83)
- updatedembed.add_field(name="----------------",
- value="0.5x | 3x | 0x\n1.5x |" + arrows[direction] + "| 2x\n0.3x | 2x | 0x",
- inline=False)
- msg = await ctx.send(embed=e)
- while anim > 0:
- direction -= 1
- anim -= 1
- updatedembed = discord.Embed(title="Roulette Wheel", description="Wager: " + str(wager), color=0x00AD83)
- updatedembed.add_field(name="----------------",
- value="0.5x | 3x | 0x\n1.5x |" + arrows[direction] + "| 2x\n0.3x | 2x | 0x",
- inline=False)
- await msg.edit(embed=updatedembed)
- if direction < 0:
- direction = 7
- if anim >= 5:
- await asyncio.sleep(0.5)
- elif anim >= 3:
- await asyncio.sleep(1.34)
- elif anim >= 0:
- await asyncio.sleep(2)
- if anim == 0:
- rolling = 1
- if direction == 0:
- await ctx.send("You profited " + str(wager*3-wager) + ". Total win: " + str(wager*3))
- elif direction == 1 or direction == 3:
- await ctx.send("You lost all your bet")
- elif direction == 2 or direction == 4:
- await ctx.send("You profited " + str(wager*2-wager) + ". Total win: " + str(wager*2))
- elif direction == 5:
- await ctx.send("You lost " + str(wager-wager*0.3) + ". You only have " + str(wager*0.3) + " remaining from your bet.")
- elif direction == 6:
- await ctx.send("You profited " + str(wager*1.5-wager) + ". Total win: " + str(wager*1.5))
- elif direction == 7:
- await ctx.send("You lost " + str(wager-wager*0.5) + ". You only have " + str(wager*0.5) + " remaining from your bet.")
- else:
- await ctx.send("Rolling, please wait...")
- @client.command()
- async def ping(ctx):
- """Pings the bot"""
- pingtime = time.time()
- e = discord.Embed(title="Pinging...", colour=0xFF0000)
- msg = await ctx.send(embed=e)
- ping = time.time() - pingtime
- complete = "Pong, %.01f seconds" % ping
- em = discord.Embed(title=complete, colour=0xFF0000)
- await msg.edit(embed=em)
- client.run(TOKEN)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement