Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import discord
- import random
- import asyncio
- import sys, traceback
- from discord import opus
- import time
- from discord.ext import commands
- from pymongo import MongoClient
- import pymongo
- import random
- import datetime
- import datetime
- from datetime import datetime
- from datetime import datetime, timedelta
- from datetime import date
- url = "url"
- cooldown = [50]
- def year(method=datetime):
- now = method.now()
- return (now.strftime("%Y"))
- def hora(method=datetime):
- now = method.now()
- return (now.strftime("%H:%M"))
- class rpg(commands.Cog):
- def __init__(self, client):
- self.client = client
- @commands.command()
- async def registrar(self, ctx):
- try:
- mongo = MongoClient(url)
- luiz13 = mongo["luiz13"]
- rpg = luiz13['rpg']
- rpg = luiz13.rpg.find_one({"_id":str(ctx.author.id)})
- if rpg is None:
- usuario = {"_id":str(ctx.author.id),"usuario":str(ctx.author.name), "coins":100}
- luiz13.rpg.insert_one(usuario).inserted_id
- await ctx.send(f"Olá {ctx.author.mention} você foi registrado com sucesso!!!")
- except:
- await ctx.send(f"Olá {ctx.author.mention},Você Já está registrado.")
- @commands.command()
- async def saldo(self, ctx):
- try:
- mongo = MongoClient(url)
- luiz13 = mongo["luiz13"]
- rpg = luiz13['luiz13']
- rpg = luiz13.rpg.find_one({"_id":str(ctx.author.id)})
- if rpg is None:
- await ctx.send(f"Olá {ctx.author.mention},Você não está registrado Digite l!registrar para se registrar.")
- else:
- moedas = rpg["coins"]
- arma = rpg["ak47"]
- xp = rpg["xp"]
- car = rpg["Carro"]
- embedrpg = discord.Embed(title=f'Seu Saldo {ctx.author.mention} ',color=0x83f68a)
- embedrpg.add_field(name='Suas Moedas:',value=moedas,inline=False)
- await ctx.send(embed=embedrpg)
- @commands.command()
- async def job(self, ctx):
- if ctx.author.id in cooldown:
- await ctx.send(f"Olá {ctx.author.mention},Você Precisa Aguardar 30 minutos para voltar a utilizar esse comando.")
- return
- try:
- mongo = MongoClient(url)
- mordomodiscordpython = mongo["luiz13"]
- rpg = luiz13['rpg']
- rpg = luiz13.rpg.find_one({"_id":str(ctx.author.id)})
- if rpg is None:
- await ctx.send(f"Olá {ctx.author.mention},Você não está registrado Digite l!registrar para se registrar.")
- else:
- coins = random.randint(0,300)
- moedas = int(rpg["coins"])+int(coins)
- luiz13.rpg.update_one({"_id":str(ctx.author.id)},{"$set":{"coins":int(moedas)}})
- await ctx.send(f"Olá {ctx.author.mention},Você Ganhou{coins} Moedas Agora.")
- cooldown.append(ctx.author.id)
- await asyncio.sleep(1800)
- cooldown.remove(ctx.author.id)
- def setup(client):
- client.add_cog(rpg(client))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement