|
1 | | -import json |
2 | | -import os |
3 | 1 | import discord |
4 | 2 | from discord.ext import commands |
5 | 3 |
|
|
12 | 10 |
|
13 | 11 |
|
14 | 12 | ########################## |
15 | | -token = 'Ur_Bot_Token_Here' |
| 13 | +token = 'BOT_TOKEN' |
16 | 14 | ########################## |
17 | 15 |
|
18 | 16 |
|
@@ -140,73 +138,6 @@ async def userinfo(ctx, *, user: discord.Member = None): |
140 | 138 |
|
141 | 139 |
|
142 | 140 |
|
143 | | - |
144 | | -########################################### FCOIN ############################################# |
145 | | - |
146 | | - |
147 | | - |
148 | | - |
149 | | -if os.path.exists('amounts.json'): |
150 | | - with open('amounts.json', 'r') as file: |
151 | | - amounts = json.load(file) |
152 | | -else: |
153 | | - amounts = {} # default to not loading if file not found |
154 | | - |
155 | | - |
156 | | - |
157 | | - |
158 | | - |
159 | | -@bot.event |
160 | | -async def on_ready(): |
161 | | - global amounts |
162 | | - try: |
163 | | - with open('amounts.json') as f: |
164 | | - amounts = json.load(f) |
165 | | - except FileNotFoundError: |
166 | | - print("Could not load amounts.json") |
167 | | - amounts = {} |
168 | | - |
169 | | -@bot.command(pass_context=True) |
170 | | -async def balance(ctx): |
171 | | - id = str(ctx.message.author.id) |
172 | | - if id in amounts: |
173 | | - await ctx.send("You have {} in the bank".format(amounts[id])) |
174 | | - else: |
175 | | - await ctx.send("You do not have an account") |
176 | | - |
177 | | -@bot.command(pass_context=True) |
178 | | -async def register(ctx): |
179 | | - id = str(ctx.message.author.id) |
180 | | - if id not in amounts: |
181 | | - amounts[id] = 100 |
182 | | - await ctx.send("You are now registered") |
183 | | - _save() |
184 | | - else: |
185 | | - await ctx.send("You already have an account") |
186 | | - |
187 | | -@bot.command(pass_context=True) |
188 | | -async def transfer(ctx, amount: int, other: discord.Member): |
189 | | - primary_id = str(ctx.message.author.id) |
190 | | - other_id = str(other.id) |
191 | | - if primary_id not in amounts: |
192 | | - await ctx.send("You do not have an account") |
193 | | - elif other_id not in amounts: |
194 | | - await ctx.send("The other party does not have an account") |
195 | | - elif amounts[primary_id] < amount: |
196 | | - await ctx.send("You cannot afford this transaction") |
197 | | - else: |
198 | | - amounts[primary_id] -= amount |
199 | | - amounts[other_id] += amount |
200 | | - await ctx.send("Transaction complete") |
201 | | - _save() |
202 | | - |
203 | | -def _save(): |
204 | | - with open('amounts.json', 'w+') as f: |
205 | | - json.dump(amounts, f) |
206 | | - |
207 | | - |
208 | | - |
209 | | - |
210 | 141 | ############################################ ALIASES ########################################### |
211 | 142 |
|
212 | 143 | @bot.command(name='aliases', aliases=['al']) |
|
0 commit comments