[V3 Bank] Raise TypeError when passing a non-int transaction amount #1976

Merged
Tobotimus merged 5 commits from V3/bugfix/1975 into V3/develop 2018-08-09 14:13:32 +02:00
Tobotimus commented 2018-08-04 08:41:41 +02:00 (Migrated from github.com)

Resolves #1975

Non-int transaction amounts don't really make any logical sense, so instead of naïvely putting them into Config, we should make sure the user is supplying the correct type.

Resolves #1975 Non-int transaction amounts don't really make any logical sense, so instead of naïvely putting them into Config, we should make sure the user is supplying the correct type.
palmtree5 (Migrated from github.com) reviewed 2018-08-04 08:41:41 +02:00
Twentysix26 (Migrated from github.com) reviewed 2018-08-04 08:41:41 +02:00
Redjumpman (Migrated from github.com) reviewed 2018-08-07 06:08:26 +02:00
@ -214,8 +214,12 @@ async def withdraw_credits(member: discord.Member, amount: int) -> int:
ValueError
Redjumpman (Migrated from github.com) commented 2018-08-07 06:08:26 +02:00

Missing a period at the end of this statement.

Missing a period at the end of this statement.
Redjumpman (Migrated from github.com) reviewed 2018-08-07 06:08:53 +02:00
@ -245,8 +249,12 @@ async def deposit_credits(member: discord.Member, amount: int) -> int:
------
Redjumpman (Migrated from github.com) commented 2018-08-07 06:08:53 +02:00

Missing a period at the end of this statement.

Missing a period at the end of this statement.
Redjumpman (Migrated from github.com) reviewed 2018-08-07 06:09:25 +02:00
@ -269,14 +277,18 @@ async def transfer_credits(from_: discord.Member, to: discord.Member, amount: in
Returns
Redjumpman (Migrated from github.com) commented 2018-08-07 06:09:25 +02:00

Missing a period at the end of this statement.

Missing a period at the end of this statement.
Redjumpman commented 2018-08-07 06:15:35 +02:00 (Migrated from github.com)

I marked a few lines for the type error being raised, where it was missing a period. Overall this looks pretty good. I think having it raise a TypeError versus changing floats to an int internally is a better way to go. An internal conversion could round the number to a value the user was not expecting.

To remark on the previous issue that was started, floats do not really make sense for economy, and it really causes some weird issues with the leader board when you get some crazy long float.

Other than the punctuation, this PR is ready.

Note: Only adding my supporting rationale for this PR in case this is revisited in the future.

I marked a few lines for the type error being raised, where it was missing a period. Overall this looks pretty good. I think having it raise a TypeError versus changing floats to an int internally is a better way to go. An internal conversion could round the number to a value the user was not expecting. To remark on the previous issue that was started, floats do not really make sense for economy, and it really causes some weird issues with the leader board when you get some crazy long float. Other than the punctuation, this PR is ready. **Note:** Only adding my supporting rationale for this PR in case this is revisited in the future.
Tobotimus commented 2018-08-07 07:32:52 +02:00 (Migrated from github.com)

Thanks @Redjumpman, the requested changes have been made.

Thanks @Redjumpman, the requested changes have been made.
Redjumpman (Migrated from github.com) approved these changes 2018-08-07 08:08:23 +02:00
Redjumpman (Migrated from github.com) left a comment

This is ready to go for B19

This is ready to go for B19
Sign in to join this conversation.
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Mrcoolgamer11/Red-DiscordBot!1976
No description provided.