Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import discord
- from discord.ext import commands
- from discord import utils
- from discord import Embed
- from discord import activity
- TOKEN = 'ODM2NTIxOTAwMTA4ODA4MjEz.YIfNug.oWr0wycw0c_MlCzkXImufhrAbhU'
- bot = commands.Bot(command_prefix='!')
- client = discord.Client()
- bot.remove_command('help')
- @bot.event
- async def on_ready():
- await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.listening, name="!coins"))
- print('Connected to bot: {}'.format(bot.user.name))
- print('Bot ID: {}'.format(bot.user.id))
- print('Ready\n')
- @bot.command()
- async def coins(ctx):
- user = ctx.author.id
- with open(str(user) + ".txt", "a+") as FileWithCoinsValue:
- print(FileWithCoinsValue.readline(0))
- CoinsValue = FileWithCoinsValue.readline(0)
- IntCoinsValue = 0
- if FileWithCoinsValue.readline(0) is None:
- FileWithCoinsValue.write("0")
- else:
- IntCoinsValue = int(CoinsValue)
- IntCoinsValue += 1000
- FileWithCoinsValue.readline(0).replace(FileWithCoinsValue.readline(0), str(IntCoinsValue))
- embed = Embed(title="Coins")
- embed.add_field(name="You are using `!coins` command", value='Your coins: ' + str(IntCoinsValue))
- await ctx.send(embed=embed)
- bot.run(TOKEN)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement